diff options
author | diosmosis <benaka@piwik.pro> | 2015-09-25 11:24:05 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-09-25 11:24:05 +0300 |
commit | ee7e1374fb8a5f833dae2326031657544ed86109 (patch) | |
tree | e44b0f622dff93d545d40cc4741b8989b7a5af6a /plugins/SitesManager/Tracker | |
parent | dae25c25e2eb16bd61d6ebe662dfbf88903a994a (diff) |
Cover case in SitesManagerRequestProcess where ts_created is not found in tracker cache more explicitly. Make sure the site created time is not modified in this case.
Diffstat (limited to 'plugins/SitesManager/Tracker')
-rw-r--r-- | plugins/SitesManager/Tracker/SitesManagerRequestProcessor.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/SitesManager/Tracker/SitesManagerRequestProcessor.php b/plugins/SitesManager/Tracker/SitesManagerRequestProcessor.php index cb2b3f7f9d..8e88b6f5bd 100644 --- a/plugins/SitesManager/Tracker/SitesManagerRequestProcessor.php +++ b/plugins/SitesManager/Tracker/SitesManagerRequestProcessor.php @@ -42,6 +42,10 @@ class SitesManagerRequestProcessor extends RequestProcessor $idSite = $request->getIdSite(); $createdTimeTimestamp = $this->getSiteCreatedTime($idSite); + if (empty($createdTimeTimestamp)) { + return; + } + $requestTimestamp = Date::factory((int) $request->getCurrentTimestamp()); // replicating old Piwik logic, see: @@ -60,8 +64,11 @@ class SitesManagerRequestProcessor extends RequestProcessor private function getSiteCreatedTime($idSite) { $attributes = Cache::getCacheWebsiteAttributes($idSite); - $tsCreated = isset($attributes['ts_created']) ? $attributes['ts_created'] : 0; - return Date::factory($tsCreated); + if (!isset($attributes['ts_created'])) { + return null; + } + + return Date::factory($attributes['ts_created']); } private function updateSiteCreatedTime($idSite, Date $timestamp) |