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:
authorMatthieu Napoli <matthieu@mnapoli.fr>2014-12-19 01:26:26 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2014-12-19 01:26:26 +0300
commitbebef285b3eac150ebf79717d6d33d31ac263637 (patch)
treecfe8978e565984186591e583b9277e705fb61b0b /misc/others
parentc9fac0a8af1a3bf2666ceb4d368cb9f2aaced65c (diff)
#6622 Logger refactoring: updated the geoipUpdateRows.php script
Diffstat (limited to 'misc/others')
-rw-r--r--misc/others/cli-script-bootstrap.php17
-rwxr-xr-xmisc/others/geoipUpdateRows.php28
2 files changed, 25 insertions, 20 deletions
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");
+}