set order to desc for logs viewer
This commit is contained in:
parent
db313f5eef
commit
976e10659f
4 changed files with 21 additions and 3 deletions
12
.idea/misc.xml
generated
12
.idea/misc.xml
generated
|
|
@ -4,8 +4,16 @@
|
|||
<option name="openedFilesInfos">
|
||||
<list>
|
||||
<OpenedFileInfo>
|
||||
<option name="caretOffset" value="163" />
|
||||
<option name="fileUrl" value="file://$PROJECT_DIR$/templates/partials/menu.php" />
|
||||
<option name="caretOffset" value="166" />
|
||||
<option name="fileUrl" value="file://$PROJECT_DIR$/app/Auth.php" />
|
||||
</OpenedFileInfo>
|
||||
<OpenedFileInfo>
|
||||
<option name="caretOffset" value="1004" />
|
||||
<option name="fileUrl" value="file://$PROJECT_DIR$/app/App.php" />
|
||||
</OpenedFileInfo>
|
||||
<OpenedFileInfo>
|
||||
<option name="caretOffset" value="0" />
|
||||
<option name="fileUrl" value="file://$PROJECT_DIR$/templates/template.php" />
|
||||
</OpenedFileInfo>
|
||||
</list>
|
||||
</option>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ namespace MingTsay\Akanyan;
|
|||
|
||||
abstract class FileViewer
|
||||
{
|
||||
protected static bool $orderDesc = false;
|
||||
|
||||
protected abstract static function directory(): string;
|
||||
|
||||
protected abstract static function whitelist(): ?array;
|
||||
|
|
@ -13,10 +15,13 @@ abstract class FileViewer
|
|||
$directory = static::directory();
|
||||
$whitelist = static::whitelist();
|
||||
|
||||
return array_values(array_filter(
|
||||
$list = array_values(array_filter(
|
||||
scandir($directory),
|
||||
fn($file) => ($whitelist === null || in_array($file, $whitelist)) && is_file("$directory/$file")
|
||||
));
|
||||
|
||||
if (static::$orderDesc) rsort($list);
|
||||
return $list;
|
||||
}
|
||||
|
||||
public static function read($file): ?string
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace MingTsay\Akanyan;
|
|||
|
||||
class LogsViewer extends FileViewer
|
||||
{
|
||||
protected static bool $orderDesc = true;
|
||||
|
||||
protected static function directory(): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@
|
|||
<div class="card-body">
|
||||
<p class="fs-5">【更新紀錄】</p>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<p>檢視日誌時最新的檔案將出現於最前面。</p>
|
||||
<p>更新日期:2022/10/20 20:48:00</p>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<p>首頁現在可以看到伺服器版本與線上人數等資訊了。</p>
|
||||
<p>更新日期:2022/07/05 02:02:02</p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue