[TYPO3-core] Better filenames for TYPO3 "http" log
Martin Kutschker
Martin.Kutschker at blackbox.net
Tue Jul 5 10:24:04 CEST 2005
This is a CVS patch request.
Type: New feature
Description:
This patch uses the t3lib_cs-translietartion for filenames instead of replacing all non-ascii chars with underscores.
Branches: HEAD
Bugtracker reference: http://bugs.typo3.org/view.php?id=1152
Files:
class.tslib_fe.php-niceStatFileNames.patch
Masi
-------------- next part --------------
--- class.tslib_fe.php.orig 2005-06-02 10:13:12.245121696 +0200
+++ class.tslib_fe.php 2005-06-02 10:52:56.435669640 +0200
@@ -1547,6 +1547,8 @@
* @return void
*/
function getConfigArray() {
+ $setStatPageName = false;
+
if (!is_array($this->config) || is_array($this->config['INTincScript']) || $this->forceTemplateParsing) { // If config is not set by the cache (which would be a major mistake somewhere) OR if INTincScripts-include-scripts have been registered, then we must parse the template in order to get it
$GLOBALS['TT']->push('Parse template','');
@@ -1596,17 +1598,9 @@
if ($this->config['config']['stat_apache'] && $this->config['config']['stat_apache_logfile'] && !strstr($this->config['config']['stat_apache_logfile'],'/')) {
if(t3lib_div::isAllowedAbsPath($theLogFile) && @is_file($theLogFile) && @is_writable($theLogFile)) {
$this->config['stat_vars']['logFile'] = $theLogFile;
- $shortTitle = substr(ereg_replace('[^\.[:alnum:]_-]','_',$this->page['title']),0,30);
- $pageName = $this->config['config']['stat_apache_pagenames'] ? $this->config['config']['stat_apache_pagenames'] : '[path][title]--[uid].html';
- $pageName = str_replace('[title]', $shortTitle ,$pageName);
- $pageName = str_replace('[uid]',$this->page['uid'],$pageName);
- $pageName = str_replace('[alias]',$this->page['alias'],$pageName);
- $pageName = str_replace('[type]',$this->page['type'],$pageName);
- $temp = $this->config['rootLine'];
- array_pop($temp);
- $len = t3lib_div::intInRange($this->config['config']['stat_titleLen'],1,100,20);
- $pageName = str_replace('[path]', ereg_replace('[^\.[:alnum:]\/_-]','_',$this->sys_page->getPathFromRootline($temp,$len)).'/' ,$pageName);
- $this->config['stat_vars']['pageName'] = $pageName;
+
+ // set page name later on
+ $setStatPageName = true;
} else {
$GLOBALS['TT']->setTSlogMessage('Could not set logfile path. Check filepath and permissions.',3);
}
@@ -1624,6 +1618,22 @@
// Initialize charset settings etc.
$this->initLLvars();
+ // We want nice names, so we need to know the charset
+ if ($setStatPageName) {
+ $shortTitle = $this->csConvObj->specCharsToASCII($this->renderCharset,$this->page['title']);
+ $shortTitle = substr(ereg_replace('[^\.[:alnum:]_-]','_',$shortTitle),0,30);
+ $pageName = $this->config['config']['stat_apache_pagenames'] ? $this->config['config']['stat_apache_pagenames'] : '[path][title]--[uid].html';
+ $pageName = str_replace('[title]', $shortTitle ,$pageName);
+ $pageName = str_replace('[uid]',$this->page['uid'],$pageName);
+ $pageName = str_replace('[alias]',$this->page['alias'],$pageName);
+ $pageName = str_replace('[type]',$this->page['type'],$pageName);
+ $temp = $this->config['rootLine'];
+ array_pop($temp);
+ $len = t3lib_div::intInRange($this->config['config']['stat_titleLen'],1,100,20);
+ $pageName = str_replace('[path]', ereg_replace('[^\.[:alnum:]\/_-]','_',$this->sys_page->getPathFromRootline($temp,$len)).'/' ,$pageName);
+ $this->config['stat_vars']['pageName'] = $pageName;
+ }
+
// No cache
if ($this->config['config']['no_cache']) { $this->set_no_cache(); } // Set $this->no_cache true if the config.no_cache value is set!
@@ -3668,4 +3678,4 @@
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_fe.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_fe.php']);
}
-?>
\ No newline at end of file
+?>
More information about the TYPO3-team-core
mailing list