From 6f76e28ee746ac2ea898e1c5ed07a8ad4ded0a9f Mon Sep 17 00:00:00 2001 From: Martin Keckeis Date: Fri, 25 Jul 2014 14:14:59 +0200 Subject: [PATCH] Uninstall --- IntranetGeoIP.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/IntranetGeoIP.php b/IntranetGeoIP.php index f71b3d7..c5139f9 100644 --- a/IntranetGeoIP.php +++ b/IntranetGeoIP.php @@ -44,9 +44,22 @@ public function getListHooksRegistered() /** * + * @see \Piwik\Plugin::install() + */ + public function install() + { + return $this->copyDataFile(); + } + + /** * @see \Piwik\Plugin::activate() */ public function activate() + { + return $this->copyDataFile(); + } + + private function copyDataFile() { if (! file_exists($this->getDataFilePath()) && file_exists($this->getDataExampleFilePath())) { copy($this->getDataExampleFilePath(), $this->getDataFilePath()); @@ -60,6 +73,17 @@ public function activate() return; } + /** + * + * @see \Piwik\Plugin::uninstall() + */ + public function uninstall() + { + if (file_exists($this->getDataFilePath())) { + unlink($this->getDataFilePath()); + } + } + /** * Called by event `Tracker.newVisitorInformation` *