|
|
@ -45,11 +45,11 @@ class LogTarget extends Target |
|
|
|
if (!is_dir($path)) { |
|
|
|
if (!is_dir($path)) { |
|
|
|
mkdir($path); |
|
|
|
mkdir($path); |
|
|
|
} |
|
|
|
} |
|
|
|
$indexFile = "$path/index.json"; |
|
|
|
$indexFile = "$path/index.php"; |
|
|
|
if (!is_file($indexFile)) { |
|
|
|
if (!is_file($indexFile)) { |
|
|
|
$manifest = array(); |
|
|
|
$manifest = array(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$manifest = json_decode(file_get_contents($indexFile), true); |
|
|
|
$manifest = unserialize(file_get_contents($indexFile)); |
|
|
|
} |
|
|
|
} |
|
|
|
$request = Yii::$app->getRequest(); |
|
|
|
$request = Yii::$app->getRequest(); |
|
|
|
$manifest[$this->tag] = $summary = array( |
|
|
|
$manifest[$this->tag] = $summary = array( |
|
|
@ -62,14 +62,14 @@ class LogTarget extends Target |
|
|
|
); |
|
|
|
); |
|
|
|
$this->gc($manifest); |
|
|
|
$this->gc($manifest); |
|
|
|
|
|
|
|
|
|
|
|
$dataFile = "$path/{$this->tag}.json"; |
|
|
|
$dataFile = "$path/{$this->tag}.php"; |
|
|
|
$data = array(); |
|
|
|
$data = array(); |
|
|
|
foreach ($this->module->panels as $id => $panel) { |
|
|
|
foreach ($this->module->panels as $id => $panel) { |
|
|
|
$data[$id] = $panel->save(); |
|
|
|
$data[$id] = $panel->save(); |
|
|
|
} |
|
|
|
} |
|
|
|
$data['summary'] = $summary; |
|
|
|
$data['summary'] = $summary; |
|
|
|
file_put_contents($dataFile, json_encode($data)); |
|
|
|
file_put_contents($dataFile, serialize($data)); |
|
|
|
file_put_contents($indexFile, json_encode($manifest)); |
|
|
|
file_put_contents($indexFile, serialize($manifest)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -93,7 +93,7 @@ class LogTarget extends Target |
|
|
|
if (count($manifest) > $this->module->historySize + 10) { |
|
|
|
if (count($manifest) > $this->module->historySize + 10) { |
|
|
|
$n = count($manifest) - $this->module->historySize; |
|
|
|
$n = count($manifest) - $this->module->historySize; |
|
|
|
foreach (array_keys($manifest) as $tag) { |
|
|
|
foreach (array_keys($manifest) as $tag) { |
|
|
|
$file = $this->module->dataPath . "/$tag.json"; |
|
|
|
$file = $this->module->dataPath . "/$tag.php"; |
|
|
|
@unlink($file); |
|
|
|
@unlink($file); |
|
|
|
unset($manifest[$tag]); |
|
|
|
unset($manifest[$tag]); |
|
|
|
if (--$n <= 0) { |
|
|
|
if (--$n <= 0) { |
|
|
|