本文整理汇总了PHP中eZDebug::maxLogrotateFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDebug::maxLogrotateFiles方法的具体用法?PHP eZDebug::maxLogrotateFiles怎么用?PHP eZDebug::maxLogrotateFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDebug
的用法示例。
在下文中一共展示了eZDebug::maxLogrotateFiles方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rotateLog
static function rotateLog($fileName)
{
$maxLogrotateFiles = eZDebug::maxLogrotateFiles();
for ($i = $maxLogrotateFiles; $i > 0; --$i) {
$logRotateName = $fileName . '.' . $i;
if (@file_exists($logRotateName)) {
if ($i == $maxLogrotateFiles) {
@unlink($logRotateName);
// print( "@unlink( $logRotateName )<br/>" );
} else {
$newLogRotateName = $fileName . '.' . ($i + 1);
//include_once( 'lib/ezfile/classes/ezfile.php' );
eZFile::rename($logRotateName, $newLogRotateName);
// print( "@rename( $logRotateName, $newLogRotateName )<br/>" );
}
}
}
if (@file_exists($fileName)) {
$newLogRotateName = $fileName . '.' . 1;
//include_once( 'lib/ezfile/classes/ezfile.php' );
eZFile::rename($fileName, $newLogRotateName);
// print( "@rename( $fileName, $newLogRotateName )<br/>" );
return true;
}
return false;
}
示例2: rotateLog
static function rotateLog($fileName)
{
$maxLogrotateFiles = eZDebug::maxLogrotateFiles();
if ($maxLogrotateFiles == 0) {
return;
}
for ($i = $maxLogrotateFiles; $i > 0; --$i) {
$logRotateName = $fileName . '.' . $i;
if (file_exists($logRotateName)) {
if ($i == $maxLogrotateFiles) {
@unlink($logRotateName);
} else {
$newLogRotateName = $fileName . '.' . ($i + 1);
eZFile::rename($logRotateName, $newLogRotateName);
}
}
}
if (file_exists($fileName)) {
$newLogRotateName = $fileName . '.' . 1;
eZFile::rename($fileName, $newLogRotateName);
return true;
}
return false;
}
示例3:
<?php
/**
* Rotate logs of ws calls: since we store them in the per-sa dir, eZ will not do it on its own.
*
* We are very nice people, and allow a custom max file size to be specified
* instead of relying on eZ default one, and a number of rotated files to be kept, too!
*
* @author G. Giunta
* @copyright (C) 2009-2016 G. Giunta
*/
$ini = eZINI::instance('wsproviders.ini');
$maxFileSize = $ini->variable('GeneralSettings', 'MaxLogSize');
if ($maxFileSize <= 0) {
// in case ini setting is missing
$maxFileSize = eZDebug::maxLogSize();
}
if ($ini->hasVariable('GeneralSettings', 'MaxLogrotateFiles') && $ini->variable('GeneralSettings', 'MaxLogrotateFiles') > 0) {
$defaultrotate = eZDebug::maxLogrotateFiles();
eZDebug::setLogrotateFiles($ini->variable('GeneralSettings', 'MaxLogrotateFiles'));
}
$varDir = eZSys::varDirectory();
$logDir = 'log';
$logName = 'webservices.log';
$fileName = $varDir . '/' . $logDir . '/' . $logName;
if (file_exists($fileName) && filesize($fileName) > $maxFileSize) {
eZDebug::rotateLog($fileName);
}
if (isset($defaultrotate)) {
eZDebug::setLogrotateFiles($defaultrotate);
}