1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Bug #3457 possible fix

This commit is contained in:
e107steved
2006-12-23 18:17:37 +00:00
parent 44c3fab2cc
commit 602d353290

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/log/consolidate.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/log/consolidate.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2006-12-19 21:48:37 $ | $Date: 2006-12-23 18:17:37 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -30,10 +30,13 @@ $pfile = "logp_".$date.".php"; // Today's log file
$ifileprev = "logi_".$yesterday.".php"; $ifileprev = "logi_".$yesterday.".php";
$ifile = "logi_".$date.".php"; $ifile = "logi_".$date.".php";
if(file_exists($pathtologs.$pfile)) { if(file_exists($pathtologs.$pfile))
{
/* log file is up to date, no consolidation required */ /* log file is up to date, no consolidation required */
return; return;
}else if(!file_exists($pathtologs.$pfileprev)) { }
else if(!file_exists($pathtologs.$pfileprev))
{
/* no logfile found at all - create - this will only ever happen once ... */ /* no logfile found at all - create - this will only ever happen once ... */
createLog("blank"); createLog("blank");
return FALSE; return FALSE;
@@ -208,14 +211,16 @@ if(!unlink($pathtologs.$ifileprev))
fclose($handle); fclose($handle);
} }
/* and finally, we need to create a new logfiles for today ... */ /* and finally, we need to create new logfiles for today ... */
createLog(); createLog();
/* done! */ /* done! */
function createLog($mode="default") { function createLog($mode="default")
{
global $pathtologs, $statTotal, $statUnique, $pageArray, $pfile, $ifile; global $pathtologs, $statTotal, $statUnique, $pageArray, $pfile, $ifile;
if(!is_writable($pathtologs)) { if(!is_writable($pathtologs))
{
echo "Log directory is not writable - please CHMOD ".e_PLUGIN."log/logs to 777"; echo "Log directory is not writable - please CHMOD ".e_PLUGIN."log/logs to 777";
return FALSE; return FALSE;
} }
@@ -234,7 +239,8 @@ function createLog($mode="default") {
$varStart."osInfo = array();\n". $varStart."osInfo = array();\n".
$varStart."pageInfo = array(\n"; $varStart."pageInfo = array(\n";
if($mode == "default") { if($mode == "default")
{
reset($pageArray); reset($pageArray);
$loop = FALSE; $loop = FALSE;
foreach($pageArray as $key => $info) { foreach($pageArray as $key => $info) {
@@ -270,13 +276,30 @@ function createLog($mode="default") {
// return FALSE; // return FALSE;
} }
if ($handle = fopen($pathtologs.$pfile, 'w')) { if ($handle = fopen($pathtologs.$pfile, 'w'))
{
fwrite($handle, $data); fwrite($handle, $data);
} }
fclose($handle); fclose($handle);
if ($handle = fopen($pathtologs.$ifile, 'w')) {
fwrite($handle, ""); $data = "<?php
/* e107 website system: Log info file: ".date("z:Y", time())." */
";
$data .= '$domainInfo'." = array();\n\n";
$data .= '$screenInfo'." = array();\n\n";
$data .= '$browserInfo'." = array();\n\n";
$data .= '$osInfo'." = array();\n\n";
$data .= '$refInfo'." = array();\n\n";
$data .= '$searchInfo'." = array();\n\n";
$data .= '$visitInfo'." = array();\n\n";
$data .= "?>";
if ($handle = fopen($pathtologs.$ifile, 'w'))
{
fwrite($handle, $data);
} }
fclose($handle); fclose($handle);
return; return;