Merge pull request #2164 from gproly/BUG-13506

Bug 13506 SOLVED La sección ADMIN / Logs, opción Cron, se queda cargando y en consola de navegador se muestra el error 500 internal Server Error.
This commit is contained in:
julceslauhub
2013-11-26 07:22:17 -08:00
8 changed files with 161 additions and 18 deletions

View File

@@ -89,6 +89,13 @@ class workspaceTools
$stop = microtime(true);
$final = $stop - $start;
CLI::logging("<*> Updating cache view Process took $final seconds.\n");
$start = microtime(true);
CLI::logging("> Backup log files...\n");
$this->backupLogFiles();
$stop = microtime(true);
$final = $stop - $start;
CLI::logging("<*> Backup log files Process took $final seconds.\n");
}
/**
@@ -1424,5 +1431,21 @@ class workspaceTools
return $result;
}
public function backupLogFiles()
{
$config = System::getSystemConfiguration();
clearstatcache();
$path = PATH_DATA . "log" . PATH_SEP;
$filePath = $path . "cron.log";
if (file_exists($filePath)) {
$size = filesize($filePath);
/* $config['size_log_file'] has the value 5000000 -> approximately 5 megabytes */
if ($size > $config['size_log_file']) {
rename($filePath, $filePath . ".bak");
}
}
}
}