diff options
Diffstat (limited to 'plugins/CustomPiwikJs/TrackerUpdater.php')
-rw-r--r-- | plugins/CustomPiwikJs/TrackerUpdater.php | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/plugins/CustomPiwikJs/TrackerUpdater.php b/plugins/CustomPiwikJs/TrackerUpdater.php index 6370287882..d90d8c166d 100644 --- a/plugins/CustomPiwikJs/TrackerUpdater.php +++ b/plugins/CustomPiwikJs/TrackerUpdater.php @@ -62,16 +62,28 @@ class TrackerUpdater $this->toFile->checkWritable(); } + public function getCurrentTrackerFileContent() + { + return $this->toFile->getContent(); + } + + public function getUpdatedTrackerFileContent() + { + $trackingCode = new PiwikJsManipulator($this->fromFile->getContent(), $this->trackerFiles); + $newContent = $trackingCode->manipulateContent(); + + return $newContent; + } + public function update() { if (!$this->toFile->hasWriteAccess() || !$this->fromFile->hasReadAccess()) { return; } - $trackingCode = new PiwikJsManipulator($this->fromFile->getContent(), $this->trackerFiles); - $newContent = $trackingCode->manipulateContent(); + $newContent = $this->getUpdatedTrackerFileContent(); - if ($newContent !== $this->toFile->getContent()) { + if ($newContent !== $this->getCurrentTrackerFileContent()) { $this->toFile->save($newContent); } } |