diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-08-02 17:59:33 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-08-02 17:59:33 +0400 |
commit | a96ec40e983a8b64f4c25def541a519ff3670e6a (patch) | |
tree | bef2a5f7b1e9532dc96161334e23a553cdff7ea1 /misc/others | |
parent | 61997f45e4c39360000e815c9e0853ae04e2f56f (diff) |
Refs #4059 Converting dozens of plugins/* classes to use Namespaces, \Piwik\Plugins\*
Added namespaces to functions.php files in the five plugins that had one
Work in progress
Diffstat (limited to 'misc/others')
-rwxr-xr-x | misc/others/geoipUpdateRows.php | 23 | ||||
-rw-r--r-- | misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php | 3 |
2 files changed, 15 insertions, 11 deletions
diff --git a/misc/others/geoipUpdateRows.php b/misc/others/geoipUpdateRows.php index b0ffb11d7c..d0392c9f3b 100755 --- a/misc/others/geoipUpdateRows.php +++ b/misc/others/geoipUpdateRows.php @@ -5,6 +5,9 @@ use Piwik\Common; use Piwik\FrontController; use Piwik\IP; use Piwik\Db; +use Piwik\Plugins\UserCountry\LocationProvider; +use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Php; +use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Pecl; ini_set("memory_limit", "512M"); error_reporting(E_ALL | E_NOTICE); @@ -120,7 +123,7 @@ function geoipUpdateError($message) $displayNotes = $start == 0; // try getting the pecl location provider -$provider = new Piwik_UserCountry_LocationProvider_GeoIp_Pecl(); +$provider = new Pecl(); if (!$provider->isAvailable()) { if ($displayNotes) { Piwik::log("[note] The GeoIP PECL extension is not installed."); @@ -146,7 +149,7 @@ if (is_null($provider)) { Piwik::log("[note] Falling back to PHP API. This may become too slow for you. If so, you can read this link on how to install the PECL extension: http://piwik.org/faq/how-to/#faq_164"); } - $provider = new Piwik_UserCountry_LocationProvider_GeoIp_Php(); + $provider = new Php(); if (!$provider->isAvailable()) { if ($displayNotes) { Piwik::log("[note] The GeoIP PHP API is not available. This means you do not have a GeoIP location database in your ./misc directory. The database must be named either GeoIP.dat or GeoIPCity.dat based on the type of database it is."); @@ -173,11 +176,11 @@ if ($displayNotes) { } // perform update -$logVisitFieldsToUpdate = array('location_country' => Piwik_UserCountry_LocationProvider::COUNTRY_CODE_KEY, - 'location_region' => Piwik_UserCountry_LocationProvider::REGION_CODE_KEY, - 'location_city' => Piwik_UserCountry_LocationProvider::CITY_NAME_KEY, - 'location_latitude' => Piwik_UserCountry_LocationProvider::LATITUDE_KEY, - 'location_longitude' => Piwik_UserCountry_LocationProvider::LONGITUDE_KEY); +$logVisitFieldsToUpdate = array('location_country' => LocationProvider::COUNTRY_CODE_KEY, + 'location_region' => LocationProvider::REGION_CODE_KEY, + 'location_city' => LocationProvider::CITY_NAME_KEY, + 'location_latitude' => LocationProvider::LATITUDE_KEY, + 'location_longitude' => LocationProvider::LONGITUDE_KEY); if ($displayNotes) { Piwik::log("\n$count rows to process in " . Common::prefixTable('log_visit') @@ -208,9 +211,9 @@ for (; $start < $end; $start += $limit) { $ip = IP::N2P($row['location_ip']); $location = $provider->getLocation(array('ip' => $ip)); - if (!empty($location[Piwik_UserCountry_LocationProvider::COUNTRY_CODE_KEY])) { - $location[Piwik_UserCountry_LocationProvider::COUNTRY_CODE_KEY] = - strtolower($location[Piwik_UserCountry_LocationProvider::COUNTRY_CODE_KEY]); + if (!empty($location[LocationProvider::COUNTRY_CODE_KEY])) { + $location[LocationProvider::COUNTRY_CODE_KEY] = + strtolower($location[LocationProvider::COUNTRY_CODE_KEY]); } $row['location_country'] = strtolower($row['location_country']); diff --git a/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php b/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php index e9c6b32449..69154a4b13 100644 --- a/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php +++ b/misc/others/test_cookies_GenerateHundredsWebsitesAndVisits.php @@ -4,6 +4,7 @@ use Piwik\Piwik; use Piwik\Common; use Piwik\FrontController; +use Piwik\Plugins\SitesManager\API; exit; @@ -19,7 +20,7 @@ FrontController::getInstance()->init(); Piwik::setUserIsSuperUser(); $count = 100; for ($i = 0; $i <= $count; $i++) { - $id = Piwik_SitesManager_API::getInstance()->addSite(Common::getRandomString(), 'http://piwik.org'); + $id = API::getInstance()->addSite(Common::getRandomString(), 'http://piwik.org'); $t = new PiwikTracker($id, 'http://localhost/trunk/piwik.php'); echo $id . " <img width=100 height=10 border=1 src='" . $t->getUrlTrackPageView('title') . "'><br/>"; } |