From 9d71fc8e92e5b434fd69c7ab4b83a69169064cf3 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Thu, 4 Dec 2014 03:04:02 +0100 Subject: Tracker refactoring --- misc/others/cli-script-bootstrap.php | 2 -- misc/others/geoipUpdateRows.php | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'misc/others') diff --git a/misc/others/cli-script-bootstrap.php b/misc/others/cli-script-bootstrap.php index f26d45abcc..9f89cfe319 100644 --- a/misc/others/cli-script-bootstrap.php +++ b/misc/others/cli-script-bootstrap.php @@ -34,7 +34,5 @@ require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; $GLOBALS['PIWIK_TRACKER_DEBUG'] = false; define('PIWIK_ENABLE_DISPATCH', false); -Config::getInstance()->log['log_writers'][] = 'screen'; -Config::getInstance()->log['log_level'] = 'VERBOSE'; Config::getInstance()->log['string_message_format'] = "%message%"; FrontController::getInstance()->init(); \ No newline at end of file diff --git a/misc/others/geoipUpdateRows.php b/misc/others/geoipUpdateRows.php index 09ae69d3d4..23e72fc413 100755 --- a/misc/others/geoipUpdateRows.php +++ b/misc/others/geoipUpdateRows.php @@ -23,6 +23,12 @@ if (!Common::isPhpCliMode()) { Log::error('[error] You must be logged in as Super User to run this script. Please login in to Piwik and refresh this page.'); exit; } +} + +Log::getInstance()->setLogLevel(Log::VERBOSE); +Log::getInstance()->addLogWriter('screen'); + +if (!Common::isPhpCliMode()) { // the 'start' query param will be supplied by the AJAX requests, so if it's not there, the // user is viewing the page in the browser. if (Common::getRequestVar('start', false) === false) { -- cgit v1.2.3 From bebef285b3eac150ebf79717d6d33d31ac263637 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Fri, 19 Dec 2014 11:26:26 +1300 Subject: #6622 Logger refactoring: updated the geoipUpdateRows.php script --- misc/others/cli-script-bootstrap.php | 17 +++++++++++++---- misc/others/geoipUpdateRows.php | 28 ++++++++++++---------------- 2 files changed, 25 insertions(+), 20 deletions(-) (limited to 'misc/others') diff --git a/misc/others/cli-script-bootstrap.php b/misc/others/cli-script-bootstrap.php index 9f89cfe319..e2374bbe10 100644 --- a/misc/others/cli-script-bootstrap.php +++ b/misc/others/cli-script-bootstrap.php @@ -4,10 +4,13 @@ * * @link http://piwik.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * */ -use Piwik\Config; + +use Piwik\Container\StaticContainer; use Piwik\FrontController; +use Symfony\Bridge\Monolog\Handler\ConsoleHandler; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\Console\Output\OutputInterface; error_reporting(E_ALL | E_NOTICE); @@ -34,5 +37,11 @@ require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; $GLOBALS['PIWIK_TRACKER_DEBUG'] = false; define('PIWIK_ENABLE_DISPATCH', false); -Config::getInstance()->log['string_message_format'] = "%message%"; -FrontController::getInstance()->init(); \ No newline at end of file +if (Piwik\Common::isPhpCliMode()) { + StaticContainer::setEnvironment('cli'); + /** @var ConsoleHandler $consoleLogHandler */ + $consoleLogHandler = StaticContainer::getContainer()->get('Symfony\Bridge\Monolog\Handler\ConsoleHandler'); + $consoleLogHandler->setOutput(new ConsoleOutput()); +} + +FrontController::getInstance()->init(); diff --git a/misc/others/geoipUpdateRows.php b/misc/others/geoipUpdateRows.php index 23e72fc413..f7b5473c3c 100755 --- a/misc/others/geoipUpdateRows.php +++ b/misc/others/geoipUpdateRows.php @@ -20,14 +20,11 @@ if (!Common::isPhpCliMode()) { try { Piwik::checkUserHasSuperUserAccess(); } catch (Exception $e) { - Log::error('[error] You must be logged in as Super User to run this script. Please login in to Piwik and refresh this page.'); + Log::error('You must be logged in as Super User to run this script. Please login in to Piwik and refresh this page.'); exit; } } -Log::getInstance()->setLogLevel(Log::VERBOSE); -Log::getInstance()->addLogWriter('screen'); - if (!Common::isPhpCliMode()) { // the 'start' query param will be supplied by the AJAX requests, so if it's not there, the // user is viewing the page in the browser. @@ -105,7 +102,7 @@ $displayNotes = $start == 0; $provider = new Pecl(); if (!$provider->isAvailable()) { if ($displayNotes) { - Log::info("[note] The GeoIP PECL extension is not installed."); + Log::info("The GeoIP PECL extension is not installed."); } $provider = null; @@ -113,10 +110,10 @@ if (!$provider->isAvailable()) { $workingOrError = $provider->isWorking(); if ($workingOrError !== true) { if ($displayNotes) { - Log::info("[note] The GeoIP PECL extension is broken: $workingOrError"); + Log::info("The GeoIP PECL extension is broken: $workingOrError"); } if (Common::isPhpCliMode()) { - Log::info("[note] Make sure your command line PHP is configured to use the PECL extension."); + Log::info("Make sure your command line PHP is configured to use the PECL extension."); } $provider = null; } @@ -125,20 +122,20 @@ if (!$provider->isAvailable()) { // use php api if pecl extension cannot be used if (is_null($provider)) { if ($displayNotes) { - Log::info("[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"); + Log::info("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 Php(); if (!$provider->isAvailable()) { if ($displayNotes) { - Log::info("[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."); + Log::info("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."); } $provider = null; } else { $workingOrError = $provider->isWorking(); if ($workingOrError !== true) { if ($displayNotes) { - Log::info("[note] The GeoIP PHP API is broken: $workingOrError"); + Log::info("The GeoIP PHP API is broken: $workingOrError"); } $provider = null; } @@ -146,12 +143,12 @@ if (is_null($provider)) { } if (is_null($provider)) { - geoipUpdateError("\n[error] There is no location provider that can be used with this script. Only the GeoIP PECL module or the GeoIP PHP API can be used at present. Please install and configure one of these first."); + geoipUpdateError("There is no location provider that can be used with this script. Only the GeoIP PECL module or the GeoIP PHP API can be used at present. Please install and configure one of these first."); } $info = $provider->getInfo(); if ($displayNotes) { - Log::info("[note] Found working provider: {$info['id']}"); + Log::info("Found working provider: {$info['id']}"); } // perform update @@ -162,7 +159,7 @@ $logVisitFieldsToUpdate = array('location_country' => LocationProvider::COUNTR 'location_longitude' => LocationProvider::LONGITUDE_KEY); if ($displayNotes) { - Log::info("\n$count rows to process in " . Common::prefixTable('log_visit') + Log::info("$count rows to process in " . Common::prefixTable('log_visit') . " and " . Common::prefixTable('log_conversion') . "..."); } flush(); @@ -230,6 +227,5 @@ for (; $start < $end; $start += $limit) { } if ($start >= $count) { Log::info("100% done!"); - Log::info(""); - Log::info("[note] Now that you've geolocated your old visits, you need to force your reports to be re-processed. See this FAQ entry: http://piwik.org/faq/how-to/#faq_59"); -} \ No newline at end of file + Log::info("Now that you've geolocated your old visits, you need to force your reports to be re-processed. See this FAQ entry: http://piwik.org/faq/how-to/#faq_59"); +} -- cgit v1.2.3 From b4af652dd9284f5565ba658389840a47dac48211 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 22 Dec 2014 15:32:45 +1300 Subject: Moved common bootstrap code in a `core/bootstrap.php` file This file is not in a class because it needs to be compatible with PHP 4. --- misc/others/cli-script-bootstrap.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'misc/others') diff --git a/misc/others/cli-script-bootstrap.php b/misc/others/cli-script-bootstrap.php index e2374bbe10..7e7e091448 100644 --- a/misc/others/cli-script-bootstrap.php +++ b/misc/others/cli-script-bootstrap.php @@ -10,27 +10,20 @@ use Piwik\Container\StaticContainer; use Piwik\FrontController; use Symfony\Bridge\Monolog\Handler\ConsoleHandler; use Symfony\Component\Console\Output\ConsoleOutput; -use Symfony\Component\Console\Output\OutputInterface; - -error_reporting(E_ALL | E_NOTICE); define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__) == '/' ? '' : dirname(__FILE__) . '/../..'); if (file_exists(PIWIK_DOCUMENT_ROOT . '/bootstrap.php')) { require_once PIWIK_DOCUMENT_ROOT . '/bootstrap.php'; } -if (!defined('PIWIK_USER_PATH')) { - define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT); -} if (!defined('PIWIK_INCLUDE_PATH')) { define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT); } +require_once PIWIK_INCLUDE_PATH . '/core/bootstrap.php'; + ignore_user_abort(true); set_time_limit(0); -@date_default_timezone_set('UTC'); -require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; -require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php'; require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; \Piwik\Loader::init(); -- cgit v1.2.3 From f172b5924d52cbfda53e7ce23db0bb58da6db0f3 Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 22 Dec 2014 16:32:06 +1300 Subject: Removed Piwik\Loader: Composer's autoloader is now included in core/bootstrap.php --- misc/others/cli-script-bootstrap.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'misc/others') diff --git a/misc/others/cli-script-bootstrap.php b/misc/others/cli-script-bootstrap.php index 7e7e091448..ac60ae30af 100644 --- a/misc/others/cli-script-bootstrap.php +++ b/misc/others/cli-script-bootstrap.php @@ -24,9 +24,6 @@ require_once PIWIK_INCLUDE_PATH . '/core/bootstrap.php'; ignore_user_abort(true); set_time_limit(0); -require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; -\Piwik\Loader::init(); - $GLOBALS['PIWIK_TRACKER_DEBUG'] = false; define('PIWIK_ENABLE_DISPATCH', false); -- cgit v1.2.3 From ff9e415fb23ae06aa68a73e2c3dcf32ff092444b Mon Sep 17 00:00:00 2001 From: Matthieu Napoli Date: Mon, 12 Jan 2015 14:44:22 +1300 Subject: Simplified get from container with new shorter method --- misc/others/cli-script-bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/others') diff --git a/misc/others/cli-script-bootstrap.php b/misc/others/cli-script-bootstrap.php index ac60ae30af..afd3494834 100644 --- a/misc/others/cli-script-bootstrap.php +++ b/misc/others/cli-script-bootstrap.php @@ -30,7 +30,7 @@ define('PIWIK_ENABLE_DISPATCH', false); if (Piwik\Common::isPhpCliMode()) { StaticContainer::setEnvironment('cli'); /** @var ConsoleHandler $consoleLogHandler */ - $consoleLogHandler = StaticContainer::getContainer()->get('Symfony\Bridge\Monolog\Handler\ConsoleHandler'); + $consoleLogHandler = StaticContainer::get('Symfony\Bridge\Monolog\Handler\ConsoleHandler'); $consoleLogHandler->setOutput(new ConsoleOutput()); } -- cgit v1.2.3 From a778ac88c864bdaaa205fbfccdbc409b5d1de443 Mon Sep 17 00:00:00 2001 From: sgiehl Date: Wed, 14 Jan 2015 21:56:06 +0100 Subject: removed several occurences of UserSettings plugin --- misc/others/api_internal_call.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/others') diff --git a/misc/others/api_internal_call.php b/misc/others/api_internal_call.php index f099b962ee..4cc0052911 100644 --- a/misc/others/api_internal_call.php +++ b/misc/others/api_internal_call.php @@ -18,7 +18,7 @@ FrontController::getInstance()->init(); // This inits the API Request with the specified parameters $request = new Request(' module=API - &method=UserSettings.getResolution + &method=Resolution.getResolution &idSite=7 &date=yesterday &period=week -- cgit v1.2.3 From adcf4f0e8642287ceeb28ca0e07dda9a9efad00d Mon Sep 17 00:00:00 2001 From: sgiehl Date: Sun, 18 Jan 2015 15:20:34 +0100 Subject: fixes #7028 - fixed jquery path --- misc/others/geoipUpdateRows.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'misc/others') diff --git a/misc/others/geoipUpdateRows.php b/misc/others/geoipUpdateRows.php index f7b5473c3c..44a0802390 100755 --- a/misc/others/geoipUpdateRows.php +++ b/misc/others/geoipUpdateRows.php @@ -34,7 +34,7 @@ if (!Common::isPhpCliMode()) { - +