diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-07-31 01:13:56 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2013-07-31 01:13:56 +0400 |
commit | 765be0dc8f92a6d4bb3e678a0c23f2d4b95e0e18 (patch) | |
tree | 3a0ae0e7334250446b687667e4d365af6975e0f4 /core | |
parent | 5104d94f3b2250f766b9c520e2da8da9b4cab2e9 (diff) |
Refs #3741 Resuming PHP Namespaces conversion of Piwik core, mostly finished core/ conversion
Diffstat (limited to 'core')
74 files changed, 172 insertions, 406 deletions
diff --git a/core/API/DocumentationGenerator.php b/core/API/DocumentationGenerator.php index 8c2b0ca37a..a6766f4e52 100644 --- a/core/API/DocumentationGenerator.php +++ b/core/API/DocumentationGenerator.php @@ -14,8 +14,7 @@ use Exception; use Piwik\Piwik; use Piwik\Common; use Piwik\API\Proxy; -use Piwik_API_Proxy_NoDefaultValue; -use Piwik_Url; +use Piwik\Url; /** * @package Piwik @@ -203,11 +202,11 @@ class DocumentationGenerator $defaultValue = $knowExampleDefaultParametersValues[$nameVariable]; } // if there isn't a default value for a given parameter, // we need a 'know default value' or we can't generate the link - elseif ($defaultValue instanceof Piwik_API_Proxy_NoDefaultValue) { + elseif ($defaultValue instanceof NoDefaultValue) { return false; } } - return '?' . Piwik_Url::getQueryStringFromParameters($aParameters); + return '?' . Url::getQueryStringFromParameters($aParameters); } /** @@ -228,7 +227,7 @@ class DocumentationGenerator continue; } $str = $nameVariable; - if (!($defaultValue instanceof Piwik_API_Proxy_NoDefaultValue)) { + if (!($defaultValue instanceof NoDefaultValue)) { if (is_array($defaultValue)) { $str .= " = 'Array'"; } else { diff --git a/core/API/Proxy.php b/core/API/Proxy.php index 8579e4a13a..e3861facb1 100644 --- a/core/API/Proxy.php +++ b/core/API/Proxy.php @@ -50,7 +50,7 @@ class Proxy */ protected function __construct() { - $this->noDefaultValue = new Piwik_API_Proxy_NoDefaultValue(); + $this->noDefaultValue = new NoDefaultValue(); } /** @@ -60,10 +60,10 @@ class Proxy */ static public function getInstance() { - if (\Piwik\API\self::$instance == null) { - \Piwik\API\self::$instance = new \Piwik\API\self; + if (self::$instance == null) { + self::$instance = new self; } - return \Piwik\API\self::$instance; + return self::$instance; } /** @@ -203,7 +203,7 @@ class Proxy // log the API Call try { - Zend_Registry::get('logger_api_call')->logEvent( + \Zend_Registry::get('logger_api_call')->logEvent( $className, $methodName, $parameterNamesDefaultValues, @@ -277,7 +277,7 @@ class Proxy $finalParameters = array(); foreach ($requiredParameters as $name => $defaultValue) { try { - if ($defaultValue instanceof Piwik_API_Proxy_NoDefaultValue) { + if ($defaultValue instanceof NoDefaultValue) { $requestValue = Common::getRequestVar($name, null, null, $parametersRequest); } else { try { @@ -315,7 +315,7 @@ class Proxy */ private function includeApiFile($fileName) { - $module = \Piwik\API\self::getModuleNameFromClassName($fileName); + $module = self::getModuleNameFromClassName($fileName); $path = PIWIK_INCLUDE_PATH . '/plugins/' . $module . '/API.php'; if (is_readable($path)) { @@ -414,6 +414,6 @@ class Proxy * @package Piwik * @subpackage Piwik_API */ -class Piwik_API_Proxy_NoDefaultValue +class NoDefaultValue { } diff --git a/core/Access.php b/core/Access.php index a53cd52d1b..a5daa13578 100644 --- a/core/Access.php +++ b/core/Access.php @@ -13,6 +13,7 @@ namespace Piwik; use Piwik\Config; use Piwik\Common; use Piwik\Auth; +use Piwik\Db; /** * Class to handle User Access: diff --git a/core/Archive.php b/core/Archive.php index a0412b4ae6..0b726493bd 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -456,7 +456,7 @@ class Archive continue; } - // if the starting date is in the future we know there is no visit + // if the starting date is in the future we know there is no visiidsite = ?t if ($twoDaysBeforePeriod->isLater($today)) { $archiveDesc = $this->getArchiveDescriptor($idSite, $period); Piwik::log("Archive $archiveDesc skipped, archive is after today."); diff --git a/core/Controller.php b/core/Controller.php index 344dee8616..2649339ab1 100644 --- a/core/Controller.php +++ b/core/Controller.php @@ -680,7 +680,7 @@ abstract class Controller && $currentLogin != 'anonymous' ) { $errorMessage = sprintf(Piwik_Translate('CoreHome_NoPrivilegesAskPiwikAdmin'), $currentLogin, "<br/><a href='mailto:" . Piwik::getSuperUserEmail() . "?subject=Access to Piwik for user $currentLogin'>", "</a>"); - $errorMessage .= "<br /><br /> <b><a href='index.php?module=" . Zend_Registry::get('auth')->getName() . "&action=logout'>› " . Piwik_Translate('General_Logout') . "</a></b><br />"; + $errorMessage .= "<br /><br /> <b><a href='index.php?module=" . \Zend_Registry::get('auth')->getName() . "&action=logout'>› " . Piwik_Translate('General_Logout') . "</a></b><br />"; Piwik_ExitWithMessage($errorMessage, false, true); } diff --git a/core/DataAccess/ArchiveSelector.php b/core/DataAccess/ArchiveSelector.php index b261e78fc3..6b1f716243 100644 --- a/core/DataAccess/ArchiveSelector.php +++ b/core/DataAccess/ArchiveSelector.php @@ -21,6 +21,7 @@ use Piwik\ArchiveProcessor; use Piwik\Segment; use Piwik\Site; use Piwik\DataAccess\ArchiveTableCreator; +use Piwik\Db; /** * Data Access object used to query archives diff --git a/core/DataAccess/ArchiveTableCreator.php b/core/DataAccess/ArchiveTableCreator.php index cb70f49b35..8e135f996f 100644 --- a/core/DataAccess/ArchiveTableCreator.php +++ b/core/DataAccess/ArchiveTableCreator.php @@ -51,7 +51,7 @@ class ArchiveTableCreator } if (!in_array($tableName, self::$tablesAlreadyInstalled)) { - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); $sql = Piwik::getTableCreateSql($tableNamePrefix); // replace table name template by real name diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php index f1b38c7d4e..0035c121dd 100644 --- a/core/DataAccess/LogAggregator.php +++ b/core/DataAccess/LogAggregator.php @@ -511,6 +511,6 @@ class LogAggregator public function getDb() { - return Zend_Registry::get('db'); + return \Zend_Registry::get('db'); } } diff --git a/core/Db.php b/core/Db.php index d73b5c65f6..3b9c8132e5 100644 --- a/core/Db.php +++ b/core/Db.php @@ -31,7 +31,7 @@ class Db $db = Tracker::getDatabase(); } if ($db === null) { - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); } return $db; } @@ -42,13 +42,13 @@ class Db * If you want to fetch data from the DB you should use the function Db::fetchAll() * * @param string $sql SQL Query - * @return integer|Zend_Db_Statement + * @return integer|\Zend_Db_Statement */ static public function exec($sql) { - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); $profiler = $db->getProfiler(); - $q = $profiler->queryStart($sql, Zend_Db_Profiler::INSERT); + $q = $profiler->queryStart($sql, \Zend_Db_Profiler::INSERT); $return = self::getDb()->exec($sql); $profiler->queryEnd($q); return $return; @@ -315,7 +315,7 @@ class Db * * @return array */ - static public function segmentedFetchAll($sql, $first, $last, $step, $params) + static public function segmentedFetchAll($sql, $first, $last, $step, $params = array()) { $result = array(); if ($step > 0) { @@ -378,7 +378,7 @@ class Db */ $sql = 'SELECT GET_LOCK(?, 1)'; - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); while ($maxRetries > 0) { if ($db->fetchOne($sql, array($lockName)) == '1') { @@ -399,7 +399,7 @@ class Db { $sql = 'SELECT RELEASE_LOCK(?)'; - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); return $db->fetchOne($sql, array($lockName)) == '1'; } } diff --git a/core/Db/Adapter.php b/core/Db/Adapter.php index e818866802..989fe308d7 100644 --- a/core/Db/Adapter.php +++ b/core/Db/Adapter.php @@ -75,7 +75,7 @@ class Adapter */ private static function getAdapterClassName($adapterName) { - return 'Piwik_Db_Adapter_' . str_replace(' ', '_', ucwords(str_replace('_', ' ', strtolower($adapterName)))); + return 'Piwik\Db\Adapter\\' . str_replace(' ', '\\', ucwords(str_replace('_', ' ', strtolower($adapterName)))); } /** diff --git a/core/Db/Adapter/Pdo/Mssql.php b/core/Db/Adapter/Pdo/Mssql.php index c77797b6c1..1f218e20d7 100644 --- a/core/Db/Adapter/Pdo/Mssql.php +++ b/core/Db/Adapter/Pdo/Mssql.php @@ -14,7 +14,7 @@ use Exception; use PDO; use PDOException; use Piwik\Config; -use Piwik\Db\Adapter\AdapterInterface; +use Piwik\Db\AdapterInterface; use Zend_Db; use Zend_Db_Adapter_Exception; use Zend_Db_Adapter_Pdo_Mssql; diff --git a/core/Db/Adapter/Pdo/Mysql.php b/core/Db/Adapter/Pdo/Mysql.php index 37dae1bee8..34ec106a87 100644 --- a/core/Db/Adapter/Pdo/Mysql.php +++ b/core/Db/Adapter/Pdo/Mysql.php @@ -14,7 +14,7 @@ use Exception; use PDO; use PDOException; use Piwik\Config; -use Piwik\Db\Adapter\AdapterInterface; +use Piwik\Db\AdapterInterface; use Zend_Config; use Zend_Db_Adapter_Pdo_Mysql; use Zend_Db_Select; diff --git a/core/Db/Adapter/Pdo/Pgsql.php b/core/Db/Adapter/Pdo/Pgsql.php index 16baba2543..6b9b25ba19 100644 --- a/core/Db/Adapter/Pdo/Pgsql.php +++ b/core/Db/Adapter/Pdo/Pgsql.php @@ -14,7 +14,7 @@ use Exception; use PDO; use PDOException; use Piwik\Config; -use Piwik\Db\Adapter\AdapterInterface; +use Piwik\Db\AdapterInterface; use Zend_Db_Adapter_Pdo_Pgsql; /** diff --git a/core/Db/Schema.php b/core/Db/Schema.php index 261860c6a1..9064a6a908 100644 --- a/core/Db/Schema.php +++ b/core/Db/Schema.php @@ -11,7 +11,6 @@ namespace Piwik\Db; use Piwik\Config; -use Piwik\Db\Schema\SchemaInterface; /** * Schema abstraction @@ -58,7 +57,7 @@ class Schema */ private static function getSchemaClassName($schemaName) { - return 'Piwik_Db_Schema_' . str_replace(' ', '_', ucwords(str_replace('_', ' ', strtolower($schemaName)))); + return '\Piwik\Db\Schema\\' . str_replace(' ', '\\', ucwords(str_replace('_', ' ', strtolower($schemaName)))); } /** @@ -150,7 +149,7 @@ class Schema /** * Returns an instance that subclasses Schema * - * @return \Piwik\Db\Schema\SchemaInterface + * @return \Piwik\Db\SchemaInterface */ private function getSchema() { diff --git a/core/Db/Schema/Myisam.php b/core/Db/Schema/Myisam.php index 8a6ae12e07..9502a74f28 100644 --- a/core/Db/Schema/Myisam.php +++ b/core/Db/Schema/Myisam.php @@ -12,12 +12,14 @@ namespace Piwik\Db\Schema; use Exception; use Piwik\Config; -use Piwik\Db\Schema\SchemaInterface; +use Piwik\Db\SchemaInterface; use Piwik\Piwik; use Piwik\Common; use Piwik\Date; +use Piwik\Db; use Zend_Registry; + /** * MySQL schema * @@ -34,7 +36,7 @@ class Myisam implements SchemaInterface */ static private function hasStorageEngine($engineName) { - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); $allEngines = $db->fetchAssoc('SHOW ENGINES'); if (array_key_exists($engineName, $allEngines)) { $support = $allEngines[$engineName]['Support']; @@ -452,7 +454,7 @@ class Myisam implements SchemaInterface if (is_null($this->tablesInstalled) || $forceReload === true ) { - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); $config = Config::getInstance(); $prefixTables = $config->database['tables_prefix']; @@ -515,7 +517,7 @@ class Myisam implements SchemaInterface */ public function createTables() { - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); $config = Config::getInstance(); $prefixTables = $config->database['tables_prefix']; @@ -539,7 +541,7 @@ class Myisam implements SchemaInterface { // The anonymous user is the user that is assigned by default // note that the token_auth value is anonymous, which is assigned by default as well in the Login plugin - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); $db->query("INSERT INTO " . Common::prefixTable("user") . " VALUES ( 'anonymous', '', 'anonymous', 'anonymous@example.org', 'anonymous', '" . Date::factory('now')->getDatetime() . "' );"); } @@ -563,7 +565,7 @@ class Myisam implements SchemaInterface public function dropTables($doNotDelete = array()) { $tablesAlreadyInstalled = $this->getTablesInstalled(); - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); $doNotDeletePattern = '/(' . implode('|', $doNotDelete) . ')/'; diff --git a/core/ErrorHandler.php b/core/ErrorHandler.php index f2bcde168c..963d46e3f6 100644 --- a/core/ErrorHandler.php +++ b/core/ErrorHandler.php @@ -47,7 +47,7 @@ function Piwik_ErrorHandler($errno, $errstr, $errfile, $errline) } try { - Zend_Registry::get('logger_error')->logEvent($errno, $errstr, $errfile, $errline, $backtrace); + \Zend_Registry::get('logger_error')->logEvent($errno, $errstr, $errfile, $errline, $backtrace); } catch (Exception $e) { // in case the error occurs before the logger creation, we simply display it print("<pre>$errstr \nin '$errfile' at the line $errline\n\n$backtrace\n</pre>"); diff --git a/core/ExceptionHandler.php b/core/ExceptionHandler.php index 5b21d59e6e..2d97cb06d6 100644 --- a/core/ExceptionHandler.php +++ b/core/ExceptionHandler.php @@ -9,6 +9,7 @@ * @package Piwik */ use Piwik\Piwik; +use Piwik\Log; use Piwik\FrontController; /** @@ -20,7 +21,7 @@ use Piwik\FrontController; function Piwik_ExceptionHandler(Exception $exception) { try { - Zend_Registry::get('logger_exception')->logEvent($exception); + \Zend_Registry::get('logger_exception')->logEvent($exception); } catch (Exception $e) { if (FrontController::shouldRethrowException()) { @@ -36,7 +37,7 @@ function Piwik_ExceptionHandler(Exception $exception) $event['errline'] = $exception->getLine(); $event['backtrace'] = $exception->getTraceAsString(); - $formatter = new Piwik_Log_Exception_Formatter_ScreenFormatter(); + $formatter = new ExceptionScreenFormatter(); $message = $formatter->format($event); $message .= "<br /><br />And this exception raised another exception \"" . $e->getMessage() . "\""; diff --git a/core/FrontController.php b/core/FrontController.php index 1acd18820f..e57b897cda 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -218,7 +218,7 @@ class FrontController $initialized = true; try { - Zend_Registry::set('timer', new Timer); + \Zend_Registry::set('timer', new Timer); $directoriesToCheck = array( '/tmp/', @@ -277,7 +277,7 @@ class FrontController Piwik_PostEvent('FrontController.initAuthenticationObject'); try { - $authAdapter = Zend_Registry::get('auth'); + $authAdapter = \Zend_Registry::get('auth'); } catch (Exception $e) { throw new Exception("Authentication object cannot be found in the Registry. Maybe the Login plugin is not activated? <br />You can activate the plugin by adding:<br /> diff --git a/core/Log/APICall.php b/core/Log/APICall.php index 39398b92ba..b07fbc56ba 100644 --- a/core/Log/APICall.php +++ b/core/Log/APICall.php @@ -40,8 +40,8 @@ class APICall extends Log 'timestamp' => 'timestamp', 'returned_value' => 'returned_value' ); - $screenFormatter = new APICall_Formatter_ScreenFormatter(); - $fileFormatter = new Formatter_FileFormatter(); + $screenFormatter = new APICallScreenFormatter(); + $fileFormatter = new FileFormatter(); parent::__construct($logToFileFilename, $fileFormatter, @@ -75,61 +75,3 @@ class APICall extends Log } } -/** - * Class used to format the API Call log on the screen. - * - * @package Piwik - * @subpackage Log - */ -class APICall_Formatter_ScreenFormatter extends Formatter_ScreenFormatter -{ - /** - * Formats data into a single line to be written by the writer. - * - * @param array $event event data - * @return string formatted line to write to the log - */ - public function format($event) - { - $str = "\n<br /> "; - $str .= "Called: {$event['class_name']}.{$event['method_name']} (took {$event['execution_time']}ms)\n<br /> "; - $str .= "Parameters: "; - $parameterNamesAndDefault = unserialize($event['parameter_names_default_values']); - $parameterValues = unserialize($event['parameter_values']); - $i = 0; - foreach ($parameterNamesAndDefault as $pName => $pDefault) { - if (isset($parameterValues[$i])) { - $currentValue = $parameterValues[$i]; - } else { - $currentValue = $pDefault; - } - $currentValue = $this->formatValue($currentValue); - $str .= "$pName = $currentValue, "; - - $i++; - } - $str .= "\n<br /> "; - $str .= "\n<br /> "; - return parent::format($str); - } - - /** - * Converts the given value to a string - * - * @param mixed $value - * @return string - */ - private function formatValue($value) - { - if (is_string($value)) { - $value = "'$value'"; - } - if (is_null($value)) { - $value = 'null'; - } - if (is_array($value)) { - $value = "array( " . implode(", ", $value) . ")"; - } - return $value; - } -} diff --git a/core/Log/Error.php b/core/Log/Error.php index 609227080e..0b99ecabd2 100644 --- a/core/Log/Error.php +++ b/core/Log/Error.php @@ -37,8 +37,8 @@ class Error extends Log 'errfile' => 'errfile', 'backtrace' => 'backtrace' ); - $screenFormatter = new Error_Formatter_ScreenFormatter(); - $fileFormatter = new Formatter_FileFormatter(); + $screenFormatter = new ErrorScreenFormatter(); + $fileFormatter = new FileFormatter(); parent::__construct($logToFileFilename, $fileFormatter, $screenFormatter, @@ -79,97 +79,3 @@ class Error extends Log } } -/** - * Format an error event to be displayed on the screen. - * - * @package Piwik - * @subpackage Log - */ -class Error_Formatter_ScreenFormatter extends Formatter_ScreenFormatter -{ - /** - * Formats data into a single line to be written by the writer. - * - * @param array $event event data - * @return string formatted line to write to the log - */ - public function format($event) - { - $event = parent::formatEvent($event); - - $errno = $event['errno']; - $errstr = $event['message']; - $errfile = $event['errfile']; - $errline = $event['errline']; - $backtrace = $event['backtrace']; - - $strReturned = ''; - $errno = $errno & error_reporting(); - - // problem when using error_reporting with the @ silent fail operator - // it gives an errno 0, and in this case the objective is to NOT display anything on the screen! - // is there any other case where the errno is zero at this point? - if ($errno == 0) return ''; - $strReturned .= "\n<div style='word-wrap: break-word; border: 3px solid red; padding:4px; width:70%; background-color:#FFFF96;'> - <strong>There is an error. Please report the message (Piwik " . (class_exists('Piwik\Version') ? Piwik_Version::VERSION : '') . ") - and full backtrace in the <a href='?module=Proxy&action=redirect&url=http://forum.piwik.org' target='_blank'>Piwik forums</a> (please do a Search first as it might have been reported already!).<br /><br/> - "; - switch ($errno) { - case E_ERROR: - $strReturned .= "Error"; - break; - case E_WARNING: - $strReturned .= "Warning"; - break; - case E_PARSE: - $strReturned .= "Parse Error"; - break; - case E_NOTICE: - $strReturned .= "Notice"; - break; - case E_CORE_ERROR: - $strReturned .= "Core Error"; - break; - case E_CORE_WARNING: - $strReturned .= "Core Warning"; - break; - case E_COMPILE_ERROR: - $strReturned .= "Compile Error"; - break; - case E_COMPILE_WARNING: - $strReturned .= "Compile Warning"; - break; - case E_USER_ERROR: - $strReturned .= "User Error"; - break; - case E_USER_WARNING: - $strReturned .= "User Warning"; - break; - case E_USER_NOTICE: - $strReturned .= "User Notice"; - break; - case E_STRICT: - $strReturned .= "Strict Notice"; - break; - case E_RECOVERABLE_ERROR: - $strReturned .= "Recoverable Error"; - break; - case E_DEPRECATED: - $strReturned .= "Deprecated"; - break; - case E_USER_DEPRECATED: - $strReturned .= "User Deprecated"; - break; - default: - $strReturned .= "Unknown error ($errno)"; - break; - } - $strReturned .= ":</strong> <i>$errstr</i> in <b>$errfile</b> on line <b>$errline</b>\n"; - $strReturned .= "<br /><br />Backtrace --><div style=\"font-family:Courier;font-size:10pt\">"; - $strReturned .= str_replace(array("\n", '#'), array("<br />\n", "<br />\n#"), $backtrace); - $strReturned .= "</div><br />"; - $strReturned .= "\n </pre></div><br />"; - - return parent::format($strReturned); - } -} diff --git a/core/Log/Exception.php b/core/Log/Exception.php index 2e7bb34bb4..58a9881dda 100644 --- a/core/Log/Exception.php +++ b/core/Log/Exception.php @@ -39,8 +39,8 @@ class Exception extends Log 'errfile' => 'errfile', 'backtrace' => 'backtrace' ); - $screenFormatter = new Exception_Formatter_ScreenFormatter(); - $fileFormatter = new Formatter_FileFormatter(); + $screenFormatter = new ExceptionScreenFormatter(); + $fileFormatter = new FileFormatter(); parent::__construct($logToFileFilename, $fileFormatter, @@ -65,7 +65,7 @@ class Exception extends Log * * @param Exception $exception */ - public function logEvent($exception) + public function logEvent(\Exception $exception) { $event = array(); $event['errno'] = $exception->getCode(); @@ -77,29 +77,3 @@ class Exception extends Log parent::log($event, Log::CRIT, null); } } - -/** - * Format an exception event to be displayed on the screen. - * - * @package Piwik - * @subpackage Log - */ -class Exception_Formatter_ScreenFormatter extends Formatter_ScreenFormatter -{ - /** - * Formats data into a single line to be written by the writer. - * - * @param array $event event data - * @return string formatted line to write to the log - */ - public function format($event) - { - $event = parent::formatEvent($event); - $errstr = $event['message']; - - $outputFormat = strtolower(Common::getRequestVar('format', 'html', 'string')); - $response = new Piwik_API_ResponseBuilder($outputFormat); - $message = $response->getResponseException(new \Exception($errstr)); - return parent::format($message); - } -} diff --git a/core/Log/Formatter.php b/core/Log/FileFormatter.php index 3fa7c3d803..960c67a260 100644 --- a/core/Log/Formatter.php +++ b/core/Log/FileFormatter.php @@ -9,12 +9,13 @@ * @package Piwik */ namespace Piwik\Log; +use Piwik\Common; /** * @package Piwik * @subpackage Log */ -class Formatter_FileFormatter implements \Zend_Log_Formatter_Interface +class FileFormatter implements \Zend_Log_Formatter_Interface { /** * Formats data into a single line to be written by the writer. @@ -33,30 +34,3 @@ class Formatter_FileFormatter implements \Zend_Log_Formatter_Interface return $ts . ' ' . implode(" ", $event) . "\n"; } } - -/** - * - * @package Piwik - * @subpackage Log - */ -class Formatter_ScreenFormatter implements \Zend_Log_Formatter_Interface -{ - function formatEvent($event) - { - // no injection in error messages, backtrace when displayed on screen - return array_map(array('Piwik\Common', 'sanitizeInputValue'), $event); - } - - function format($string) - { - return self::getFormattedString($string); - } - - static public function getFormattedString($string) - { - if (!Common::isPhpCliMode()) { - @header('Content-Type: text/html; charset=utf-8'); - } - return $string; - } -}
\ No newline at end of file diff --git a/core/Log/Message.php b/core/Log/Message.php index 26acec5348..e6311c1d6e 100644 --- a/core/Log/Message.php +++ b/core/Log/Message.php @@ -14,43 +14,6 @@ use Piwik\Common; use Piwik\Log; /** - * Format a standard message event to be displayed on the screen. - * The message can be a PHP array or a string. - * - * @package Piwik - * @subpackage Log - */ -class Message_Formatter_ScreenFormatter extends Formatter_ScreenFormatter -{ - /** - * Formats data into a single line to be written by the writer. - * - * @param array $event event data - * @return string formatted line to write to the log - */ - public function format($event) - { - if (is_array($event['message'])) { - $message = "<pre>" . var_export($event['message'], true) . "</pre>"; - } else { - $message = $event['message']; - } - if (!Common::isPhpCliMode()) { - $message .= "<br/>"; - } - $message .= "\n"; - - $memory = ''; - // Hacky: let's hide the memory usage in CLI to hide from the archive.php output - if (!Common::isPhpCliMode()) { - $memory = '[' . Piwik::getMemoryUsage() . '] '; - } - $message = '[' . $event['timestamp'] . '] [' . $event['requestKey'] . '] ' . $memory . $message; - return parent::format($message); - } -} - -/** * Class used to log a standard message event. * * @package Piwik @@ -71,8 +34,8 @@ class Message extends Log 'message' => 'message', 'timestamp' => 'timestamp' ); - $screenFormatter = new Log\Message_Formatter_ScreenFormatter(); - $fileFormatter = new Formatter_FileFormatter(); + $screenFormatter = new MessageScreenFormatter(); + $fileFormatter = new FileFormatter(); parent::__construct($logToFileFilename, $fileFormatter, diff --git a/core/Piwik.php b/core/Piwik.php index 97ad1c97bb..3b656fbcc3 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -1003,13 +1003,13 @@ class Piwik // - Tracker request, and debug disabled, // - and some scheduled tasks call code that tries and log something try { - Zend_Registry::get('logger_message'); + \Zend_Registry::get('logger_message'); } catch (Exception $e) { self::$shouldLog = false; } } if (self::$shouldLog) { - Zend_Registry::get('logger_message')->logEvent($message); + \Zend_Registry::get('logger_message')->logEvent($message); } } @@ -1069,7 +1069,7 @@ class Piwik */ static public function getQueryCount() { - $profiler = Zend_Registry::get('db')->getProfiler(); + $profiler = \Zend_Registry::get('db')->getProfiler(); return $profiler->getTotalNumQueries(); } @@ -1080,7 +1080,7 @@ class Piwik */ static public function getDbElapsedSecs() { - $profiler = Zend_Registry::get('db')->getProfiler(); + $profiler = \Zend_Registry::get('db')->getProfiler(); return $profiler->getTotalElapsedSecs(); } @@ -1136,7 +1136,7 @@ class Piwik */ static function printSqlProfilingReportZend() { - $profiler = Zend_Registry::get('db')->getProfiler(); + $profiler = \Zend_Registry::get('db')->getProfiler(); if (!$profiler->getEnabled()) { throw new Exception("To display the profiler you should enable enable_sql_profiler on your config/config.ini.php file"); @@ -1220,7 +1220,7 @@ class Piwik static public function printMemoryLeak($prefix = '', $suffix = '<br />') { echo $prefix; - echo Zend_Registry::get('timer')->getMemoryLeak(); + echo \Zend_Registry::get('timer')->getMemoryLeak(); echo $suffix; } @@ -1830,7 +1830,7 @@ class Piwik */ static public function getLoginPluginName() { - return Zend_Registry::get('auth')->getName(); + return \Zend_Registry::get('auth')->getName(); } /** @@ -1928,7 +1928,7 @@ class Piwik $adapter = $dbInfos['adapter']; $db = @Adapter::factory($adapter, $dbInfos); } - Zend_Registry::set('db', $db); + \Zend_Registry::set('db', $db); } /** @@ -1936,7 +1936,7 @@ class Piwik */ static public function disconnectDatabase() { - Zend_Registry::get('db')->closeConnection(); + \Zend_Registry::get('db')->closeConnection(); } /** @@ -1949,7 +1949,7 @@ class Piwik */ static public function checkDatabaseVersion() { - Zend_Registry::get('db')->checkServerVersion(); + \Zend_Registry::get('db')->checkServerVersion(); } /** @@ -1959,7 +1959,7 @@ class Piwik */ static public function isDatabaseConnectionUTF8() { - return Zend_Registry::get('db')->isConnectionUTF8(); + return \Zend_Registry::get('db')->isConnectionUTF8(); } /* diff --git a/core/ReportRenderer.php b/core/ReportRenderer.php index 7f8e959c74..036ef72042 100644 --- a/core/ReportRenderer.php +++ b/core/ReportRenderer.php @@ -54,7 +54,7 @@ abstract class ReportRenderer static public function factory($rendererType) { $name = ucfirst(strtolower($rendererType)); - $className = 'Piwik_ReportRenderer_' . $name; + $className = 'Piwik\ReportRenderer\\' . $name; try { Loader::loadClass($className); diff --git a/core/Session.php b/core/Session.php index dcbd327562..5286d02bd3 100644 --- a/core/Session.php +++ b/core/Session.php @@ -98,7 +98,7 @@ class Session extends Zend_Session // - user - we can't verify that user-defined session handler functions have already been set via session_set_save_handler() // - mm - this handler is not recommended, unsupported, not available for Windows, and has a potential concurrency issue - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); $config = array( 'name' => Common::prefixTable('session'), diff --git a/core/Tracker.php b/core/Tracker.php index aca7ee28eb..0f8185a438 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -360,7 +360,7 @@ class Tracker $config = Config::getInstance(); try { - $db = Zend_Registry::get('db'); + $db = \Zend_Registry::get('db'); } catch (Exception $e) { Piwik::createDatabaseObject(); } diff --git a/core/Updater.php b/core/Updater.php index a0000eeb55..1da4f30a44 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -8,6 +8,8 @@ * @category Piwik * @package Piwik */ +namespace Piwik; + use Piwik\Common; use Piwik\Version; @@ -147,7 +149,7 @@ class Updater * Update the named component * * @param string $componentName 'core', or plugin name - * @throws Exception|Piwik_Updater_UpdateErrorException + * @throws Exception|Updater_UpdateErrorException * @return array of warning strings if applicable */ public function update($componentName) @@ -163,7 +165,7 @@ class Updater } $this->recordComponentSuccessfullyUpdated($componentName, $fileVersion); - } catch (Piwik_Updater_UpdateErrorException $e) { + } catch (Updater_UpdateErrorException $e) { throw $e; } catch (Exception $e) { $warningMessages[] = $e->getMessage(); @@ -278,7 +280,7 @@ class Updater * * @param string $file Update script filename * @param array $sqlarray An array of SQL queries to be executed - * @throws Piwik_Updater_UpdateErrorException + * @throws Updater_UpdateErrorException */ static function updateDatabase($file, $sqlarray) { @@ -290,7 +292,7 @@ class Updater || !Zend_Registry::get('db')->isErrNo($e, $ignoreError) ) { $message = $file . ":\nError trying to execute the query '" . $update . "'.\nThe error was: " . $e->getMessage(); - throw new Piwik_Updater_UpdateErrorException($message); + throw new Updater_UpdateErrorException($message); } } } @@ -303,6 +305,6 @@ class Updater * @package Piwik * @subpackage Updater */ -class Piwik_Updater_UpdateErrorException extends Exception +class Updater_UpdateErrorException extends \Exception { } diff --git a/core/Updates/0.2.10.php b/core/Updates/0.2.10.php index da9a669abd..588c3f98ff 100644 --- a/core/Updates/0.2.10.php +++ b/core/Updates/0.2.10.php @@ -10,7 +10,7 @@ */ use Piwik\Piwik; use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -52,7 +52,7 @@ class Piwik_Updates_0_2_10 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); $obsoleteFile = '/plugins/ExamplePlugin/API.php'; if (file_exists(PIWIK_INCLUDE_PATH . $obsoleteFile)) { diff --git a/core/Updates/0.2.12.php b/core/Updates/0.2.12.php index 54b4dd41f8..fc7d81df47 100644 --- a/core/Updates/0.2.12.php +++ b/core/Updates/0.2.12.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -33,6 +33,6 @@ class Piwik_Updates_0_2_12 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.2.13.php b/core/Updates/0.2.13.php index 0cf92efc3d..3b0b91f261 100644 --- a/core/Updates/0.2.13.php +++ b/core/Updates/0.2.13.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -33,6 +33,6 @@ class Piwik_Updates_0_2_13 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.2.24.php b/core/Updates/0.2.24.php index f98c46fba6..f1b23721e6 100644 --- a/core/Updates/0.2.24.php +++ b/core/Updates/0.2.24.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -31,6 +31,6 @@ class Piwik_Updates_0_2_24 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.2.27.php b/core/Updates/0.2.27.php index a53430d182..63b8c4ed0e 100644 --- a/core/Updates/0.2.27.php +++ b/core/Updates/0.2.27.php @@ -10,7 +10,7 @@ */ use Piwik\Piwik; use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -76,6 +76,6 @@ class Piwik_Updates_0_2_27 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.2.32.php b/core/Updates/0.2.32.php index d80b2826a9..2ebb93c343 100644 --- a/core/Updates/0.2.32.php +++ b/core/Updates/0.2.32.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -34,6 +34,6 @@ class Piwik_Updates_0_2_32 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.2.33.php b/core/Updates/0.2.33.php index b871521187..669ee051f6 100644 --- a/core/Updates/0.2.33.php +++ b/core/Updates/0.2.33.php @@ -10,7 +10,7 @@ */ use Piwik\Piwik; use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -40,6 +40,6 @@ class Piwik_Updates_0_2_33 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.2.35.php b/core/Updates/0.2.35.php index 23800f8404..dba6e79da7 100644 --- a/core/Updates/0.2.35.php +++ b/core/Updates/0.2.35.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -27,6 +27,6 @@ class Piwik_Updates_0_2_35 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.2.37.php b/core/Updates/0.2.37.php index be90976039..fa129fc550 100644 --- a/core/Updates/0.2.37.php +++ b/core/Updates/0.2.37.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -28,6 +28,6 @@ class Piwik_Updates_0_2_37 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.4.1.php b/core/Updates/0.4.1.php index 4fa7ee8035..a74421a722 100644 --- a/core/Updates/0.4.1.php +++ b/core/Updates/0.4.1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -29,6 +29,6 @@ class Piwik_Updates_0_4_1 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.4.2.php b/core/Updates/0.4.2.php index a52b4a181a..c9660a0e03 100644 --- a/core/Updates/0.4.2.php +++ b/core/Updates/0.4.2.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -33,6 +33,6 @@ class Piwik_Updates_0_4_2 extends Updates // when restoring (possibly) previousy dropped columns, ignore mysql code error 1060: duplicate column static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.4.php b/core/Updates/0.4.php index 048de15e25..82c7b928da 100644 --- a/core/Updates/0.4.php +++ b/core/Updates/0.4.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -34,6 +34,6 @@ class Piwik_Updates_0_4 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.5.4.php b/core/Updates/0.5.4.php index a0ce6d61b5..4fb0ef8488 100644 --- a/core/Updates/0.5.4.php +++ b/core/Updates/0.5.4.php @@ -10,7 +10,7 @@ */ use Piwik\Config; use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -41,7 +41,7 @@ class Piwik_Updates_0_5_4 extends Updates throw new Exception('mandatory update failed'); } } catch (Exception $e) { - throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = $salt</code>"); + throw new Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[superuser]</code> the following line: <br /><code>salt = $salt</code>"); } } @@ -60,6 +60,6 @@ class Piwik_Updates_0_5_4 extends Updates } } - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.5.5.php b/core/Updates/0.5.5.php index cf1c287160..52c0075e17 100644 --- a/core/Updates/0.5.5.php +++ b/core/Updates/0.5.5.php @@ -10,7 +10,7 @@ */ use Piwik\Piwik; use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -40,7 +40,7 @@ class Piwik_Updates_0_5_5 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.5.php b/core/Updates/0.5.php index 01f52ba549..1a707809e1 100644 --- a/core/Updates/0.5.php +++ b/core/Updates/0.5.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -35,6 +35,6 @@ class Piwik_Updates_0_5 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.6-rc1.php b/core/Updates/0.6-rc1.php index b2c27728f7..1e2fa17ffe 100644 --- a/core/Updates/0.6-rc1.php +++ b/core/Updates/0.6-rc1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -54,7 +54,7 @@ class Piwik_Updates_0_6_rc1 extends Updates } // Run the SQL - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); // Outputs warning message, pointing users to the plugin download page if (!empty($disabledPlugins)) { diff --git a/core/Updates/0.6.3.php b/core/Updates/0.6.3.php index 8353628267..f2c4ed9f6a 100644 --- a/core/Updates/0.6.3.php +++ b/core/Updates/0.6.3.php @@ -10,7 +10,7 @@ */ use Piwik\Config; use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -42,10 +42,10 @@ class Piwik_Updates_0_6_3 extends Updates throw new Exception('mandatory update failed'); } } catch (Exception $e) { - throw new Piwik_Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>"); + throw new Updater_UpdateErrorException("Please edit your config/config.ini.php file and add below <code>[database]</code> the following line: <br /><code>schema = Myisam</code>"); } } - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.7.php b/core/Updates/0.7.php index ed132626c0..0cbcfb89f1 100644 --- a/core/Updates/0.7.php +++ b/core/Updates/0.7.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -27,6 +27,6 @@ class Piwik_Updates_0_7 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/0.9.1.php b/core/Updates/0.9.1.php index 526c365e76..934164fa1a 100644 --- a/core/Updates/0.9.1.php +++ b/core/Updates/0.9.1.php @@ -10,7 +10,7 @@ */ use Piwik\Piwik; use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -51,7 +51,7 @@ class Piwik_Updates_0_9_1 extends Updates static function update() { if (Piwik::isTimezoneSupportEnabled()) { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } } diff --git a/core/Updates/1.10.2-b1.php b/core/Updates/1.10.2-b1.php index 70a5b906cf..02df09fc16 100755 --- a/core/Updates/1.10.2-b1.php +++ b/core/Updates/1.10.2-b1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -28,6 +28,6 @@ class Piwik_Updates_1_10_2_b1 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.10.2-b2.php b/core/Updates/1.10.2-b2.php index 40b048e27c..b2ad85fb0e 100644 --- a/core/Updates/1.10.2-b2.php +++ b/core/Updates/1.10.2-b2.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -28,6 +28,6 @@ class Piwik_Updates_1_10_2_b2 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.12-b1.php b/core/Updates/1.12-b1.php index 3a9b6dd742..6e67fd5da0 100644 --- a/core/Updates/1.12-b1.php +++ b/core/Updates/1.12-b1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -32,7 +32,7 @@ class Piwik_Updates_1_12_b1 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.12-b16.php b/core/Updates/1.12-b16.php index 44819663ba..b7cdddc4ea 100644 --- a/core/Updates/1.12-b16.php +++ b/core/Updates/1.12-b16.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -28,6 +28,6 @@ class Piwik_Updates_1_12_b16 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.2-rc1.php b/core/Updates/1.2-rc1.php index 409e7f7219..cd86d947f2 100644 --- a/core/Updates/1.2-rc1.php +++ b/core/Updates/1.2-rc1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -131,7 +131,7 @@ class Piwik_Updates_1_2_rc1 extends Updates } // Run the SQL - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); // Outputs warning message, pointing users to the plugin download page if (!empty($disabledPlugins)) { diff --git a/core/Updates/1.2.3.php b/core/Updates/1.2.3.php index 56383d84ea..9c6d27ad7f 100644 --- a/core/Updates/1.2.3.php +++ b/core/Updates/1.2.3.php @@ -10,7 +10,7 @@ */ use Piwik\Config; use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -35,7 +35,7 @@ class Piwik_Updates_1_2_3 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.2.5-rc1.php b/core/Updates/1.2.5-rc1.php index a13523927d..f40242b59e 100644 --- a/core/Updates/1.2.5-rc1.php +++ b/core/Updates/1.2.5-rc1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -31,7 +31,7 @@ class Piwik_Updates_1_2_5_rc1 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.2.5-rc7.php b/core/Updates/1.2.5-rc7.php index badfab6eaa..38a3883063 100644 --- a/core/Updates/1.2.5-rc7.php +++ b/core/Updates/1.2.5-rc7.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -27,7 +27,7 @@ class Piwik_Updates_1_2_5_rc7 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.4-rc1.php b/core/Updates/1.4-rc1.php index fcc404b06d..b0e723357e 100644 --- a/core/Updates/1.4-rc1.php +++ b/core/Updates/1.4-rc1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -30,7 +30,7 @@ class Piwik_Updates_1_4_rc1 extends Updates static function update() { try { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } catch (Exception $e) { } } diff --git a/core/Updates/1.4-rc2.php b/core/Updates/1.4-rc2.php index 1655a9f1b7..2689146890 100644 --- a/core/Updates/1.4-rc2.php +++ b/core/Updates/1.4-rc2.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -39,6 +39,6 @@ class Piwik_Updates_1_4_rc2 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.5-b1.php b/core/Updates/1.5-b1.php index f3c2cf1a9b..61bf90f2c6 100644 --- a/core/Updates/1.5-b1.php +++ b/core/Updates/1.5-b1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -57,6 +57,6 @@ class Piwik_Updates_1_5_b1 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.5-b2.php b/core/Updates/1.5-b2.php index 7a992f6c18..0ccf93285c 100644 --- a/core/Updates/1.5-b2.php +++ b/core/Updates/1.5-b2.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -36,6 +36,6 @@ class Piwik_Updates_1_5_b2 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.5-b3.php b/core/Updates/1.5-b3.php index 4df144fe5d..908c2fbc6a 100644 --- a/core/Updates/1.5-b3.php +++ b/core/Updates/1.5-b3.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -58,6 +58,6 @@ class Piwik_Updates_1_5_b3 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.5-b4.php b/core/Updates/1.5-b4.php index b4c0b40f47..b7e62178cd 100644 --- a/core/Updates/1.5-b4.php +++ b/core/Updates/1.5-b4.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -27,6 +27,6 @@ class Piwik_Updates_1_5_b4 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.5-b5.php b/core/Updates/1.5-b5.php index d6e2cb9c7c..8fa8c69102 100644 --- a/core/Updates/1.5-b5.php +++ b/core/Updates/1.5-b5.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -32,6 +32,6 @@ class Piwik_Updates_1_5_b5 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.6-b1.php b/core/Updates/1.6-b1.php index ca578ead28..b0cff7f57d 100644 --- a/core/Updates/1.6-b1.php +++ b/core/Updates/1.6-b1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -63,6 +63,6 @@ class Piwik_Updates_1_6_b1 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.7-b1.php b/core/Updates/1.7-b1.php index 015960cb8b..7a9d5f00b3 100644 --- a/core/Updates/1.7-b1.php +++ b/core/Updates/1.7-b1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -30,7 +30,7 @@ class Piwik_Updates_1_7_b1 extends Updates static function update() { try { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } catch (Exception $e) { } } diff --git a/core/Updates/1.7.2-rc5.php b/core/Updates/1.7.2-rc5.php index 72bc715645..85848e0428 100644 --- a/core/Updates/1.7.2-rc5.php +++ b/core/Updates/1.7.2-rc5.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -28,7 +28,7 @@ class Piwik_Updates_1_7_2_rc5 extends Updates static function update() { try { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } catch (Exception $e) { } } diff --git a/core/Updates/1.7.2-rc7.php b/core/Updates/1.7.2-rc7.php index 4649c89a21..42a3234d12 100755 --- a/core/Updates/1.7.2-rc7.php +++ b/core/Updates/1.7.2-rc7.php @@ -9,8 +9,9 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; +use Piwik\Db; /** * @package Updates @@ -37,7 +38,7 @@ class Piwik_Updates_1_7_2_rc7 extends Updates $layout = str_replace("\\\"", "\"", $layout); Db::query('UPDATE `' . Common::prefixTable('user_dashboard') . '` SET layout = ? WHERE iddashboard = ? AND login = ?', array($layout, $idDashboard, $login)); } - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } catch (Exception $e) { } } diff --git a/core/Updates/1.8.3-b1.php b/core/Updates/1.8.3-b1.php index a991ac1f2d..84d9ce56d5 100644 --- a/core/Updates/1.8.3-b1.php +++ b/core/Updates/1.8.3-b1.php @@ -9,8 +9,9 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; +use Piwik\Db; /** * @package Updates @@ -44,7 +45,7 @@ class Piwik_Updates_1_8_3_b1 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); if (!\Piwik\PluginsManager::getInstance()->isPluginLoaded('PDFReports')) { return; } diff --git a/core/Updates/1.8.4-b1.php b/core/Updates/1.8.4-b1.php index 8a4d066165..01ab183671 100644 --- a/core/Updates/1.8.4-b1.php +++ b/core/Updates/1.8.4-b1.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -180,7 +180,7 @@ class Piwik_Updates_1_8_4_b1 extends Updates { try { self::enableMaintenanceMode(); - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); self::disableMaintenanceMode(); } catch (Exception $e) { self::disableMaintenanceMode(); diff --git a/core/Updates/1.9-b16.php b/core/Updates/1.9-b16.php index 7b362e0a5c..dcbecc25b1 100755 --- a/core/Updates/1.9-b16.php +++ b/core/Updates/1.9-b16.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -48,7 +48,7 @@ class Piwik_Updates_1_9_b16 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/Updates/1.9-b19.php b/core/Updates/1.9-b19.php index 80e62a39f1..8933e46c95 100755 --- a/core/Updates/1.9-b19.php +++ b/core/Updates/1.9-b19.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -31,7 +31,7 @@ class Piwik_Updates_1_9_b19 extends Updates static function update() { - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); try { diff --git a/core/Updates/1.9-b9.php b/core/Updates/1.9-b9.php index d5fd876b1f..1f2fd7f6a0 100755 --- a/core/Updates/1.9-b9.php +++ b/core/Updates/1.9-b9.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -46,7 +46,7 @@ class Piwik_Updates_1_9_b9 extends Updates { try { self::enableMaintenanceMode(); - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); self::disableMaintenanceMode(); } catch (Exception $e) { self::disableMaintenanceMode(); diff --git a/core/Updates/1.9.1-b2.php b/core/Updates/1.9.1-b2.php index cff70446f8..f6c5642154 100644 --- a/core/Updates/1.9.1-b2.php +++ b/core/Updates/1.9.1-b2.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -27,7 +27,7 @@ class Piwik_Updates_1_9_1_b2 extends Updates static function update() { // manually remove ExampleFeedburner column - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); // remove ExampleFeedburner plugin $pluginToDelete = 'ExampleFeedburner'; diff --git a/core/Updates/1.9.3-b8.php b/core/Updates/1.9.3-b8.php index c961a189a6..19954482ba 100755 --- a/core/Updates/1.9.3-b8.php +++ b/core/Updates/1.9.3-b8.php @@ -9,7 +9,7 @@ * @package Updates */ use Piwik\Common; -use Piwik\Piwik_Updater; +use Piwik\Updater; use Piwik\Updates; /** @@ -29,6 +29,6 @@ class Piwik_Updates_1_9_3_b8 extends Updates static function update() { // add excluded_user_agents column to site table - Piwik_Updater::updateDatabase(__FILE__, self::getSql()); + Updater::updateDatabase(__FILE__, self::getSql()); } } diff --git a/core/View.php b/core/View.php index 7b5ea6d073..3d5c68b736 100644 --- a/core/View.php +++ b/core/View.php @@ -135,7 +135,7 @@ class View implements Piwik_View_Interface } try { - $this->totalTimeGeneration = Zend_Registry::get('timer')->getTime(); + $this->totalTimeGeneration = \Zend_Registry::get('timer')->getTime(); $this->totalNumberOfQueries = Piwik::getQueryCount(); } catch (Exception $e) { $this->totalNumberOfQueries = 0; |