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:
@@ -895,12 +895,7 @@ function saveLog($sSource, $sType, $sDescription)
|
||||
}
|
||||
|
||||
G::verifyPath(PATH_DATA . "log" . PATH_SEP, true);
|
||||
|
||||
//setExecutionMessage( PATH_DATA."log".PATH_SEP);
|
||||
|
||||
$oFile = @fopen(PATH_DATA . "log" . PATH_SEP . "cron.log", "a+");
|
||||
@fwrite($oFile, date("Y-m-d H:i:s") . " | $sObject | " . $sSource . " | $sType | " . $sDescription . "\n");
|
||||
@fclose($oFile);
|
||||
G::log(date("Y-m-d H:i:s") . " | $sObject | " . $sSource . " | $sType | " . $sDescription . "\n", PATH_DATA);
|
||||
} catch (Exception $e) {
|
||||
//CONTINUE
|
||||
}
|
||||
|
||||
@@ -336,17 +336,15 @@ function saveLog($sSource, $sType, $sDescription)
|
||||
global $isDebug;
|
||||
if ($isDebug)
|
||||
print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n";
|
||||
@fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
|
||||
|
||||
G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true);
|
||||
$message = date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n";
|
||||
if ($sType == 'action') {
|
||||
$oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
|
||||
G::log($message, PATH_DATA);
|
||||
}
|
||||
else {
|
||||
$oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cronError.log', 'a+');
|
||||
G::log($message, PATH_DATA, 'cronError.log');
|
||||
}
|
||||
@fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
|
||||
@fclose ($oFile);
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
// CONTINUE
|
||||
|
||||
@@ -515,17 +515,15 @@ function saveLog($sSource, $sType, $sDescription)
|
||||
global $isDebug;
|
||||
if ($isDebug)
|
||||
print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n";
|
||||
@fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
|
||||
|
||||
G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true);
|
||||
$message = date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n";
|
||||
if ($sType == 'action') {
|
||||
$oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cron.log', 'a+');
|
||||
G::log($message, PATH_DATA);
|
||||
}
|
||||
else {
|
||||
$oFile = @fopen (PATH_DATA . 'log' . PATH_SEP . 'cronError.log', 'a+');
|
||||
G::log($message, PATH_DATA, 'cronError.log');
|
||||
}
|
||||
@fwrite ($oFile, date ('Y-m-d H:i:s') . '(' . $sSource . ') ' . $sDescription . "\n");
|
||||
@fclose ($oFile);
|
||||
}
|
||||
catch (Exception $oError) {
|
||||
// CONTINUE
|
||||
|
||||
@@ -1084,7 +1084,7 @@ class System
|
||||
}
|
||||
|
||||
// default configuration
|
||||
$config = array ('debug' => 0,'debug_sql' => 0,'debug_time' => 0,'debug_calendar' => 0,'wsdl_cache' => 1,'memory_limit' => "256M", 'time_zone' => 'America/New_York','memcached' => 0,'memcached_server' => '','default_skin' => 'neoclassic','default_lang' => 'en','proxy_host' => '','proxy_port' => '','proxy_user' => '','proxy_pass' => '');
|
||||
$config = array('debug' => 0, 'debug_sql' => 0, 'debug_time' => 0, 'debug_calendar' => 0, 'wsdl_cache' => 1, 'memory_limit' => "256M", 'time_zone' => 'America/New_York', 'memcached' => 0, 'memcached_server' => '', 'default_skin' => 'neoclassic', 'default_lang' => 'en', 'proxy_host' => '', 'proxy_port' => '', 'proxy_user' => '', 'proxy_pass' => '', 'size_log_file' => 5000000, 'number_log_file' => 5);
|
||||
|
||||
// read the global env.ini configuration file
|
||||
if ($readGlobalIniFile && ($globalConf = @parse_ini_file( $globalIniFile )) !== false) {
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user