diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-09-14 06:37:21 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-09-14 06:37:21 +0400 |
commit | 8d11a25fa7f41212584a58998c59884a4b9836d4 (patch) | |
tree | 39d6e3892346288619987f32a562f7e102c6f34c /misc | |
parent | 4e910af4d770e19bcc7f953840662ee8a4c08b20 (diff) |
Moving PHP/server settings getter/setter to SettingsServer class
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cron/archive.php | 14 | ||||
-rwxr-xr-x | misc/others/geoipUpdateRows.php | 15 | ||||
-rw-r--r-- | misc/others/test_generateLotsVisitsWebsites.php | 7 |
3 files changed, 19 insertions, 17 deletions
diff --git a/misc/cron/archive.php b/misc/cron/archive.php index 0225c3a0ec..c8ff067b1c 100644 --- a/misc/cron/archive.php +++ b/misc/cron/archive.php @@ -1,16 +1,16 @@ <?php use Piwik\ArchiveProcessor\Rules; -use Piwik\Config; -use Piwik\Piwik; use Piwik\Common; +use Piwik\Config; use Piwik\Date; use Piwik\FrontController; use Piwik\Http; +use Piwik\Piwik; use Piwik\Plugins\CoreAdminHome\API as CoreAdminHomeAPI; use Piwik\Plugins\SitesManager\API as SitesManagerAPI; -use Piwik\Version; -use Piwik\Url; use Piwik\Timer; +use Piwik\Url; +use Piwik\Version; $USAGE = " Usage: @@ -632,7 +632,7 @@ class Archiving */ private function initCheckCli() { - if (!Common::isPhpCliMode()) { + if (!\Piwik\SettingsServer::isPhpCliMode()) { $token_auth = Common::getRequestVar('token_auth', '', 'string'); if ($token_auth != $this->token_auth || strlen($token_auth) != 32 @@ -792,7 +792,7 @@ class Archiving private function initPiwikHost() { // If archive.php run as a web cron, we use the current hostname - if (!Common::isPhpCliMode()) { + if (!\Piwik\SettingsServer::isPhpCliMode()) { // example.org/piwik/misc/cron/ $piwikUrl = Common::sanitizeInputValue(Url::getCurrentUrlWithoutFileName()); // example.org/piwik/ @@ -828,7 +828,7 @@ class Archiving */ private function isParameterSet($parameter, $valuePossible = false) { - if (!Common::isPhpCliMode()) { + if (!\Piwik\SettingsServer::isPhpCliMode()) { return false; } $parameters = array( diff --git a/misc/others/geoipUpdateRows.php b/misc/others/geoipUpdateRows.php index d0392c9f3b..3b03d7f245 100755 --- a/misc/others/geoipUpdateRows.php +++ b/misc/others/geoipUpdateRows.php @@ -1,13 +1,14 @@ <?php -use Piwik\Config; -use Piwik\Piwik; use Piwik\Common; +use Piwik\Config; +use Piwik\Db; use Piwik\FrontController; use Piwik\IP; -use Piwik\Db; +use Piwik\Piwik; +use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Pecl; use Piwik\Plugins\UserCountry\LocationProvider; use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Php; -use Piwik\Plugins\UserCountry\LocationProvider\GeoIp\Pecl; +use Piwik\SettingsServer; ini_set("memory_limit", "512M"); error_reporting(E_ALL | E_NOTICE); @@ -41,7 +42,7 @@ $query = "SELECT count(*) FROM " . Common::prefixTable('log_visit'); $count = Db::fetchOne($query); // when script run via browser, check for Super User & output html page to do conversion via AJAX -if (!Common::isPhpCliMode()) { +if (!SettingsServer::isPhpCliMode()) { try { Piwik::checkUserIsSuperUser(); } catch (Exception $e) { @@ -112,7 +113,7 @@ if (!Common::isPhpCliMode()) { function geoipUpdateError($message) { Piwik::log($message); - if (!Common::isPhpCliMode()) { + if (!SettingsServer::isPhpCliMode()) { @header('HTTP/1.1 500 Internal Server Error', $replace = true, $responseCode = 500); } exit; @@ -136,7 +137,7 @@ if (!$provider->isAvailable()) { if ($displayNotes) { Piwik::log("[note] The GeoIP PECL extension is broken: $workingOrError"); } - if (Common::isPhpCliMode()) { + if (SettingsServer::isPhpCliMode()) { Piwik::log("[note] Make sure your command line PHP is configured to use the PECL extension."); } $provider = null; diff --git a/misc/others/test_generateLotsVisitsWebsites.php b/misc/others/test_generateLotsVisitsWebsites.php index 2c8837100a..f28426e251 100644 --- a/misc/others/test_generateLotsVisitsWebsites.php +++ b/misc/others/test_generateLotsVisitsWebsites.php @@ -1,8 +1,9 @@ <?php -use Piwik\Config; -use Piwik\Piwik; use Piwik\Common; +use Piwik\Config; use Piwik\FrontController; +use Piwik\Piwik; +use Piwik\SettingsServer; define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__) . "/../..")); define('PIWIK_ENABLE_DISPATCH', false); @@ -15,7 +16,7 @@ require_once PIWIK_INCLUDE_PATH . "/libs/PiwikTracker/PiwikTracker.php"; FrontController::getInstance()->init(); // SECURITY: DO NOT DELETE THIS LINE! -if (!Common::isPhpCliMode()) { +if (!SettingsServer::isPhpCliMode()) { die("ERROR: Must be executed in CLI"); } |