mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 07:40:39 -04:00
Fix broken updated timestamps in OPDS feeds, and fix and add some type hints.
This commit is contained in:
parent
34e35194d8
commit
06b82cdaaa
15 changed files with 344 additions and 300 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue