mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Prevent empty log files.
This commit is contained in:
@@ -654,14 +654,20 @@ class e_admin_log
|
|||||||
$text .= " e107 CMS Log file : ".$logTitle." ".date('Y-m-d_H-i-s')."\n";
|
$text .= " e107 CMS Log file : ".$logTitle." ".date('Y-m-d_H-i-s')."\n";
|
||||||
$text .= "-------------------------------------------------------------------------------------------\n\n";
|
$text .= "-------------------------------------------------------------------------------------------\n\n";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach($this->_allMessages as $m)
|
foreach($this->_allMessages as $m)
|
||||||
{
|
{
|
||||||
$text .= date('Y-m-d H:i:s',$m['time'])." \t".str_pad($m['dislevel'],10," ",STR_PAD_RIGHT)."\t".strip_tags($m['message'])."\n";
|
$text .= date('Y-m-d H:i:s',$m['time'])." \t".str_pad($m['dislevel'],10," ",STR_PAD_RIGHT)."\t".strip_tags($m['message'])."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$date = date('Y-m-d_H-i-s');
|
||||||
|
$fileName = e_LOG.$date."_".$this->logFile.".log";
|
||||||
|
|
||||||
if(file_put_contents($this->logFile,$text))
|
if(file_put_contents($fileName,$text))
|
||||||
{
|
{
|
||||||
$this->_allMessages = array();
|
$this->_allMessages = array();
|
||||||
return $this->logFile;
|
return $this->logFile;
|
||||||
@@ -681,9 +687,9 @@ class e_admin_log
|
|||||||
public function toFile($name,$logTitle='')
|
public function toFile($name,$logTitle='')
|
||||||
{
|
{
|
||||||
|
|
||||||
$date = date('Y-m-d_H-i-s');
|
|
||||||
|
|
||||||
$this->logFile = e_LOG.$date."_".$name.".log";
|
|
||||||
|
$this->logFile = $name;
|
||||||
$this->saveToFile($logTitle);
|
$this->saveToFile($logTitle);
|
||||||
$this->logFile = null;
|
$this->logFile = null;
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED: Allows Storage of arrays without use of serialize functions
|
* @DEPRECATED: Allows Storage of arrays without use of serialize functions
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class ArrayData {
|
class ArrayData {
|
||||||
|
@@ -367,7 +367,7 @@ class e_array {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED - Backwards Compatible. Use write() instead;
|
* @DEPRECATED - Backwards Compatible. Use e107::serialize() instead;
|
||||||
* @param array $ArrayData array to be stored
|
* @param array $ArrayData array to be stored
|
||||||
* @param bool $AddSlashes default true, add slashes for db storage, else false
|
* @param bool $AddSlashes default true, add slashes for db storage, else false
|
||||||
* @returnReturn a string containg exported array data.
|
* @returnReturn a string containg exported array data.
|
||||||
@@ -385,7 +385,7 @@ class e_array {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEPRECATED: Use read(); instead.
|
* @DEPRECATED: Use e107::unserialize(); instead.
|
||||||
* Returns an array from stored array data.
|
* Returns an array from stored array data.
|
||||||
*
|
*
|
||||||
* @param string $ArrayData
|
* @param string $ArrayData
|
||||||
|
@@ -173,6 +173,7 @@ class e107plugin
|
|||||||
$xml = e107::getXml();
|
$xml = e107::getXml();
|
||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
$needed = array();
|
$needed = array();
|
||||||
|
$log = e107::getAdminLog();
|
||||||
|
|
||||||
if(!$plugVersions = e107::getConfig('core')->get('plug_installed'))
|
if(!$plugVersions = e107::getConfig('core')->get('plug_installed'))
|
||||||
{
|
{
|
||||||
@@ -195,6 +196,7 @@ class e107plugin
|
|||||||
$mes->addDebug("Plugin Update(s) Required");
|
$mes->addDebug("Plugin Update(s) Required");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$needed[$path] = $data;
|
$needed[$path] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,13 +209,21 @@ class e107plugin
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mes->addDebug("Plugin: <strong>{$path}</strong> requires an update.");
|
// $mes->addDebug("Plugin: <strong>{$path}</strong> requires an update.");
|
||||||
|
|
||||||
|
// $log->flushMessages();
|
||||||
$needed[$path] = $data;
|
$needed[$path] = $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display debug and log to file.
|
||||||
|
foreach($needed as $path=>$tmp)
|
||||||
|
{
|
||||||
|
$log->addDebug("Plugin: <strong>{$path}</strong> requires an update.");
|
||||||
|
}
|
||||||
|
|
||||||
return count($needed) ? $needed : FALSE;
|
return count($needed) ? $needed : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user