From 3dfcd9ad5d59796a19db0e8fa1741d6860e45aa2 Mon Sep 17 00:00:00 2001 From: Thomas Steur <thomas.steur@googlemail.com> Date: Mon, 7 Jul 2014 11:11:11 +0200 Subject: [PATCH] whenever ipAnonymization is activated, log DB infos... also log whether db is dropped at some point --- core/CacheFile.php | 9 --------- core/DbHelper.php | 4 ++++ core/Tracker/Cache.php | 13 ------------- plugins/PrivacyManager/IPAnonymizer.php | 14 +++++++++----- tests/LocalTracker.php | 16 ---------------- tests/PHPUnit/Fixture.php | 4 ---- 6 files changed, 13 insertions(+), 47 deletions(-) diff --git a/core/CacheFile.php b/core/CacheFile.php index f63cdd6d78..7a1c824ff8 100644 --- a/core/CacheFile.php +++ b/core/CacheFile.php @@ -79,12 +79,6 @@ class CacheFile $this->opCacheInvalidate($cacheFilePath); } - if ('general' === $id && Common::isPhpCliMode()) { - - $message = 'The path is ' . $cacheFilePath; - \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - } - $ok = @include($cacheFilePath); if ($ok && $cache_complete == true) { @@ -203,9 +197,6 @@ class CacheFile */ public function deleteAll() { - $message = 'Delete All Tracker Cache'; - \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message); - $self = $this; $beforeUnlink = function ($path) use ($self) { $self->opCacheInvalidate($path); diff --git a/core/DbHelper.php b/core/DbHelper.php index 8dbf7d0a9e..2b2d47a46a 100644 --- a/core/DbHelper.php +++ b/core/DbHelper.php @@ -106,6 +106,10 @@ class DbHelper */ public static function dropDatabase($dbName = null) { + + $message = 'Drop DB '; + \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); + if (defined('PIWIK_TEST_MODE') && PIWIK_TEST_MODE) { Schema::getInstance()->dropDatabase($dbName); } diff --git a/core/Tracker/Cache.php b/core/Tracker/Cache.php index eea63d4e13..9183b191b7 100644 --- a/core/Tracker/Cache.php +++ b/core/Tracker/Cache.php @@ -103,9 +103,6 @@ class Cache */ static public function clearCacheGeneral() { - $message = 'Clear Cache General '; - \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message); - self::getInstance()->delete('general'); } @@ -121,19 +118,9 @@ class Cache $cacheId = 'general'; if (($cacheContent = $cache->get($cacheId)) !== false) { - - if (Common::isPhpCliMode()) { - $message = 'there is already a cache general'; - \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - } return $cacheContent; } - if (Common::isPhpCliMode()) { - $message = 'recreating the cache general'; - \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - } - Tracker::initCorePiwikInTrackerMode(); $cacheContent = array( 'isBrowserTriggerEnabled' => Rules::isBrowserTriggerEnabled(), diff --git a/plugins/PrivacyManager/IPAnonymizer.php b/plugins/PrivacyManager/IPAnonymizer.php index afb131fa42..c652ac30ad 100644 --- a/plugins/PrivacyManager/IPAnonymizer.php +++ b/plugins/PrivacyManager/IPAnonymizer.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\PrivacyManager; use Piwik\Common; +use Piwik\Config; use Piwik\IP; use Piwik\Log; @@ -78,11 +79,6 @@ class IPAnonymizer */ public static function deactivate() { - $message = 'deactivate anonmyizer'; - Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message); - $message = var_export($_SERVER, 1); - Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - $privacyConfig = new Config(); $privacyConfig->ipAnonymizerEnabled = false; } @@ -92,6 +88,14 @@ class IPAnonymizer */ public static function activate() { + $dbConfig = Config::getInstance()->database; + $message = 'DB Config ' . var_export($dbConfig, 1); + \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); + + $privacyOptions = \Piwik\Option::getLike('PrivacyManager'); + $message = 'Privacy Options ' . var_export($privacyOptions, 1); + \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); + $message = 'activate anonmyizer'; Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message); $message = var_export($_SERVER, 1); diff --git a/tests/LocalTracker.php b/tests/LocalTracker.php index 11157587ce..003d48cf99 100755 --- a/tests/LocalTracker.php +++ b/tests/LocalTracker.php @@ -51,10 +51,6 @@ class Piwik_LocalTracker extends PiwikTracker $message = 'Privacy Options ' . var_export($privacyOptions, 1); \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - $cacheContent = Cache::getCacheGeneral(); - $message = 'CacheContent pre local ' . var_export($cacheContent, 1); - \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - // unset cached values Cache::$trackerCache = null; Tracker::setForceIp(null); @@ -86,18 +82,6 @@ class Piwik_LocalTracker extends PiwikTracker $oldCookie = $_COOKIE; // parse_str(parse_url($this->requestCookie, PHP_URL_QUERY), $_COOKIE); - $dbConfig = Config::getInstance()->database; - $message = 'DB Config ' . var_export($dbConfig, 1); - \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - - $privacyOptions = \Piwik\Option::getLike('PrivacyManager'); - $message = 'Privacy Options ' . var_export($privacyOptions, 1); - \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - - $cacheContent = Cache::getCacheGeneral(); - $message = 'CacheContent before local ' . var_export($cacheContent, 1); - \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - // do tracking and capture output ob_start(); diff --git a/tests/PHPUnit/Fixture.php b/tests/PHPUnit/Fixture.php index c8e3529365..08bf6d79f7 100644 --- a/tests/PHPUnit/Fixture.php +++ b/tests/PHPUnit/Fixture.php @@ -288,10 +288,6 @@ class Fixture extends PHPUnit_Framework_Assert public static function loadAllPlugins($testEnvironment = null, $testCaseClass = false, $extraPluginsToLoad = array()) { - - $message = 'Load all plugins '; - Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false); - if (empty($testEnvironment)) { $testEnvironment = new Piwik_TestingEnvironment(); } -- GitLab