1
0
Files
www.mikescher.com/www/internals/modules/ebookhistory.php
T
Mikescher 8e0039f6bd
Build Docker and Deploy / Build Docker (push) Successful in 2m10s
Build Docker and Deploy / Deploy to Server (push) Successful in 18s
Add book Tier-List
2026-04-15 17:15:54 +02:00

49 lines
1.1 KiB
PHP

<?php
class EbookHistory implements IWebsiteModule
{
/** @var Website */
private $site;
public function __construct(Website $site)
{
$this->site = $site;
}
public function dir(): string
{
return __DIR__ . '/../../dynamic/ehr/';
}
public function checkConsistency(): array
{
$fns = [
$this->dir().'/snippet_hist.html',
$this->dir().'/snippet_tier.html'
];
foreach ($fns as $fn) {
if (!file_exists($fn)) return ['result'=>'err', 'message' => 'File not found: ' . $fn];
if (filemtime($fn) < time()-(10*24*60*60)) return ['result'=>'warn', 'message' => 'Rendered data is older than 10 days'];
}
return ['result' => 'ok', 'message' => ''];
}
public function getHistory(): string
{
$fn = $this->dir().'/snippet_hist.html';
if (!file_exists($fn)) return '';
return file_get_contents($fn);
}
public function getTierlist(): string
{
$fn = $this->dir().'/snippet_tier.html';
if (!file_exists($fn)) return '';
return file_get_contents($fn);
}
}