Fix warning because of missing log directory.
This commit is contained in:
@@ -382,10 +382,16 @@ class database extends database_base {
|
|||||||
if ( substr($sQuery,0, 4) == 'DESC' ) $found = true;
|
if ( substr($sQuery,0, 4) == 'DESC' ) $found = true;
|
||||||
if ( substr($sQuery,0, 4) == 'USE ' ) $found = true;
|
if ( substr($sQuery,0, 4) == 'USE ' ) $found = true;
|
||||||
if ( ! $found ) {
|
if ( ! $found ) {
|
||||||
$logFile = PATH_DATA . 'log' . PATH_SEP . 'query.log';
|
$logDir = PATH_DATA . 'log';
|
||||||
$fp = fopen ( $logFile, 'a+' );
|
if (!file_exists($logDir))
|
||||||
fwrite ( $fp, date("Y-m-d H:i:s") . " " . $this->sDataBase . " " . $sQuery . "\n" );
|
if (!mkdir($logDir))
|
||||||
fclose ( $fp );
|
return;
|
||||||
|
$logFile = "$logDir/query.log";
|
||||||
|
$fp = fopen ( $logFile, 'a+' );
|
||||||
|
if ($fp !== false) {
|
||||||
|
fwrite ( $fp, date("Y-m-d H:i:s") . " " . $this->sDataBase . " " . $sQuery . "\n" );
|
||||||
|
fclose ( $fp );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception $oException) {
|
catch (Exception $oException) {
|
||||||
|
|||||||
@@ -42,10 +42,16 @@ class languages {
|
|||||||
*/
|
*/
|
||||||
function log ( $text )
|
function log ( $text )
|
||||||
{
|
{
|
||||||
$logFile = PATH_DATA . 'log' . PATH_SEP . 'query.log';
|
$logDir = PATH_DATA . 'log';
|
||||||
|
if (!file_exists($logDir))
|
||||||
|
if (!mkdir($logDir))
|
||||||
|
return;
|
||||||
|
$logFile = "$logDir/query.log";
|
||||||
$fp = fopen ( $logFile, 'a+' );
|
$fp = fopen ( $logFile, 'a+' );
|
||||||
fwrite ( $fp, date("Y-m-d H:i:s") . " " . $text . "\n" );
|
if ($fp !== false) {
|
||||||
fclose ( $fp );
|
fwrite ( $fp, date("Y-m-d H:i:s") . " " . $text . "\n" );
|
||||||
|
fclose ( $fp );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user