Fix broken updated timestamps in OPDS feeds, and fix and add some type hints.

This commit is contained in:
Alex Cabal 2024-11-08 12:43:47 -06:00
parent 34e35194d8
commit 06b82cdaaa
15 changed files with 344 additions and 300 deletions

View file

@ -1,11 +1,13 @@
<?
use Safe\DateTimeImmutable;
use function Safe\exec;
use function Safe\file_get_contents;
use function Safe\file_put_contents;
use function Safe\tempnam;
use function Safe\unlink;
class Feed{
abstract class Feed{
public string $Url;
public string $Title;
/** @var array<Ebook|OpdsNavigationEntry> $Entries */
@ -13,6 +15,7 @@ class Feed{
public string $Path;
public ?string $Stylesheet = null;
protected ?string $XmlString = null;
public ?DateTimeImmutable $Updated = null;
/**
* @param string $title
@ -32,6 +35,8 @@ class Feed{
// METHODS
// *******
abstract public function SaveIfChanged(): bool;
protected function CleanXmlString(string $xmlString): string{
$tempFilename = tempnam('/tmp/', 'se-');
file_put_contents($tempFilename, $xmlString);