1
0
Files
www.mikescher.com/www/internals/modules/ebookhistory.php
Mike Schwörer 925960eb39
Some checks failed
Build Docker and Deploy / Build Docker (push) Failing after 37s
Build Docker and Deploy / Deploy to Server (push) Has been skipped
add reading history to /about
2026-02-07 22:37:18 +01:00

36 lines
839 B
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
{
$fn = $this->dir().'/snippet.html';
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 get(): string
{
$fn = $this->dir().'/snippet.html';
if (!file_exists($fn)) return '';
return file_get_contents($fn);
}
}