diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-10-09 07:17:28 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-10-09 07:17:28 +0400 |
commit | 6d46df58dd4b16a5c8402e34ed018439cbbadee1 (patch) | |
tree | efaeabfe94ab8a601a96c80e1333ae83513f803e /plugins | |
parent | 9fb5490490913717ccfacec6f597181091be214f (diff) |
Refs #4202 removing functions Piwik_GetOption and SetOption. Now use: Option::get and Option::set and Option::delete
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/Annotations/AnnotationList.php | 5 | ||||
-rw-r--r-- | plugins/CoreAdminHome/API.php | 5 | ||||
-rw-r--r-- | plugins/CoreUpdater/Controller.php | 3 | ||||
-rw-r--r-- | plugins/DBStats/DBStats.php | 5 | ||||
-rwxr-xr-x | plugins/DBStats/MySQLMetadataProvider.php | 5 | ||||
-rw-r--r-- | plugins/Login/Login.php | 6 | ||||
-rw-r--r-- | plugins/MobileMessaging/API.php | 9 | ||||
-rw-r--r-- | plugins/MobileMessaging/MobileMessaging.php | 5 | ||||
-rw-r--r-- | plugins/PrivacyManager/Controller.php | 3 | ||||
-rw-r--r-- | plugins/PrivacyManager/PrivacyManager.php | 17 | ||||
-rw-r--r-- | plugins/SitesManager/API.php | 37 | ||||
-rwxr-xr-x | plugins/UserCountry/GeoIPAutoUpdater.php | 27 | ||||
-rwxr-xr-x | plugins/UserCountry/LocationProvider.php | 5 | ||||
-rw-r--r-- | plugins/UsersManager/API.php | 5 | ||||
-rw-r--r-- | plugins/UsersManager/UsersManager.php | 2 |
15 files changed, 76 insertions, 63 deletions
diff --git a/plugins/Annotations/AnnotationList.php b/plugins/Annotations/AnnotationList.php index 9f114608e6..deca05a557 100755 --- a/plugins/Annotations/AnnotationList.php +++ b/plugins/Annotations/AnnotationList.php @@ -12,6 +12,7 @@ namespace Piwik\Plugins\Annotations; use Exception; use Piwik\Date; +use Piwik\Option; use Piwik\Piwik; use Piwik\Site; @@ -107,7 +108,7 @@ class AnnotationList $this->checkIdSiteIsLoaded($idSite); $optionName = self::getAnnotationCollectionOptionName($idSite); - Piwik_SetOption($optionName, serialize($this->annotations[$idSite])); + Option::set($optionName, serialize($this->annotations[$idSite])); } /** @@ -312,7 +313,7 @@ class AnnotationList $result = array(); foreach ($this->idSites as $id) { $optionName = self::getAnnotationCollectionOptionName($id); - $serialized = Piwik_GetOption($optionName); + $serialized = Option::get($optionName); if ($serialized !== false) { $result[$id] = unserialize($serialized); diff --git a/plugins/CoreAdminHome/API.php b/plugins/CoreAdminHome/API.php index 8c52b97b09..909a178738 100644 --- a/plugins/CoreAdminHome/API.php +++ b/plugins/CoreAdminHome/API.php @@ -16,6 +16,7 @@ use Piwik\Config; use Piwik\DataAccess\ArchiveTableCreator; use Piwik\Date; use Piwik\Db; +use Piwik\Option; use Piwik\Period; use Piwik\Period\Week; use Piwik\Piwik; @@ -195,7 +196,7 @@ class API $invalidatedIdSites = array_merge($invalidatedIdSites, $idSites); $invalidatedIdSites = array_unique($invalidatedIdSites); $invalidatedIdSites = array_values($invalidatedIdSites); - Piwik_SetOption(self::OPTION_INVALIDATED_IDSITES, serialize($invalidatedIdSites)); + Option::set(self::OPTION_INVALIDATED_IDSITES, serialize($invalidatedIdSites)); Site::clearCache(); @@ -221,7 +222,7 @@ class API static public function getWebsiteIdsToInvalidate() { Piwik::checkUserHasSomeAdminAccess(); - $invalidatedIdSites = Piwik_GetOption(self::OPTION_INVALIDATED_IDSITES); + $invalidatedIdSites = Option::get(self::OPTION_INVALIDATED_IDSITES); if ($invalidatedIdSites && ($invalidatedIdSites = unserialize($invalidatedIdSites)) && count($invalidatedIdSites) diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index 59b6645af0..d2474acf68 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -19,6 +19,7 @@ use Piwik\DbHelper; use Piwik\Filechecks; use Piwik\Filesystem; use Piwik\Http; +use Piwik\Option; use Piwik\Piwik; use Piwik\Plugins\LanguagesManager\LanguagesManager; use Piwik\SettingsPiwik; @@ -311,7 +312,7 @@ class Controller extends \Piwik\Controller } else { $this->errorMessages = array(); try { - $currentVersion = Piwik_GetOption('version_core'); + $currentVersion = Option::get('version_core'); } catch (Exception $e) { $currentVersion = '<= 0.2.9'; } diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index 7a042565b6..8a9915051b 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -13,6 +13,7 @@ namespace Piwik\Plugins\DBStats; use Piwik\Common; use Piwik\Date; +use Piwik\Option; use Piwik\Piwik; use Piwik\ScheduledTask; use Piwik\ScheduledTime\Weekly; @@ -72,7 +73,7 @@ class DBStats extends \Piwik\Plugin $api->getIndividualMetricsSummary(true); $now = Date::now()->getLocalized("%longYear%, %shortMonth% %day%"); - Piwik_SetOption(self::TIME_OF_LAST_TASK_RUN_OPTION, $now); + Option::set(self::TIME_OF_LAST_TASK_RUN_OPTION, $now); } public function getStylesheetFiles(&$stylesheets) @@ -83,7 +84,7 @@ class DBStats extends \Piwik\Plugin /** Returns the date when the cacheDataByArchiveNameReports was last run. */ public static function getDateOfLastCachingRun() { - return Piwik_GetOption(self::TIME_OF_LAST_TASK_RUN_OPTION); + return Option::get(self::TIME_OF_LAST_TASK_RUN_OPTION); } public function getReportDisplayProperties(&$properties) diff --git a/plugins/DBStats/MySQLMetadataProvider.php b/plugins/DBStats/MySQLMetadataProvider.php index 3a9dc5ed1d..fe7d722fd4 100755 --- a/plugins/DBStats/MySQLMetadataProvider.php +++ b/plugins/DBStats/MySQLMetadataProvider.php @@ -16,6 +16,7 @@ use Piwik\Config; use Piwik\DataTable; use Piwik\Db; use Piwik\DbHelper; +use Piwik\Option; /** * Utility class that provides general information about databases, including the size of @@ -227,7 +228,7 @@ class MySQLMetadataProvider $dataTableOptionName = $this->getCachedOptionName($status['Name'], 'byArchiveName'); // if option exists && !$forceCache, use the cached data, otherwise create the - $cachedData = Piwik_GetOption($dataTableOptionName); + $cachedData = Option::get($dataTableOptionName); if ($cachedData !== false && !$forceCache) { $table = new DataTable(); $table->addRowsFromSerializedArray($cachedData); @@ -243,7 +244,7 @@ class MySQLMetadataProvider $serializedTables = $table->getSerialized(); $serializedTable = reset($serializedTables); - Piwik_SetOption($dataTableOptionName, $serializedTable); + Option::set($dataTableOptionName, $serializedTable); } // add estimated_size column diff --git a/plugins/Login/Login.php b/plugins/Login/Login.php index 5a55e33f5e..fd242c3230 100644 --- a/plugins/Login/Login.php +++ b/plugins/Login/Login.php @@ -144,7 +144,7 @@ class Login extends \Piwik\Plugin $optionName = self::getPasswordResetInfoOptionName($login); $optionData = UsersManager::getPasswordHash($password); - Piwik_SetOption($optionName, $optionData); + Option::set($optionName, $optionData); } /** @@ -155,7 +155,7 @@ class Login extends \Piwik\Plugin public static function removePasswordResetInfo($login) { $optionName = self::getPasswordResetInfoOptionName($login); - Option::getInstance()->delete($optionName); + Option::delete($optionName); } /** @@ -167,7 +167,7 @@ class Login extends \Piwik\Plugin public static function getPasswordToResetTo($login) { $optionName = self::getPasswordResetInfoOptionName($login); - return Piwik_GetOption($optionName); + return Option::get($optionName); } /** diff --git a/plugins/MobileMessaging/API.php b/plugins/MobileMessaging/API.php index 538cbee1cc..3b345e94c4 100644 --- a/plugins/MobileMessaging/API.php +++ b/plugins/MobileMessaging/API.php @@ -11,6 +11,7 @@ namespace Piwik\Plugins\MobileMessaging; use Piwik\Common; +use Piwik\Option; use Piwik\Piwik; use Piwik\Plugins\MobileMessaging\SMSProvider; use Piwik\Plugins\ScheduledReports\API as APIScheduledReports; @@ -401,7 +402,7 @@ class API private function setUserSettings($user, $settings) { - Piwik_SetOption( + Option::set( $user . MobileMessaging::USER_SETTINGS_POSTFIX_OPTION, Common::json_encode($settings) ); @@ -425,7 +426,7 @@ class API private function getUserSettings($user) { $optionIndex = $user . MobileMessaging::USER_SETTINGS_POSTFIX_OPTION; - $userSettings = Piwik_GetOption($optionIndex); + $userSettings = Option::get($optionIndex); if (empty($userSettings)) { $userSettings = array(); @@ -454,7 +455,7 @@ class API public function setDelegatedManagement($delegatedManagement) { Piwik::checkUserIsSuperUser(); - Piwik_SetOption(MobileMessaging::DELEGATED_MANAGEMENT_OPTION, $delegatedManagement); + Option::set(MobileMessaging::DELEGATED_MANAGEMENT_OPTION, $delegatedManagement); } /** @@ -465,6 +466,6 @@ class API public function getDelegatedManagement() { Piwik::checkUserHasSomeViewAccess(); - return Piwik_GetOption(MobileMessaging::DELEGATED_MANAGEMENT_OPTION) == 'true'; + return Option::get(MobileMessaging::DELEGATED_MANAGEMENT_OPTION) == 'true'; } } diff --git a/plugins/MobileMessaging/MobileMessaging.php b/plugins/MobileMessaging/MobileMessaging.php index bca9f4a2e9..34017d1956 100644 --- a/plugins/MobileMessaging/MobileMessaging.php +++ b/plugins/MobileMessaging/MobileMessaging.php @@ -10,6 +10,7 @@ */ namespace Piwik\Plugins\MobileMessaging; +use Piwik\Option; use Piwik\Piwik; use Piwik\Plugins\API\API as APIPlugins; use Piwik\Plugins\MobileMessaging\API as APIMobileMessaging; @@ -236,9 +237,9 @@ class MobileMessaging extends \Piwik\Plugin function install() { - $delegatedManagement = Piwik_GetOption(self::DELEGATED_MANAGEMENT_OPTION); + $delegatedManagement = Option::get(self::DELEGATED_MANAGEMENT_OPTION); if (empty($delegatedManagement)) { - Piwik_SetOption(self::DELEGATED_MANAGEMENT_OPTION, self::DELEGATED_MANAGEMENT_OPTION_DEFAULT); + Option::set(self::DELEGATED_MANAGEMENT_OPTION, self::DELEGATED_MANAGEMENT_OPTION_DEFAULT); } } diff --git a/plugins/PrivacyManager/Controller.php b/plugins/PrivacyManager/Controller.php index 1a8debbdc4..3a29c285b4 100644 --- a/plugins/PrivacyManager/Controller.php +++ b/plugins/PrivacyManager/Controller.php @@ -15,6 +15,7 @@ use Piwik\Config; use Piwik\Date; use Piwik\Db; use Piwik\MetricsFormatter; +use Piwik\Option; use Piwik\Piwik; use Piwik\Plugins\DBStats\MySQLMetadataProvider; use Piwik\Plugins\LanguagesManager\LanguagesManager; @@ -245,7 +246,7 @@ class Controller extends \Piwik\Controller\Admin $scheduleTimetable = $taskScheduler->getScheduledTimeForMethod("PrivacyManager", "deleteLogTables"); - $optionTable = Piwik_GetOption(self::OPTION_LAST_DELETE_PIWIK_LOGS); + $optionTable = Option::get(self::OPTION_LAST_DELETE_PIWIK_LOGS); //If task was already rescheduled, read time from taskTimetable. Else, calculate next possible runtime. if (!empty($scheduleTimetable) && ($scheduleTimetable - time() > 0)) { diff --git a/plugins/PrivacyManager/PrivacyManager.php b/plugins/PrivacyManager/PrivacyManager.php index 006afd77cd..7c1880cc3f 100644 --- a/plugins/PrivacyManager/PrivacyManager.php +++ b/plugins/PrivacyManager/PrivacyManager.php @@ -17,6 +17,7 @@ use Piwik\Date; use Piwik\Db; use Piwik\Metrics; +use Piwik\Option; use Piwik\Piwik; use Piwik\Plugins\Goals\Archiver; use Piwik\ScheduledTask; @@ -132,7 +133,7 @@ class PrivacyManager extends \Piwik\Plugin // load the settings for the data purging settings foreach (self::$defaultPurgeDataOptions as $optionName => $defaultValue) { - $value = Piwik_GetOption($optionName); + $value = Option::get($optionName); if ($value !== false) { $settings[$optionName] = $value; } else { @@ -142,7 +143,7 @@ class PrivacyManager extends \Piwik\Plugin } // option is not saved in the DB, so save it now - Piwik_SetOption($optionName, $settings[$optionName]); + Option::set($optionName, $settings[$optionName]); } } @@ -160,7 +161,7 @@ class PrivacyManager extends \Piwik\Plugin foreach (self::$defaultPurgeDataOptions as $optionName => $defaultValue) { if (isset($settings[$optionName])) { - Piwik_SetOption($optionName, $settings[$optionName]); + Option::set($optionName, $settings[$optionName]); } } } @@ -199,7 +200,7 @@ class PrivacyManager extends \Piwik\Plugin } // set last run time - Piwik_SetOption(self::OPTION_LAST_DELETE_PIWIK_REPORTS, Date::factory('today')->getTimestamp()); + Option::set(self::OPTION_LAST_DELETE_PIWIK_REPORTS, Date::factory('today')->getTimestamp()); ReportsPurger::make($settings, self::getAllMetricsToKeep())->purgeData(); } @@ -237,7 +238,7 @@ class PrivacyManager extends \Piwik\Plugin * every time, when the schedule is triggered. */ $lastDeleteDate = Date::factory("today")->getTimestamp(); - Piwik_SetOption(self::OPTION_LAST_DELETE_PIWIK_LOGS, $lastDeleteDate); + Option::set(self::OPTION_LAST_DELETE_PIWIK_LOGS, $lastDeleteDate); // execute the purge LogDataPurger::make($settings)->purgeData(); @@ -370,14 +371,14 @@ class PrivacyManager extends \Piwik\Plugin { // Log deletion may not run until it is once rescheduled (initial run). This is the // only way to guarantee the calculated next scheduled deletion time. - $initialDelete = Piwik_GetOption(self::OPTION_LAST_DELETE_PIWIK_LOGS_INITIAL); + $initialDelete = Option::get(self::OPTION_LAST_DELETE_PIWIK_LOGS_INITIAL); if (empty($initialDelete)) { - Piwik_SetOption(self::OPTION_LAST_DELETE_PIWIK_LOGS_INITIAL, 1); + Option::set(self::OPTION_LAST_DELETE_PIWIK_LOGS_INITIAL, 1); return false; } // Make sure, log purging is allowed to run now - $lastDelete = Piwik_GetOption($lastRanOption); + $lastDelete = Option::get($lastRanOption); $deleteIntervalDays = $settings['delete_logs_schedule_lowest_interval']; $deleteIntervalSeconds = $this->getDeleteIntervalInSeconds($deleteIntervalDays); diff --git a/plugins/SitesManager/API.php b/plugins/SitesManager/API.php index 00ba33b32f..6c6dab9f54 100644 --- a/plugins/SitesManager/API.php +++ b/plugins/SitesManager/API.php @@ -17,6 +17,7 @@ use Piwik\Date; use Piwik\Db; use Piwik\IP; use Piwik\MetricsFormatter; +use Piwik\Option; use Piwik\Piwik; use Piwik\SettingsPiwik; use Piwik\SettingsServer; @@ -714,7 +715,7 @@ class API { Piwik::checkUserIsSuperUser(); $excludedIps = $this->checkAndReturnExcludedIps($excludedIps); - Piwik_SetOption(self::OPTION_EXCLUDED_IPS_GLOBAL, $excludedIps); + Option::set(self::OPTION_EXCLUDED_IPS_GLOBAL, $excludedIps); Cache::deleteTrackerCache(); return true; } @@ -730,8 +731,8 @@ class API public function setGlobalSearchParameters($searchKeywordParameters, $searchCategoryParameters) { Piwik::checkUserIsSuperUser(); - Piwik_SetOption(self::OPTION_SEARCH_KEYWORD_QUERY_PARAMETERS_GLOBAL, $searchKeywordParameters); - Piwik_SetOption(self::OPTION_SEARCH_CATEGORY_QUERY_PARAMETERS_GLOBAL, $searchCategoryParameters); + Option::set(self::OPTION_SEARCH_KEYWORD_QUERY_PARAMETERS_GLOBAL, $searchKeywordParameters); + Option::set(self::OPTION_SEARCH_CATEGORY_QUERY_PARAMETERS_GLOBAL, $searchCategoryParameters); Cache::deleteTrackerCache(); return true; } @@ -742,7 +743,7 @@ class API public function getSearchKeywordParametersGlobal() { Piwik::checkUserHasSomeAdminAccess(); - $names = Piwik_GetOption(self::OPTION_SEARCH_KEYWORD_QUERY_PARAMETERS_GLOBAL); + $names = Option::get(self::OPTION_SEARCH_KEYWORD_QUERY_PARAMETERS_GLOBAL); if ($names === false) { $names = self::DEFAULT_SEARCH_KEYWORD_PARAMETERS; } @@ -758,7 +759,7 @@ class API public function getSearchCategoryParametersGlobal() { Piwik::checkUserHasSomeAdminAccess(); - return Piwik_GetOption(self::OPTION_SEARCH_CATEGORY_QUERY_PARAMETERS_GLOBAL); + return Option::get(self::OPTION_SEARCH_CATEGORY_QUERY_PARAMETERS_GLOBAL); } /** @@ -769,7 +770,7 @@ class API public function getExcludedQueryParametersGlobal() { Piwik::checkUserHasSomeViewAccess(); - return Piwik_GetOption(self::OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL); + return Option::get(self::OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL); } /** @@ -782,7 +783,7 @@ class API public function getExcludedUserAgentsGlobal() { Piwik::checkUserHasSomeAdminAccess(); - return Piwik_GetOption(self::OPTION_EXCLUDED_USER_AGENTS_GLOBAL); + return Option::get(self::OPTION_EXCLUDED_USER_AGENTS_GLOBAL); } /** @@ -798,7 +799,7 @@ class API // update option $excludedUserAgents = $this->checkAndReturnCommaSeparatedStringList($excludedUserAgents); - Piwik_SetOption(self::OPTION_EXCLUDED_USER_AGENTS_GLOBAL, $excludedUserAgents); + Option::set(self::OPTION_EXCLUDED_USER_AGENTS_GLOBAL, $excludedUserAgents); // make sure tracker cache will reflect change Cache::deleteTrackerCache(); @@ -813,7 +814,7 @@ class API public function isSiteSpecificUserAgentExcludeEnabled() { Piwik::checkUserHasSomeAdminAccess(); - return (bool)Piwik_GetOption(self::OPTION_SITE_SPECIFIC_USER_AGENT_EXCLUDE_ENABLE); + return (bool)Option::get(self::OPTION_SITE_SPECIFIC_USER_AGENT_EXCLUDE_ENABLE); } /** @@ -827,7 +828,7 @@ class API Piwik::checkUserIsSuperUser(); // update option - Piwik_SetOption(self::OPTION_SITE_SPECIFIC_USER_AGENT_EXCLUDE_ENABLE, $enabled); + Option::set(self::OPTION_SITE_SPECIFIC_USER_AGENT_EXCLUDE_ENABLE, $enabled); // make sure tracker cache will reflect change Cache::deleteTrackerCache(); @@ -842,7 +843,7 @@ class API public function getKeepURLFragmentsGlobal() { Piwik::checkUserHasSomeViewAccess(); - return (bool)Piwik_GetOption(self::OPTION_KEEP_URL_FRAGMENTS_GLOBAL); + return (bool)Option::get(self::OPTION_KEEP_URL_FRAGMENTS_GLOBAL); } /** @@ -858,7 +859,7 @@ class API Piwik::checkUserIsSuperUser(); // update option - Piwik_SetOption(self::OPTION_KEEP_URL_FRAGMENTS_GLOBAL, $enabled); + Option::set(self::OPTION_KEEP_URL_FRAGMENTS_GLOBAL, $enabled); // make sure tracker cache will reflect change Cache::deleteTrackerCache(); @@ -875,7 +876,7 @@ class API { Piwik::checkUserIsSuperUser(); $excludedQueryParameters = $this->checkAndReturnCommaSeparatedStringList($excludedQueryParameters); - Piwik_SetOption(self::OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL, $excludedQueryParameters); + Option::set(self::OPTION_EXCLUDED_QUERY_PARAMETERS_GLOBAL, $excludedQueryParameters); Cache::deleteTrackerCache(); return true; } @@ -888,7 +889,7 @@ class API public function getExcludedIpsGlobal() { Piwik::checkUserHasSomeAdminAccess(); - return Piwik_GetOption(self::OPTION_EXCLUDED_IPS_GLOBAL); + return Option::get(self::OPTION_EXCLUDED_IPS_GLOBAL); } /** @@ -899,7 +900,7 @@ class API public function getDefaultCurrency() { Piwik::checkUserHasSomeAdminAccess(); - $defaultCurrency = Piwik_GetOption(self::OPTION_DEFAULT_CURRENCY); + $defaultCurrency = Option::get(self::OPTION_DEFAULT_CURRENCY); if ($defaultCurrency) { return $defaultCurrency; } @@ -916,7 +917,7 @@ class API { Piwik::checkUserIsSuperUser(); $this->checkValidCurrency($defaultCurrency); - Piwik_SetOption(self::OPTION_DEFAULT_CURRENCY, $defaultCurrency); + Option::set(self::OPTION_DEFAULT_CURRENCY, $defaultCurrency); return true; } @@ -928,7 +929,7 @@ class API */ public function getDefaultTimezone() { - $defaultTimezone = Piwik_GetOption(self::OPTION_DEFAULT_TIMEZONE); + $defaultTimezone = Option::get(self::OPTION_DEFAULT_TIMEZONE); if ($defaultTimezone) { return $defaultTimezone; } @@ -945,7 +946,7 @@ class API { Piwik::checkUserIsSuperUser(); $this->checkValidTimezone($defaultTimezone); - Piwik_SetOption(self::OPTION_DEFAULT_TIMEZONE, $defaultTimezone); + Option::set(self::OPTION_DEFAULT_TIMEZONE, $defaultTimezone); return true; } diff --git a/plugins/UserCountry/GeoIPAutoUpdater.php b/plugins/UserCountry/GeoIPAutoUpdater.php index ec1627a5fb..8a8064db57 100755 --- a/plugins/UserCountry/GeoIPAutoUpdater.php +++ b/plugins/UserCountry/GeoIPAutoUpdater.php @@ -15,6 +15,7 @@ use Piwik\Common; use Piwik\Date; use Piwik\Http; use Piwik\Log; +use Piwik\Option; use Piwik\Plugins\UserCountry\LocationProvider; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Php; @@ -60,19 +61,19 @@ class GeoIPAutoUpdater public function update() { try { - Piwik_SetOption(self::LAST_RUN_TIME_OPTION_NAME, Date::factory('today')->getTimestamp()); + Option::set(self::LAST_RUN_TIME_OPTION_NAME, Date::factory('today')->getTimestamp()); - $locUrl = Piwik_GetOption(self::LOC_URL_OPTION_NAME); + $locUrl = Option::get(self::LOC_URL_OPTION_NAME); if (!empty($locUrl)) { $this->downloadFile('loc', $locUrl); } - $ispUrl = Piwik_GetOption(self::ISP_URL_OPTION_NAME); + $ispUrl = Option::get(self::ISP_URL_OPTION_NAME); if (!empty($ispUrl)) { $this->downloadFile('isp', $ispUrl); } - $orgUrl = Piwik_GetOption(self::ORG_URL_OPTION_NAME); + $orgUrl = Option::get(self::ORG_URL_OPTION_NAME); if (!empty($orgUrl)) { $this->downloadFile('org', $orgUrl); } @@ -324,7 +325,7 @@ class GeoIPAutoUpdater $url = $options[$optionKey]; $url = self::removeDateFromUrl($url); - Piwik_SetOption($optionName, $url); + Option::set($optionName, $url); } // set period option @@ -339,7 +340,7 @@ class GeoIPAutoUpdater )); } - Piwik_SetOption(self::SCHEDULE_PERIOD_OPTION_NAME, $period); + Option::set(self::SCHEDULE_PERIOD_OPTION_NAME, $period); } } @@ -351,9 +352,9 @@ class GeoIPAutoUpdater */ public static function isUpdaterSetup() { - if (Piwik_GetOption(self::LOC_URL_OPTION_NAME) !== false - || Piwik_GetOption(self::ISP_URL_OPTION_NAME) !== false - || Piwik_GetOption(self::ORG_URL_OPTION_NAME) !== false + if (Option::get(self::LOC_URL_OPTION_NAME) !== false + || Option::get(self::ISP_URL_OPTION_NAME) !== false + || Option::get(self::ORG_URL_OPTION_NAME) !== false ) { return true; } @@ -370,7 +371,7 @@ class GeoIPAutoUpdater { $result = array(); foreach (self::$urlOptions as $key => $optionName) { - $result[$key] = Piwik_GetOption($optionName); + $result[$key] = Option::get($optionName); } return $result; } @@ -387,7 +388,7 @@ class GeoIPAutoUpdater if (empty(self::$urlOptions[$key])) { throw new Exception("Invalid key $key"); } - $url = Piwik_GetOption(self::$urlOptions[$key]); + $url = Option::get(self::$urlOptions[$key]); return $url; } @@ -408,7 +409,7 @@ class GeoIPAutoUpdater */ public static function getSchedulePeriod() { - $period = Piwik_GetOption(self::SCHEDULE_PERIOD_OPTION_NAME); + $period = Option::get(self::SCHEDULE_PERIOD_OPTION_NAME); if ($period === false) { $period = self::SCHEDULE_PERIOD_MONTHLY; } @@ -598,7 +599,7 @@ class GeoIPAutoUpdater */ public static function getLastRunTime() { - $timestamp = Piwik_GetOption(self::LAST_RUN_TIME_OPTION_NAME); + $timestamp = Option::get(self::LAST_RUN_TIME_OPTION_NAME); return $timestamp === false ? false : Date::factory((int)$timestamp); } diff --git a/plugins/UserCountry/LocationProvider.php b/plugins/UserCountry/LocationProvider.php index 554ee735d3..23d3f47a24 100755 --- a/plugins/UserCountry/LocationProvider.php +++ b/plugins/UserCountry/LocationProvider.php @@ -13,6 +13,7 @@ namespace Piwik\Plugins\UserCountry; use Exception; use Piwik\Common; use Piwik\IP; +use Piwik\Option; use Piwik\Plugins\UserCountry\LocationProvider\DefaultProvider; use Piwik\Tracker\Cache; use ReflectionClass; @@ -263,7 +264,7 @@ abstract class LocationProvider */ public static function getCurrentProviderId() { - $optionValue = Piwik_GetOption(self::CURRENT_PROVIDER_OPTION_NAME); + $optionValue = Option::get(self::CURRENT_PROVIDER_OPTION_NAME); return $optionValue === false ? DefaultProvider::ID : $optionValue; } @@ -293,7 +294,7 @@ abstract class LocationProvider throw new Exception( "Invalid provider ID '$providerId'. The provider either does not exist or is not available"); } - Piwik_SetOption(self::CURRENT_PROVIDER_OPTION_NAME, $providerId); + Option::set(self::CURRENT_PROVIDER_OPTION_NAME, $providerId); Cache::clearCacheGeneral(); return $provider; } diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php index 12a246b5a2..47217e73b1 100644 --- a/plugins/UsersManager/API.php +++ b/plugins/UsersManager/API.php @@ -16,6 +16,7 @@ use Piwik\Common; use Piwik\Config; use Piwik\Date; use Piwik\Db; +use Piwik\Option; use Piwik\Piwik; use Piwik\Site; use Piwik\Tracker\Cache; @@ -76,7 +77,7 @@ class API public function setUserPreference($userLogin, $preferenceName, $preferenceValue) { Piwik::checkUserIsSuperUserOrTheUser($userLogin); - Piwik_SetOption($this->getPreferenceId($userLogin, $preferenceName), $preferenceValue); + Option::set($this->getPreferenceId($userLogin, $preferenceName), $preferenceValue); } /** @@ -89,7 +90,7 @@ class API { Piwik::checkUserIsSuperUserOrTheUser($userLogin); - $optionValue = Piwik_GetOption($this->getPreferenceId($userLogin, $preferenceName)); + $optionValue = Option::get($this->getPreferenceId($userLogin, $preferenceName)); if ($optionValue !== false) { return $optionValue; } diff --git a/plugins/UsersManager/UsersManager.php b/plugins/UsersManager/UsersManager.php index 3193315e1e..4f4ff6bfde 100644 --- a/plugins/UsersManager/UsersManager.php +++ b/plugins/UsersManager/UsersManager.php @@ -66,7 +66,7 @@ class UsersManager extends \Piwik\Plugin */ public function deleteSite($idSite) { - Option::getInstance()->deleteLike('%\_' . API::PREFERENCE_DEFAULT_REPORT, $idSite); + Option::deleteLike('%\_' . API::PREFERENCE_DEFAULT_REPORT, $idSite); } /** |