diff options
Diffstat (limited to 'plugins/UserCountry/GeoIPAutoUpdater.php')
-rwxr-xr-x | plugins/UserCountry/GeoIPAutoUpdater.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/UserCountry/GeoIPAutoUpdater.php b/plugins/UserCountry/GeoIPAutoUpdater.php index 3d2ebc53c4..2bfbbde0e2 100755 --- a/plugins/UserCountry/GeoIPAutoUpdater.php +++ b/plugins/UserCountry/GeoIPAutoUpdater.php @@ -24,6 +24,8 @@ class Piwik_UserCountry_GeoIPAutoUpdater const ISP_URL_OPTION_NAME = 'geoip.isp_db_url'; const ORG_URL_OPTION_NAME = 'geoip.org_db_url'; + const LAST_RUN_TIME_OPTION_NAME = 'geoip.updater_last_run_time'; + private static $urlOptions = array( 'loc' => self::LOC_URL_OPTION_NAME, 'isp' => self::ISP_URL_OPTION_NAME, @@ -46,6 +48,8 @@ class Piwik_UserCountry_GeoIPAutoUpdater { try { + Piwik_SetOption(self::LAST_RUN_TIME_OPTION_NAME, Piwik_Date::factory('today')->getTimestamp()); + $locUrl = Piwik_GetOption(self::LOC_URL_OPTION_NAME); if (!empty($locUrl)) { @@ -494,4 +498,15 @@ class Piwik_UserCountry_GeoIPAutoUpdater { self::$unzipPhpError = array($errno, $errstr, $errfile, $errline); } + + /** + * Returns the time the auto updater was last run. + * + * @return Piwik_Date|false + */ + public static function getLastRunTime() + { + $timestamp = Piwik_GetOption(self::LAST_RUN_TIME_OPTION_NAME); + return $timestamp === false ? false : Piwik_Date::factory((int)$timestamp); + } } |