41 lines
925 B
PHP
41 lines
925 B
PHP
<?php
|
|
|
|
abstract class ImportReport
|
|
{
|
|
private static function getPath()
|
|
{
|
|
return $_SERVER['DOCUMENT_ROOT'] . '/import/reports/';
|
|
}
|
|
|
|
public static function getList()
|
|
{
|
|
$list = [];
|
|
$files = glob(self::getPath() . '*', GLOB_MARK);
|
|
foreach ($files as $file) {
|
|
if (stripos(basename($file), ".log") !== false) {
|
|
$basename = basename($file);
|
|
$ts = intval($basename);
|
|
$list[$ts] = $basename;
|
|
}
|
|
}
|
|
ksort($list);
|
|
|
|
return $list;
|
|
}
|
|
|
|
public static function getContent($name)
|
|
{
|
|
$name = basename($name);
|
|
if (!in_array($name, self::getList())) {
|
|
return '';
|
|
}
|
|
|
|
$file = self::getPath() . $name;
|
|
if (!file_exists($file)) {
|
|
return '';
|
|
}
|
|
|
|
$content = file_get_contents($file);
|
|
return $content;
|
|
}
|
|
} |