Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbenakamoorthi <benaka@piwik.org>2013-02-01 09:24:58 +0400
committerbenakamoorthi <benaka@piwik.org>2013-02-01 09:24:58 +0400
commit7aa7595ba5e3608d38292db7f2e03b5549494f24 (patch)
tree0614342a666baffa8f3c71e4dc9e14fe7df9eb8d /plugins/UserCountry
parentd627a2540fb58f0359c223173da3279b2f12a4c1 (diff)
Refs #3680, added message w/ last time auto updater was run to GeoIP settings page.
git-svn-id: http://dev.piwik.org/svn/trunk@7832 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r--plugins/UserCountry/Controller.php6
-rwxr-xr-xplugins/UserCountry/GeoIPAutoUpdater.php15
-rwxr-xr-xplugins/UserCountry/templates/updaterSetup.tpl9
3 files changed, 29 insertions, 1 deletions
diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php
index 38fc6e94ff..cef3a3051a 100644
--- a/plugins/UserCountry/Controller.php
+++ b/plugins/UserCountry/Controller.php
@@ -162,6 +162,12 @@ class Piwik_UserCountry_Controller extends Piwik_Controller_Admin
$view->geoIPUpdatePeriod = Piwik_UserCountry_GeoIPAutoUpdater::getSchedulePeriod();
$view->geoLiteUrl = Piwik_UserCountry_LocationProvider_GeoIp::GEO_LITE_URL;
+
+ $lastRunTime = Piwik_UserCountry_GeoIPAutoUpdater::getLastRunTime();
+ if ($lastRunTime !== false)
+ {
+ $view->lastTimeUpdaterRun = '<strong><em>'.$lastRunTime->toString().'</em></strong>';
+ }
}
/**
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);
+ }
}
diff --git a/plugins/UserCountry/templates/updaterSetup.tpl b/plugins/UserCountry/templates/updaterSetup.tpl
index 4cb2342af4..11d498a9b5 100755
--- a/plugins/UserCountry/templates/updaterSetup.tpl
+++ b/plugins/UserCountry/templates/updaterSetup.tpl
@@ -38,7 +38,14 @@
<input type="radio" name="geoip-update-period" value="week" id="geoip-update-period-week" {if $geoIPUpdatePeriod eq 'week'}checked="checked"{/if}/>
<label for="geoip-update-period-week">{'CoreHome_PeriodWeek'|translate}</label>
</td>
- <td width="164">&nbsp;</td>
+ <td width="164">
+ {if !empty($lastTimeUpdaterRun)}
+ {capture assign=lastTimeRunNote}
+ {'UserCountry_UpdaterWasLastRun'|translate:$lastTimeUpdaterRun}
+ {/capture}
+ {$lastTimeRunNote|inlineHelp}
+ {/if}
+ </td>
</tr>
</table>
<p style="display:inline-block;vertical-align:top">