Commit eb8c1c04 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Logs erst einmal korrigiert. Eine weitere Anpassung ist notwendig, sobald klar...

Logs erst einmal korrigiert. Eine weitere Anpassung ist notwendig, sobald klar ist welches Format die Alten Logs haben werden.
parent 24819df9
......@@ -45,7 +45,7 @@ class AdminInterface extends Controller
public function count()
{
$logToday = date("Y-m-d", mktime(date("H"),date("i"), date("s"), date("m"), date("d"), date("Y"))) . "_mg3.log";
$logToday = "mg3.log";
if(file_exists("/var/log/metager/".$logToday))
{
$logToday = file("/var/log/metager/".$logToday);
......@@ -80,40 +80,52 @@ class AdminInterface extends Controller
$size = 0;
$count = 0;
for($i = 1; $i <= 7; $i++)
{
if( isset($oldLogs[$i]) )
{
$count += $oldLogs[$i]['insgesamt'];
$size++;
}
}
$median[7] = ($count/$size);
# Median für 14 Tage:
$size = 0;
$count = 0;
for($i = 1; $i <= 14; $i++)
{
if( isset($oldLogs[$i]) )
{
$count += $oldLogs[$i]['insgesamt'];
$size++;
}
}
$median[14] = ($count/$size);
# Median für 21 Tage:
$size = 0;
$count = 0;
for($i = 1; $i <= 21; $i++)
{
if( isset($oldLogs[$i]) )
{
$count += $oldLogs[$i]['insgesamt'];
$size++;
}
}
$median[21] = ($count/$size);
# Median für 28 Tage:
$size = 0;
$count = 0;
for($i = 1; $i <= 28; $i++)
{
if( isset($oldLogs[$i]) )
{
$count += $oldLogs[$i]['insgesamt'];
$size++;
}
}
$median[28] = ($count/$size);
return view('admin.count')
->with('title', 'Suchanfragen - MetaGer')
......@@ -127,7 +139,7 @@ class AdminInterface extends Controller
public function check ()
{
$q = "";
$logFile = "/var/log/metager/" . date("Y-m-d", mktime(date("H"),date("i"), date("s"), date("m"), date("d"), date("Y"))) . "_mg3.log";
$logFile = "/var/log/metager/mg3.log";
if( file_exists($logFile) )
{
$q = exec("tail -n 1 $logFile");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment