diff --git a/lib/AtomFeed.php b/lib/AtomFeed.php index 7ffa97f6..fc26c0d0 100644 --- a/lib/AtomFeed.php +++ b/lib/AtomFeed.php @@ -1,4 +1,5 @@ XmlString; } + public function SaveIfChanged(): void{ + // Did we actually update the feed? If so, write to file and update the index + if($this->HasChanged($this->Path)){ + // Files don't match, save the file + $this->Updated = new DateTime(); + $this->Save(); + } + } + protected function HasChanged(string $path): bool{ if(!is_file($path)){ return true; diff --git a/lib/Feed.php b/lib/Feed.php index 26613ec8..06fd0d30 100644 --- a/lib/Feed.php +++ b/lib/Feed.php @@ -40,15 +40,6 @@ class Feed{ return ''; } - public function SaveIfChanged(): void{ - // Did we actually update the feed? If so, write to file and update the index - if($this->HasChanged($this->Path)){ - // Files don't match, save the file - $this->Updated = new DateTime(); - $this->Save(); - } - } - public function Save(): void{ $feed = $this->GetXmlString(); diff --git a/lib/RssFeed.php b/lib/RssFeed.php index 5855e947..db2df941 100644 --- a/lib/RssFeed.php +++ b/lib/RssFeed.php @@ -23,6 +23,14 @@ class RssFeed extends Feed{ return $this->XmlString; } + public function SaveIfChanged(): void{ + // Did we actually update the feed? If so, write to file and update the index + if($this->HasChanged($this->Path)){ + // Files don't match, save the file + $this->Save(); + } + } + protected function HasChanged(string $path): bool{ // RSS doesn't have information about when an item was updated, // only when it was first published. So, we approximate on whether the feed