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` *