From 58cce01e613ad7379563336d0b9baf88e48692f2 Mon Sep 17 00:00:00 2001
From: Thomas Steur <thomas.steur@googlemail.com>
Date: Mon, 7 Jul 2014 12:58:38 +0200
Subject: [PATCH] remove all logs again and disable location settings to see if
 this causes it

---
 core/Db/Schema/Mysql.php                |  3 ---
 core/Log.php                            | 21 ---------------------
 plugins/PrivacyManager/IPAnonymizer.php |  7 -------
 plugins/UserCountry/Columns/Base.php    |  2 +-
 tests/PHPUnit/Fixture.php               |  6 ------
 tests/PHPUnit/Fixtures/OmniFixture.php  |  5 -----
 6 files changed, 1 insertion(+), 43 deletions(-)

diff --git a/core/Db/Schema/Mysql.php b/core/Db/Schema/Mysql.php
index e8ee737bf0..80356c1794 100644
--- a/core/Db/Schema/Mysql.php
+++ b/core/Db/Schema/Mysql.php
@@ -462,9 +462,6 @@ class Mysql implements SchemaInterface
      */
     public function truncateAllTables()
     {
-        $message = 'truncateAllTables';
-        \Piwik\Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false);
-
         $tablesAlreadyInstalled = $this->getTablesInstalled($forceReload = true);
         foreach ($tablesAlreadyInstalled as $table) {
             Db::query("TRUNCATE `$table`");
diff --git a/core/Log.php b/core/Log.php
index 7d9e501ddf..5dc22d37c2 100644
--- a/core/Log.php
+++ b/core/Log.php
@@ -379,27 +379,6 @@ class Log extends Singleton
         return $this->currentLogLevel;
     }
 
-    public function customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, $addTrace = true)
-    {
-        if ($addTrace) {
-            $message = $message . "\n";
-            $backTrace = debug_backtrace();
-            $backTrace = array_slice($backTrace, 1, 2);
-
-            foreach ($backTrace as &$trace) {
-                if (!empty($trace['object'])) {
-                    unset($trace['object']);
-                }
-            }
-            $message .= var_export($backTrace, 1);
-        }
-
-        if(!file_put_contents($this->logToFilePath, $message . "\n", FILE_APPEND)) {
-            $message = Filechecks::getErrorMessageMissingPermissions($this->logToFilePath);
-            throw new \Exception( $message );
-        }
-    }
-
     private function logToFile($level, $tag, $datetime, $message)
     {
         $message = $this->getMessageFormattedFile($level, $tag, $datetime, $message);
diff --git a/plugins/PrivacyManager/IPAnonymizer.php b/plugins/PrivacyManager/IPAnonymizer.php
index 34b176eedb..de588c59fd 100644
--- a/plugins/PrivacyManager/IPAnonymizer.php
+++ b/plugins/PrivacyManager/IPAnonymizer.php
@@ -10,7 +10,6 @@ namespace Piwik\Plugins\PrivacyManager;
 
 use Piwik\Common;
 use Piwik\IP;
-use Piwik\Log;
 
 /**
  * Anonymize visitor IP addresses to comply with the privacy laws/guidelines in countries, such as Germany.
@@ -54,9 +53,6 @@ class IPAnonymizer
     public function setVisitorIpAddress(&$ip)
     {
         if (!$this->isActive()) {
-            $message = "Visitor IP was _not_ anonymized: ". IP::N2P($ip);
-            Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false);
-
             Common::printDebug("Visitor IP was _not_ anonymized: ". IP::N2P($ip));
             return;
         }
@@ -67,9 +63,6 @@ class IPAnonymizer
 
         $ip = self::applyIPMask($ip, $privacyConfig->ipAddressMaskLength);
 
-        $message = "Visitor IP (was: ". IP::N2P($originalIp) .") has been anonymized: ". IP::N2P($ip) . ' with length ' . $privacyConfig->ipAddressMaskLength;
-        Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false);
-
         Common::printDebug("Visitor IP (was: ". IP::N2P($originalIp) .") has been anonymized: ". IP::N2P($ip));
     }
 
diff --git a/plugins/UserCountry/Columns/Base.php b/plugins/UserCountry/Columns/Base.php
index b9d14f23bd..35d9671217 100644
--- a/plugins/UserCountry/Columns/Base.php
+++ b/plugins/UserCountry/Columns/Base.php
@@ -71,7 +71,7 @@ abstract class Base extends VisitDimension
         $key = md5(implode(',', $userInfo));
 
         if (array_key_exists($key, self::$cachedLocations)) {
-            return self::$cachedLocations[$key];
+           // return self::$cachedLocations[$key];
         }
 
         $provider = $this->getProvider();
diff --git a/tests/PHPUnit/Fixture.php b/tests/PHPUnit/Fixture.php
index 08bf6d79f7..e68ff787e9 100644
--- a/tests/PHPUnit/Fixture.php
+++ b/tests/PHPUnit/Fixture.php
@@ -115,8 +115,6 @@ class Fixture extends PHPUnit_Framework_Assert
 
     public function performSetUp($setupEnvironmentOnly = false)
     {
-        $message = 'Perform setup ' . get_class($this);
-        Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false);
         try {
             if ($this->createConfig) {
                 Config::getInstance()->setTestEnvironment();
@@ -258,10 +256,6 @@ class Fixture extends PHPUnit_Framework_Assert
 
     public function performTearDown()
     {
-
-        $message = 'Perform teardown ' . get_class($this);
-        Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false);
-
         // Note: avoid run SQL in the *tearDown() metohds because it randomly fails on Travis CI
         // with error Error while sending QUERY packet. PID=XX
         $this->tearDown();
diff --git a/tests/PHPUnit/Fixtures/OmniFixture.php b/tests/PHPUnit/Fixtures/OmniFixture.php
index 90a43c869b..0de39fd69f 100644
--- a/tests/PHPUnit/Fixtures/OmniFixture.php
+++ b/tests/PHPUnit/Fixtures/OmniFixture.php
@@ -8,7 +8,6 @@
 namespace Piwik\Tests\Fixtures;
 
 use Piwik\Date;
-use Piwik\Log;
 use ReflectionClass;
 
 /**
@@ -86,8 +85,6 @@ class OmniFixture extends \Fixture
     public function setUp()
     {
         foreach ($this->fixtures as $fixture) {
-            $message = 'Setting up fixture ' . get_class($fixture);
-            Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false);
             $fixture->setUp();
         }
     }
@@ -95,8 +92,6 @@ class OmniFixture extends \Fixture
     public function tearDown()
     {
         foreach ($this->fixtures as $fixture) {
-            $message = 'Tear down fixture ' . get_class($fixture);
-            Log::getInstance()->customLogToFileForDebuggingIfYouStillSeeThisHereRemoveIt($message, false);
             $fixture->tearDown();
         }
     }
-- 
GitLab