Joywork/import/ImportReport.php

41 lines
925 B
PHP
Raw Permalink Normal View History

2026-05-22 20:21:54 +02:00
<?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;
}
}