Bug #22883 ยป enable_deprecation_log.diff
typo3/sysext/reports/reports/status/class.tx_reports_reports_status_configurationstatus.php (working copy) | ||
---|---|---|
*/
|
||
class tx_reports_reports_status_ConfigurationStatus implements tx_reports_StatusProvider {
|
||
// 10 MB
|
||
protected $deprecationLogFileSizeWarningThreshold = 10485760;
|
||
// 100 MB
|
||
protected $deprecationLogFileSizeErrorThreshold = 104857600;
|
||
/**
|
||
* Determines the Install Tool's status, mainly concerning its protection.
|
||
*
|
||
... | ... | |
public function getStatus() {
|
||
$statuses = array(
|
||
'emptyReferenceIndex' => $this->getReferenceIndexStatus(),
|
||
'deprecationLog' => $this->getDeprecationLogStatus()
|
||
);
|
||
if ($this->isMemcachedUsed()) {
|
||
... | ... | |
$count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'sys_refindex');
|
||
$registry = t3lib_div::makeInstance('t3lib_Registry');
|
||
$lastRefIndexUpdate = $registry->get('core', 'sys_refindex_lastUpdate');
|
||
$lastRefIndexUpdate = $registry->get('core', 'sys_refindex_lastUpdate');
|
||
if (!$count && $lastRefIndexUpdate) {
|
||
$value = $GLOBALS['LANG']->getLL('status_empty');
|
||
... | ... | |
);
|
||
}
|
||
/**
|
||
* Provides status information on the deprecation log, whether it's enabled
|
||
* and if so whether certain limits in file size are reached.
|
||
*
|
||
* @return tx_reports_reports_status_Status The deprecation log status.
|
||
*/
|
||
protected function getDeprecationLogStatus() {
|
||
$title = $GLOBALS['LANG']->getLL('status_configuration_DeprecationLog');
|
||
$value = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:disabled');
|
||
$message = '';
|
||
$severity = tx_reports_reports_status_Status::OK;
|
||
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['enableDeprecationLog']) {
|
||
$value = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:enabled');
|
||
$message = '<p>' . $GLOBALS['LANG']->getLL('status_configuration_DeprecationLogEnabled') . '</p>';
|
||
$severity = tx_reports_reports_status_Status::NOTICE;
|
||
$logFile = t3lib_div::getDeprecationLogFileName();
|
||
$logFileSize = file_exists($logFile) ? filesize($logFile) : 0;
|
||
if ($logFileSize > $this->deprecationLogFileSizeWarningThreshold) {
|
||
$severity = tx_reports_reports_status_Status::WARNING;
|
||
}
|
||
if ($logFileSize > $this->deprecationLogFileSizeErrorThreshold) {
|
||
$severity = tx_reports_reports_status_Status::ERROR;
|
||
}
|
||
if ($severity > tx_reports_reports_status_Status::OK) {
|
||
$message .= '<p> ' . sprintf(
|
||
$GLOBALS['LANG']->getLL('status_configuration_DeprecationLogSize'),
|
||
t3lib_div::formatSize($logFileSize)
|
||
) . '</p>';
|
||
}
|
||
}
|
||
return t3lib_div::makeInstance('tx_reports_reports_status_Status',
|
||
$title, $value, $message, $severity
|
||
);
|
||
}
|
||
}
|
||
typo3/sysext/reports/reports/locallang.xml (working copy) | ||
---|---|---|
<label index="status_phpRegisterGlobalsPHPManual">The PHP manual has instructions for %s.</label>
|
||
<label index="status_webServer">Web Server</label>
|
||
<label index="status_installEnabledTemporarily">The Install Tool is temporarily enabled. Delete the file "%s" when you have finished setting up TYPO3. If not used the Install Tool will be disabled automatically in %s minutes.</label>
|
||
<label index="status_configuration_DeprecationLog">Deprecation Log</label>
|
||
<label index="status_configuration_DeprecationLogEnabled">The deprecation log tracks whether old APIs are being used in extensions. Depending on the extensions you use and whether they use deprecated APIs it can happen that the log takes up quite some space over time. The more space it takes up, the more it may affect your installation's performance. It is recommended to disable deprecation log in production environments.</label>
|
||
<label index="status_configuration_DeprecationLogSize">Your deprecation log file currently takes up %s.</label>
|
||
</languageKey>
|
||
</data>
|
||
</T3locallang>
|
typo3/sysext/lang/locallang_common.xml (working copy) | ||
---|---|---|
<label index="descending">Descending</label>
|
||
<label index="details">Details</label>
|
||
<label index="disable">Disable</label>
|
||
<label index="disabled">Disabled</label>
|
||
<label index="down">Down</label>
|
||
<label index="download">Download</label>
|
||
<label index="edit">Edit</label>
|
||
<label index="editField">Edit field</label>
|
||
<label index="editFile">Edit file</label>
|
||
<label index="enable">Enable</label>
|
||
<label index="enabled">Enabled</label>
|
||
<label index="file">File</label>
|
||
<label index="files">Files</label>
|
||
<label index="first">First</label>
|
t3lib/config_default.php (working copy) | ||
---|---|---|
'phpTimeZone' => '', // String: timezone to force for all date() and mktime() functions. A list of supported values can be found at http://php.net/manual/en/timezones.php. If this is not set, a valid fallback will be searched for by PHP (php.ini's date.timezone setting, server defaults, etc); and if no fallback is found, the value of "UTC" is used instead.
|
||
'systemLog' => '', // String, semi-colon separated list: Defines one or more logging methods. Possible methods: file,<abs-path-to-file>[,<level>];mail,<to>[/<from>][,<level>];syslog,<facility>,[,<level>];error_log[,,<level>]. "file" logs to a file, "mail" sends the log entries via mail, "syslog" uses the operating system's log, "error_log" uses the PHP error log. The level is the individual logging level (see [SYS][systemLogLevel]. Facility may be one of LOCAL0..LOCAL7, USER (on Windows USER is the only valid type).
|
||
'systemLogLevel' => 0, // Integer: Only messages with same or higher severity are logged; 0 is info, 1 is notice, 2 is warning, 3 is error, 4 is fatal error.
|
||
'enableDeprecationLog' => '', // Commalist: Enables the logging of deprecated methods and functions. Default is empty for no logging. The following options are allowed: 'file': The log file will be written to typo3conf/deprecation_[hash-value].log 'devlog': The log file will be written to dev log 'console': The log will be displayed in the Backend's Debug Console. The logging options can be combined by comma-separating them.
|
||
'enableDeprecationLog' => 'file', // Commalist: Enables the logging of deprecated methods and functions. Default is 'file'. The following options are allowed: 'file': The log file will be written to typo3conf/deprecation_[hash-value].log 'devlog': The log will be written to the development log 'console': The log will be displayed in the Backend's Debug Console. The logging options can be combined by comma-separating them.
|
||
'maxFileNameLength' => 60, // Integer, This is the maximum file name length. The value will be taken into account by basic file operations like renaming or creation of files and folders.
|
||
'UTF8filesystem' => FALSE, // Boolean: If true and [BE][forceCharset] is set to utf-8, then TYPO3 uses utf-8 to store file names. This allows for accented Latin letters as well as any other non-latin characters like Cyrillic and Chinese.
|
||
'lockingMode' => 'simple', // String: Define which locking mode is used to control requests to pages being generated. Can be one of either "disable" (no locking), "simple" (checks for file existance), "flock" (using PHPs flock() function), "semaphore" (using PHPs sem_acquire() function). Default is "disable".
|
t3lib/class.t3lib_div.php (working copy) | ||
---|---|---|
}
|
||
if (stripos($log, 'file') !== FALSE) {
|
||
// write a longer message to the deprecation log
|
||
$destination = PATH_typo3conf . '/deprecation_' . self::shortMD5(PATH_site . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']) . '.log';
|
||
// write a longer message to the deprecation log
|
||
$destination = self::getDeprecationLogFileName();
|
||
$file = @fopen($destination, 'a');
|
||
if ($file) {
|
||
flock($file, LOCK_EX); // try locking, but ignore if not available (eg. on NFS and FAT)
|
||
... | ... | |
}
|
||
/**
|
||
* Gets the absolute path to the deprecation log file.
|
||
*
|
||
* @return string absolute path to the deprecation log file
|
||
*/
|
||
public static function getDeprecationLogFileName() {
|
||
return PATH_typo3conf .
|
||
'/deprecation_' .
|
||
self::shortMD5(
|
||
PATH_site . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']
|
||
) .
|
||
'.log';
|
||
}
|
||
/**
|
||
* Logs a call to a deprecated function.
|
||
* The log message will be taken from the annotation.
|
||
* @return void
|