From eda8255e31a960b911f5eee89a174fb8b4fc39f2 Mon Sep 17 00:00:00 2001 From: sgiehl <stefangiehl@gmail.com> Date: Sat, 26 May 2012 14:18:57 +0000 Subject: [PATCH] moved Piwik_Db_Adapter_Interface to its own file git-svn-id: http://dev.piwik.org/svn/trunk@6321 59fd770c-687e-43c8-a1e3-f5a4ff64c105 --- core/Db/Adapter.php | 63 ----------------------------- core/Db/Adapter/Interface.php | 74 +++++++++++++++++++++++++++++++++++ core/Plugin.php | 4 +- plugins/Actions/Actions.php | 21 ++++++++-- 4 files changed, 94 insertions(+), 68 deletions(-) create mode 100644 core/Db/Adapter/Interface.php diff --git a/core/Db/Adapter.php b/core/Db/Adapter.php index 26c796cac9..88c4ba2df2 100644 --- a/core/Db/Adapter.php +++ b/core/Db/Adapter.php @@ -128,66 +128,3 @@ class Piwik_Db_Adapter return $adapters; } } - -/** - * @package Piwik - * @subpackage Piwik_Db - */ -interface Piwik_Db_Adapter_Interface -{ - /** - * Reset the configuration variables in this adapter. - */ - public function resetConfig(); - - /** - * Return default port. - * - * @return int - */ - public static function getDefaultPort(); - - /** - * Check database server version - * - * @throws Exception if database version is less than required version - */ - public function checkServerVersion(); - - /** - * Returns true if this adapter's required extensions are enabled - * - * @return bool - */ - public static function isEnabled(); - - /** - * Returns true if this adapter supports blobs as fields - * - * @return bool - */ - public function hasBlobDataType(); - - /** - * Returns true if this adapter supports bulk loading - * - * @return bool - */ - public function hasBulkLoader(); - - /** - * Test error number - * - * @param Exception $e - * @param string $errno - * @return bool - */ - public function isErrNo($e, $errno); - - /** - * Is the connection character set equal to utf8? - * - * @return bool - */ - public function isConnectionUTF8(); -} diff --git a/core/Db/Adapter/Interface.php b/core/Db/Adapter/Interface.php new file mode 100644 index 0000000000..8bde7c024c --- /dev/null +++ b/core/Db/Adapter/Interface.php @@ -0,0 +1,74 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * @version $Id: Adapter.php 6109 2012-03-24 11:49:29Z vipsoft $ + * + * @category Piwik + * @package Piwik + */ + +/** + * @package Piwik + * @subpackage Piwik_Db + */ +interface Piwik_Db_Adapter_Interface +{ + /** + * Reset the configuration variables in this adapter. + */ + public function resetConfig(); + + /** + * Return default port. + * + * @return int + */ + public static function getDefaultPort(); + + /** + * Check database server version + * + * @throws Exception if database version is less than required version + */ + public function checkServerVersion(); + + /** + * Returns true if this adapter's required extensions are enabled + * + * @return bool + */ + public static function isEnabled(); + + /** + * Returns true if this adapter supports blobs as fields + * + * @return bool + */ + public function hasBlobDataType(); + + /** + * Returns true if this adapter supports bulk loading + * + * @return bool + */ + public function hasBulkLoader(); + + /** + * Test error number + * + * @param Exception $e + * @param string $errno + * @return bool + */ + public function isErrNo($e, $errno); + + /** + * Is the connection character set equal to utf8? + * + * @return bool + */ + public function isConnectionUTF8(); +} diff --git a/core/Plugin.php b/core/Plugin.php index d2de582cda..9770523f73 100644 --- a/core/Plugin.php +++ b/core/Plugin.php @@ -30,13 +30,13 @@ abstract class Piwik_Plugin * - 'translationAvailable' => bool // is there a translation file in plugins/your-plugin/lang/* ? * - 'TrackerPlugin' => bool // should we load this plugin during the stats logging process? */ - abstract function getInformation(); + abstract public function getInformation(); /** * Returns the list of hooks registered with the methods names * @return array */ - function getListHooksRegistered() + public function getListHooksRegistered() { return array(); } diff --git a/plugins/Actions/Actions.php b/plugins/Actions/Actions.php index 9e9f279515..7f132494d7 100644 --- a/plugins/Actions/Actions.php +++ b/plugins/Actions/Actions.php @@ -39,7 +39,7 @@ class Piwik_Actions extends Piwik_Plugin return $info; } - function getListHooksRegistered() + public function getListHooksRegistered() { $hooks = array( 'ArchiveProcessing_Day.compute' => 'archiveDay', @@ -568,7 +568,17 @@ class Piwik_Actions extends Piwik_Plugin // Record the final datasets $this->archiveDayRecordInDatabase($archiveProcessing); } - + + /** + * @param $select + * @param $from + * @param $where + * @param $orderBy + * @param $groupBy + * @param $sprintfField + * @param Piwik_ArchiveProcessing $archiveProcessing + * @return int + */ protected function archiveDayQueryProcess($select, $from, $where, $orderBy, $groupBy, $sprintfField, $archiveProcessing) { @@ -760,7 +770,12 @@ class Piwik_Actions extends Piwik_Plugin const CACHE_PARSED_INDEX_NAME = 0; const CACHE_PARSED_INDEX_TYPE = 1; static $cacheParsedAction = array(); - + + /** + * @param Zend_Db_Statement|PDOStatement $query + * @param string|bool $fieldQueried + * @return int + */ protected function updateActionsTableWithRowQuery($query, $fieldQueried = false) { $rowsProcessed = 0; -- GitLab