aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-07-25 16:54:43 +0200
committerGitHub <noreply@github.com>2017-07-25 16:54:43 +0200
commit839edf32cc08f525ef51e5a49a1764bcdfc2c461 (patch)
treeebc4185fa25ceb3a0e7294bc5e5820d87ce14563 /src
parent35c1f1376c995c6cb5292a0f03c48641e50bd185 (diff)
parentff9f89fd2318cfb29a18d941077b5afc859bf0fe (diff)
downloadwallabag-839edf32cc08f525ef51e5a49a1764bcdfc2c461.tar.gz
wallabag-839edf32cc08f525ef51e5a49a1764bcdfc2c461.tar.zst
wallabag-839edf32cc08f525ef51e5a49a1764bcdfc2c461.zip
Merge pull request #3280 from Simounet/fix/2.3-date
Fix updatePublishedAt on already parsed article's date
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index 656ac6ee..1ac7ad83 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -126,11 +126,17 @@ class ContentProxy
126 126
127 // is it a timestamp? 127 // is it a timestamp?
128 if (filter_var($date, FILTER_VALIDATE_INT) !== false) { 128 if (filter_var($date, FILTER_VALIDATE_INT) !== false) {
129 $date = '@' . $value; 129 $date = '@' . $date;
130 } 130 }
131 131
132 try { 132 try {
133 $entry->setPublishedAt(new \DateTime($date)); 133 // is it already a DateTime?
134 // (it's inside the try/catch in case of fail to be parse time string)
135 if (!$date instanceof \DateTime) {
136 $date = new \DateTime($date);
137 }
138
139 $entry->setPublishedAt($date);
134 } catch (\Exception $e) { 140 } catch (\Exception $e) {
135 $this->logger->warning('Error while defining date', ['e' => $e, 'url' => $entry->getUrl(), 'date' => $value]); 141 $this->logger->warning('Error while defining date', ['e' => $e, 'url' => $entry->getUrl(), 'date' => $value]);
136 } 142 }