diff --git a/core/Columns/Dimension.php b/core/Columns/Dimension.php new file mode 100644 index 0000000000000000000000000000000000000000..26ede26f723ceeb7662933724f33bea9ede8cbbc --- /dev/null +++ b/core/Columns/Dimension.php @@ -0,0 +1,76 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Columns; + +use Piwik\Plugin\Segment; +use Piwik\Translate; + +/** + * @api + * @since 2.5.0 + */ +abstract class Dimension +{ + protected $name; + protected $columnName = ''; + protected $columnType = ''; + protected $segments = array(); + + protected function configureSegments() + { + + } + + public function getVersion() + { + $reflectionClass = new \ReflectionObject($this); + $file = $reflectionClass->getFileName(); + + return filemtime($file); + } + + public function hasImplementedEvent($method) + { + $reflectionObject = new \ReflectionObject($this); + $declaringClass = $reflectionObject->getMethod($method)->getDeclaringClass(); + + return 0 === strpos($declaringClass->name, 'Piwik\Plugins'); + } + + protected function addSegment(Segment $segment) + { + $type = $segment->getType(); + + if (empty($type)) { + $segment->setType(Segment::TYPE_DIMENSION); + } + + $this->segments[] = $segment; + } + + /** + * @return Segment[] + */ + public function getSegments() + { + if (empty($this->segments)) { + $this->configureSegments(); + } + + return $this->segments; + } + + public function getColumnName() + { + return $this->columnName; + } + + abstract public function getName(); + +} diff --git a/core/Columns/Updates.php b/core/Columns/Updates.php new file mode 100644 index 0000000000000000000000000000000000000000..30cfa017cdbf71e98ac8a16cf120c2a80d33a195 --- /dev/null +++ b/core/Columns/Updates.php @@ -0,0 +1,110 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Columns; +use Piwik\Common; +use Piwik\DbHelper; +use Piwik\Plugin\ActionDimension; +use Piwik\Plugin\VisitDimension; +use Piwik\Db; +use Piwik\Updater; + +/** + * Class that handles dimension updates + */ +class Updates extends \Piwik\Updates +{ + /** + * Return SQL to be executed in this update + * + * @return array( + * 'ALTER .... ' => '1234', // if the query fails, it will be ignored if the error code is 1234 + * 'ALTER .... ' => false, // if an error occurs, the update will stop and fail + * // and user will have to manually run the query + * ) + */ + public static function getSql() + { + $sqls = array(); + + $changingColumns = self::getUpdates(); + + foreach ($changingColumns as $table => $columns) { + $sqls["ALTER TABLE `" . $table . "` " . implode(', ', $columns)] = false; + } + + return $sqls; + } + + /** + * Incremental version update + */ + public static function update() + { + foreach (self::getSql() as $sql => $errorCode) { + try { + Db::exec($sql); + } catch (\Exception $e) { + if (!Db::get()->isErrNo($e, '1091') && !Db::get()->isErrNo($e, '1060')) { + Updater::handleQueryError($e, $sql, false, __FILE__); + } + } + } + } + + private static function getUpdates() + { + $visitColumns = DbHelper::getTableColumns(Common::prefixTable('log_visit')); + $actionColumns = DbHelper::getTableColumns(Common::prefixTable('log_link_visit_action')); + $conversionColumns = DbHelper::getTableColumns(Common::prefixTable('log_conversion')); + + $changingColumns = array(); + + foreach (VisitDimension::getAllDimensions() as $dimension) { + $columns = $dimension->install($visitColumns, $conversionColumns); + if (!empty($columns)) { + foreach ($columns as $table => $col) { + if (empty($changingColumns[$table])) { + $changingColumns[$table] = $col; + } else { + $changingColumns[$table] = array_merge($changingColumns[$table], $col); + } + } + } + } + + foreach (ActionDimension::getAllDimensions() as $dimension) { + $columns = $dimension->install($actionColumns); + if (!empty($columns)) { + foreach ($columns as $table => $col) { + if (empty($changingColumns[$table])) { + $changingColumns[$table] = $col; + } else { + $changingColumns[$table] = array_merge($changingColumns[$table], $col); + } + } + } + } + + return $changingColumns; + } + + public static function hasUpdates() + { + $changingColumns = self::getUpdates(); + + foreach ($changingColumns as $table => $columns) { + if (!empty($columns)) { + return true; + } + } + + return false; + } + +} diff --git a/core/Db/Schema.php b/core/Db/Schema.php index 834dfdda36617d538d007c3f5f4bd626f2a680f2..5c0e9ada1ba89dfed3c2b057917b50d3cb31f5db 100644 --- a/core/Db/Schema.php +++ b/core/Db/Schema.php @@ -233,6 +233,17 @@ class Schema extends Singleton return $this->getSchema()->getTablesInstalled($forceReload); } + /** + * Get list of installed columns in a table + * + * @param string $tableName The name of a table. + * @return array Column names installed + */ + public function getTableColumns($tableName) + { + return $this->getSchema()->getTableColumns($tableName); + } + /** * Returns true if Piwik tables exist * diff --git a/core/Db/Schema/Mysql.php b/core/Db/Schema/Mysql.php index 752163408003fee10fad9b340b1d850408f345c5..cb055e5354e9bcc27e68e8a9f0ad1cec77d3c6ed 100644 --- a/core/Db/Schema/Mysql.php +++ b/core/Db/Schema/Mysql.php @@ -315,6 +315,26 @@ class Mysql implements SchemaInterface private $tablesInstalled = null; + /** + * Get list of installed columns in a table + * + * @param string $tableName The name of a table. + * @return array Column names installed + */ + public function getTableColumns($tableName) + { + $db = Db::get(); + + $allColumns = $db->fetchAll("SHOW COLUMNS FROM . $tableName"); + + $fields = array(); + foreach ($allColumns as $column) { + $fields[] = $column['Field']; + } + + return $fields; + } + /** * Get list of tables installed * diff --git a/core/Db/SchemaInterface.php b/core/Db/SchemaInterface.php index a8a3771ac5a3f4ef8f612446640aa4f45a250cb7..eead12a87acb17069880845727e6b1564f9d6baa 100644 --- a/core/Db/SchemaInterface.php +++ b/core/Db/SchemaInterface.php @@ -87,6 +87,14 @@ interface SchemaInterface */ public function getTablesInstalled($forceReload = true); + /** + * Get list of installed columns in a table + * + * @param string $tableName The name of a table. + * @return array Column names installed + */ + public function getTableColumns($tableName); + /** * Checks whether any table exists * diff --git a/core/DbHelper.php b/core/DbHelper.php index df616b2cd6c38b02c67bd066c60cc64a84c08d3e..3fc6b482fc55aea86a95d038c9b3381a5a2dc9ab 100644 --- a/core/DbHelper.php +++ b/core/DbHelper.php @@ -28,6 +28,17 @@ class DbHelper return Schema::getInstance()->getTablesInstalled($forceReload); } + /** + * Get list of installed columns in a table + * + * @param string $tableName The name of a table. + * @return array Column names installed + */ + public static function getTableColumns($tableName) + { + return Schema::getInstance()->getTableColumns($tableName); + } + /** * Creates a new table in the database. * diff --git a/core/Plugin/ActionDimension.php b/core/Plugin/ActionDimension.php index 05107382ff957eb2970cb9a08683bfb2e4bc15dc..2de05c3ee5dd9bcb740edf2d8891cda940984c96 100644 --- a/core/Plugin/ActionDimension.php +++ b/core/Plugin/ActionDimension.php @@ -9,6 +9,7 @@ namespace Piwik\Plugin; use Piwik\Cache\PluginAwareStaticCache; +use Piwik\Columns\Dimension; use Piwik\Plugin\Manager as PluginManager; use Piwik\Common; use Piwik\Db; @@ -21,57 +22,37 @@ use Piwik\Translate; * @api * @since 2.5.0 */ -abstract class ActionDimension +abstract class ActionDimension extends Dimension { - protected $name; - - protected $fieldName = ''; - protected $fieldType = ''; - - protected $segments = array(); - - protected function configureSegments() - { - - } - - public function install() + public function install($actionColumns) { - if (empty($this->fieldName) || empty($this->fieldType)) { - return; + if (empty($this->columnName)) { + return array(); } - try { - $sql = "ALTER TABLE `" . Common::prefixTable("log_link_visit_action") . "` ADD `$this->fieldName` $this->fieldType"; - Db::exec($sql); + $columnExists = in_array($this->columnName, $actionColumns); - } catch (\Exception $e) { - if (!Db::get()->isErrNo($e, '1060')) { - throw $e; - } + if (!empty($this->columnType) && !$columnExists) { + return array( + Common::prefixTable("log_link_visit_action") => array("ADD COLUMN `$this->columnName` $this->columnType") + ); } + + return array(); } - public function uninstall() + public function uninstall($actionColumns) { - if (empty($this->fieldName) || empty($this->fieldType)) { - return; - } + if (!empty($this->columnName) + && !empty($this->columnType) + && in_array($this->getColumnName(), $actionColumns)) { - try { - $sql = "ALTER TABLE `" . Common::prefixTable("log_link_visit_action") . "` DROP COLUMN `$this->fieldName`"; - Db::exec($sql); - } catch (\Exception $e) { - if (!Db::get()->isErrNo($e, '1091')) { - throw $e; - } + return array( + Common::prefixTable("log_link_visit_action") => array("DROP COLUMN `$this->columnName`") + ); } - } - - public function shouldHandle() - { - return false; + return array(); } /** @@ -86,34 +67,13 @@ abstract class ActionDimension protected function addSegment(Segment $segment) { $sqlSegment = $segment->getSqlSegment(); - if (!empty($this->fieldName) && empty($sqlSegment)) { - $segment->setSqlSegment('log_link_visit_action.' . $this->fieldName); + if (!empty($this->columnName) && empty($sqlSegment)) { + $segment->setSqlSegment('log_link_visit_action.' . $this->columnName); } - $segment->setType(Segment::TYPE_DIMENSION); - - $this->segments[] = $segment; + parent::addSegment($segment); } - /** - * @return Segment[] - */ - public function getSegments() - { - if (empty($this->segments)) { - $this->configureSegments(); - } - - return $this->segments; - } - - public function getFieldName() - { - return $this->fieldName; - } - - abstract public function getName(); - /** @return \Piwik\Plugin\ActionDimension[] */ public static function getAllDimensions() { diff --git a/core/Plugin/Manager.php b/core/Plugin/Manager.php index 653963d5e0ba3e09f85cde452e3347de9fa7ff7c..3bbbf0084f453195265743c231768ca2105900ee 100644 --- a/core/Plugin/Manager.php +++ b/core/Plugin/Manager.php @@ -12,6 +12,7 @@ namespace Piwik\Plugin; use Piwik\Common; use Piwik\Config as PiwikConfig; use Piwik\Config; +use Piwik\Db; use Piwik\EventDispatcher; use Piwik\Filesystem; use Piwik\Option; @@ -435,6 +436,7 @@ class Manager extends Singleton $messages[] = $e->getMessage(); } } + return $messages; } @@ -906,7 +908,6 @@ class Manager extends Singleton $path = self::getPluginsDirectory() . $pluginFileName; - if (!file_exists($path)) { // Create the smallest minimal Piwik Plugin // Eg. Used for Morpheus default theme which does not have a Morpheus.php file @@ -981,19 +982,6 @@ class Manager extends Singleton } catch (\Exception $e) { throw new \Piwik\Plugin\PluginException($plugin->getPluginName(), $e->getMessage()); } - - try { - // todo not sure if this makes sense here - foreach (VisitDimension::getDimensions($plugin) as $dimension) { - $dimension->install(); - } - // todo not sure if this makes sense here - foreach (ActionDimension::getDimensions($plugin) as $dimension) { - $dimension->install(); - } - } catch (\Exception $e) { - throw new \Piwik\Plugin\PluginException($plugin->getPluginName(), $e->getMessage()); - } } /** @@ -1297,19 +1285,6 @@ class Manager extends Singleton $plugin->uninstall(); } catch (\Exception $e) { } - - try { - $plugin = $this->getLoadedPlugin($pluginName); - // todo not sure if this makes sense here - foreach (VisitDimension::getDimensions($plugin) as $dimension) { - $dimension->uninstall(); - } - // todo not sure if this makes sense here - foreach (ActionDimension::getDimensions($plugin) as $dimension) { - $dimension->uninstall(); - } - } catch (\Exception $e) { - } } /** diff --git a/core/Plugin/VisitDimension.php b/core/Plugin/VisitDimension.php index a4c205e7e3949fc2ae5a8d5f71a99a9e79a7531a..eb2f8ffbd331eed8ef21accb2bf859876f8cc53a 100644 --- a/core/Plugin/VisitDimension.php +++ b/core/Plugin/VisitDimension.php @@ -9,6 +9,7 @@ namespace Piwik\Plugin; use Piwik\Cache\PluginAwareStaticCache; +use Piwik\Columns\Dimension; use Piwik\Common; use Piwik\Db; use Piwik\Plugin\Manager as PluginManager; @@ -21,56 +22,44 @@ use Piwik\Translate; * @api * @since 2.5.0 */ -abstract class VisitDimension +abstract class VisitDimension extends Dimension { - protected $name; - protected $fieldName = ''; - protected $fieldType = ''; - - protected $segments = array(); - - protected function configureSegments() + public function install($visitColumns, $conversionColumns) { + if (!$this->columnType) { + return array(); + } - } + $tableVisit = Common::prefixTable("log_visit"); + $tableConversion = Common::prefixTable("log_conversion"); - public function hasImplementedEvent($method) - { - $reflectionObject = new \ReflectionObject($this); - $declaringClass = $reflectionObject->getMethod($method)->getDeclaringClass(); + $changes = array(); - return get_class() !== $declaringClass->name; - } + $handlingLogVisit = $this->isHandlingLogVisit(); + $hasVisitColumn = in_array($this->getColumnName(), $visitColumns); - public function install() - { - try { - if ($this->isHandlingLogVisit()) { - $sql = "ALTER TABLE `" . Common::prefixTable("log_visit") . "` ADD `$this->fieldName` $this->fieldType"; - Db::exec($sql); - } - } catch (\Exception $e) { - if (!Db::get()->isErrNo($e, '1060')) { - throw $e; - } + if (!$hasVisitColumn && $handlingLogVisit) { + $changes[$tableVisit] = array("ADD COLUMN `$this->columnName` $this->columnType"); + } elseif ($hasVisitColumn && !$handlingLogVisit) { + $changes[$tableVisit] = array("DROP COLUMN `$this->columnName`"); } - try { - if ($this->isHandlingLogConversion()) { - $sql = "ALTER TABLE `" . Common::prefixTable("log_conversion") . "` ADD `$this->fieldName` $this->fieldType"; - Db::exec($sql); - } - } catch (\Exception $e) { - if (!Db::get()->isErrNo($e, '1060')) { - throw $e; - } + $handlingLogConversion = $this->isHandlingLogConversion(); + $hasConversionColumn = in_array($this->getColumnName(), $conversionColumns); + + if (!$hasConversionColumn && $handlingLogConversion) { + $changes[$tableConversion] = array("ADD COLUMN `$this->columnName` $this->columnType"); + } elseif ($hasConversionColumn && !$handlingLogConversion) { + $changes[$tableConversion] = array("DROP COLUMN `$this->columnName`"); } + + return $changes; } private function isHandlingLogVisit() { - if (empty($this->fieldName) || empty($this->fieldType)) { + if (empty($this->columnName) || empty($this->columnType)) { return false; } @@ -81,73 +70,43 @@ abstract class VisitDimension private function isHandlingLogConversion() { - if (empty($this->fieldName) || empty($this->fieldType)) { + if (empty($this->columnName) || empty($this->columnType)) { return false; } return $this->hasImplementedEvent('onRecordGoal'); } - public function uninstall() + public function uninstall($visitColumns, $conversionColumns) { - if (empty($this->fieldName) || empty($this->fieldType)) { - return; + if (empty($this->columnName) || empty($this->columnType)) { + return array(); } - try { - if ($this->isHandlingLogVisit()) { - $sql = "ALTER TABLE `" . Common::prefixTable("log_visit") . "` DROP COLUMN `$this->fieldName`"; - Db::exec($sql); - } - } catch (\Exception $e) { - if (!Db::get()->isErrNo($e, '1091')) { - throw $e; - } - } + $tableVisit = Common::prefixTable("log_visit"); + $tableConversion = Common::prefixTable("log_conversion"); - try { - if ($this->isHandlingLogConversion()) { - $sql = "ALTER TABLE `" . Common::prefixTable("log_conversion") . "` DROP COLUMN `$this->fieldName`"; - Db::exec($sql); - } - } catch (\Exception $e) { - if (!Db::get()->isErrNo($e, '1091')) { - throw $e; - } - } - } + $columnsToDrop = array(); - protected function addSegment(Segment $segment) - { - $sqlSegment = $segment->getSqlSegment(); - if (!empty($this->fieldName) && empty($sqlSegment)) { - $segment->setSqlSegment('log_visit.' . $this->fieldName); + if (in_array($this->columnName, $visitColumns) && $this->isHandlingLogVisit()) { + $columnsToDrop[$tableVisit] = array("DROP COLUMN `$this->columnName`"); } - $type = $segment->getType(); - - if (empty($type)) { - $segment->setType(Segment::TYPE_DIMENSION); + if (in_array($this->columnName, $conversionColumns) && $this->isHandlingLogConversion()) { + $columnsToDrop[$tableConversion] = array("DROP COLUMN `$this->columnName`"); } - $this->segments[] = $segment; + return $columnsToDrop; } - /** - * @return Segment[] - */ - public function getSegments() + protected function addSegment(Segment $segment) { - if (empty($this->segments)) { - $this->configureSegments(); + $sqlSegment = $segment->getSqlSegment(); + if (!empty($this->columnName) && empty($sqlSegment)) { + $segment->setSqlSegment('log_visit.' . $this->columnName); } - return $this->segments; - } - - public function getFieldName() - { - return $this->fieldName; + parent::addSegment($segment); } public function getRequiredVisitFields() @@ -181,8 +140,6 @@ abstract class VisitDimension return false; } - abstract public function getName(); - /** @return \Piwik\Plugin\VisitDimension[] */ public static function getAllDimensions() { @@ -215,7 +172,7 @@ abstract class VisitDimension return -1; } - if (!empty($fields) && in_array($b->getFieldName(), $fields)) { + if (!empty($fields) && in_array($b->getColumnName(), $fields)) { return 1; } diff --git a/core/Tracker/Action.php b/core/Tracker/Action.php index 665c3eb4474ba133a1e92902b20a813ec01e5263..d73094e280e27054b11a4eeb04286cfaeed14aaa 100644 --- a/core/Tracker/Action.php +++ b/core/Tracker/Action.php @@ -263,7 +263,7 @@ abstract class Action foreach ($dimensions as $dimension) { if (method_exists($dimension, 'onLookupAction')) { - $field = $dimension->getFieldName(); + $field = $dimension->getColumnName(); $value = $dimension->onLookupAction($this->request, $this); if (empty($field)) { @@ -315,7 +315,7 @@ abstract class Action $value = $dimension->onNewAction($this->request, $visitor, $this); if ($value !== false) { - $visitAction[$dimension->getFieldName()] = $value; + $visitAction[$dimension->getColumnName()] = $value; } } diff --git a/core/Tracker/GoalManager.php b/core/Tracker/GoalManager.php index d33a331ba8d62f6962ebc54beb2ce05030a3b5bf..1706f4ac25da8c78cf488544e33d2908d83da8da 100644 --- a/core/Tracker/GoalManager.php +++ b/core/Tracker/GoalManager.php @@ -190,7 +190,7 @@ class GoalManager foreach (VisitDimension::getAllDimensions() as $dimension) { $value = $dimension->onRecordGoal($this->request, $visitor, $action); if (false !== $value) { - $goal[$dimension->getFieldName()] = $value; + $goal[$dimension->getColumnName()] = $value; } } diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index 8904682139517f6f5d22ce711295fba18e4a6baf..806c694f1acc28fb686bea777310929d1dfad0b6 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -542,7 +542,7 @@ class Visit implements VisitInterface $value = $dimension->$hook($this->request, $visitor, $action); if ($value !== false) { - $fieldName = $dimension->getFieldName(); + $fieldName = $dimension->getColumnName(); $visitor->setVisitorColumn($fieldName, $value); if ($valuesToUpdate !== null) { diff --git a/core/Tracker/Visitor.php b/core/Tracker/Visitor.php index 627982e4555ee75f683410b87cb7359932a86be0..1c6a7cf89c94562af2ce8b19d0ac78d51d7c121f 100644 --- a/core/Tracker/Visitor.php +++ b/core/Tracker/Visitor.php @@ -271,7 +271,7 @@ class Visitor $dimensions = VisitDimension::getAllDimensions(); foreach ($dimensions as $dimension) { if ($dimension->hasImplementedEvent('onExistingVisit')) { - $fields[] = $dimension->getFieldName(); + $fields[] = $dimension->getColumnName(); } /** diff --git a/core/Updater.php b/core/Updater.php index 6d46bbf1478242057ffec95468650aea0022720d..d0b2fd9ad3ea7bb6299e99aa18d66ee9df392108 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -7,6 +7,7 @@ * */ namespace Piwik; +use Piwik\Columns\Updates as ColumnUpdates; /** * Load and execute all relevant, incremental update scripts for Piwik core and plugins, and bump the component version numbers for completed updates. @@ -111,6 +112,8 @@ class Updater public function getSqlQueriesToExecute() { $queries = array(); + $classNames = array(); + foreach ($this->componentsWithUpdateFile as $componentName => $componentUpdateInfo) { foreach ($componentUpdateInfo as $file => $fileVersion) { require_once $file; // prefixed by PIWIK_INCLUDE_PATH @@ -119,6 +122,13 @@ class Updater if (!class_exists($className, false)) { throw new \Exception("The class $className was not found in $file"); } + + if (in_array($className, $classNames)) { + continue; // prevent from getting updates from Piwik\Columns\Updates multiple times + } + + $classNames[] = $className; + $queriesForComponent = call_user_func(array($className, 'getSql')); foreach ($queriesForComponent as $query => $error) { $queries[] = $query . ';'; @@ -141,6 +151,11 @@ class Updater if ($componentName == 'core') { return '\\Piwik\\Updates\\' . $className; } + + if ($this->isDimensionComponent($componentName)) { + return '\\Piwik\\Columns\\Updates'; + } + return '\\Piwik\\Plugins\\' . $componentName . '\\' . $className; } @@ -177,6 +192,14 @@ class Updater return $warningMessages; } + private function isDimensionComponent($name) + { + return 0 === strpos($name, 'log_visit.') + || 0 === strpos($name, 'log_conversion.') + || 0 === strpos($name, 'log_conversion_item.') + || 0 === strpos($name, 'log_link_visit_action.'); + } + /** * Construct list of update files for the outdated components * @@ -185,29 +208,41 @@ class Updater private function loadComponentsWithUpdateFile() { $componentsWithUpdateFile = array(); + $hasDimensionUpdate = null; + foreach ($this->componentsWithNewVersion as $name => $versions) { $currentVersion = $versions[self::INDEX_CURRENT_VERSION]; $newVersion = $versions[self::INDEX_NEW_VERSION]; if ($name == 'core') { $pathToUpdates = $this->pathUpdateFileCore . '*.php'; + } elseif ($this->isDimensionComponent($name)) { + if (is_null($hasDimensionUpdate)) { + $hasDimensionUpdate = ColumnUpdates::hasUpdates(); + } + if ($hasDimensionUpdate) { + $componentsWithUpdateFile[$name][PIWIK_INCLUDE_PATH . '/core/Columns/Updates.php'] = $newVersion; + } + continue; } else { $pathToUpdates = sprintf($this->pathUpdateFilePlugins, $name) . '*.php'; } - $files = _glob($pathToUpdates); - if ($files == false) { - $files = array(); - } + if (!empty($pathToUpdates)) { + $files = _glob($pathToUpdates); + if ($files == false) { + $files = array(); + } - foreach ($files as $file) { - $fileVersion = basename($file, '.php'); - if ( // if the update is from a newer version - version_compare($currentVersion, $fileVersion) == -1 - // but we don't execute updates from non existing future releases - && version_compare($fileVersion, $newVersion) <= 0 - ) { - $componentsWithUpdateFile[$name][$file] = $fileVersion; + foreach ($files as $file) { + $fileVersion = basename($file, '.php'); + if ( // if the update is from a newer version + version_compare($currentVersion, $fileVersion) == -1 + // but we don't execute updates from non existing future releases + && version_compare($fileVersion, $newVersion) <= 0 + ) { + $componentsWithUpdateFile[$name][$file] = $fileVersion; + } } } @@ -219,6 +254,7 @@ class Updater self::recordComponentSuccessfullyUpdated($name, $newVersion); } } + return $componentsWithUpdateFile; } diff --git a/plugins/Actions/Columns/EntryPageTitle.php b/plugins/Actions/Columns/EntryPageTitle.php index 8b341a1c4fc0862ef2580722b7040a27f2b7654c..7d67002a8fe2912390b734a4e6fe7d1908a8e9c3 100644 --- a/plugins/Actions/Columns/EntryPageTitle.php +++ b/plugins/Actions/Columns/EntryPageTitle.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class EntryPageTitle extends VisitDimension { - protected $fieldName = 'visit_entry_idaction_name'; - protected $fieldType = 'INTEGER(11) UNSIGNED NOT NULL'; + protected $columnName = 'visit_entry_idaction_name'; + protected $columnType = 'INTEGER(11) UNSIGNED NOT NULL'; protected function configureSegments() { diff --git a/plugins/Actions/Columns/EntryPageUrl.php b/plugins/Actions/Columns/EntryPageUrl.php index 96acc84d2873a4ec5fc9ed088ed41e94c0218c7e..a5d20a38594c9638a30d0be4e77b2750f1716759 100644 --- a/plugins/Actions/Columns/EntryPageUrl.php +++ b/plugins/Actions/Columns/EntryPageUrl.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class EntryPageUrl extends VisitDimension { - protected $fieldName = 'visit_entry_idaction_url'; - protected $fieldType = 'INTEGER(11) UNSIGNED NOT NULL'; + protected $columnName = 'visit_entry_idaction_url'; + protected $columnType = 'INTEGER(11) UNSIGNED NOT NULL'; protected function configureSegments() { diff --git a/plugins/Actions/Columns/ExitPageTitle.php b/plugins/Actions/Columns/ExitPageTitle.php index 71aaeed89767e5d2db3a0d5761cf1647cb76dc50..6a1f2948aa2b2652c70b4f17e4a4beba4b585c56 100644 --- a/plugins/Actions/Columns/ExitPageTitle.php +++ b/plugins/Actions/Columns/ExitPageTitle.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class ExitPageTitle extends VisitDimension { - protected $fieldName = 'visit_exit_idaction_name'; - protected $fieldType = 'INTEGER(11) UNSIGNED NOT NULL'; + protected $columnName = 'visit_exit_idaction_name'; + protected $columnType = 'INTEGER(11) UNSIGNED NOT NULL'; protected function configureSegments() { diff --git a/plugins/Actions/Columns/ExitPageUrl.php b/plugins/Actions/Columns/ExitPageUrl.php index b22246039c273557e6ce665b4a8200c0cbfcb8ca..dc83358ce1cdf1ca18ebefc59029b098b6c98558 100644 --- a/plugins/Actions/Columns/ExitPageUrl.php +++ b/plugins/Actions/Columns/ExitPageUrl.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class ExitPageUrl extends VisitDimension { - protected $fieldName = 'visit_exit_idaction_url'; - protected $fieldType = 'INTEGER(11) UNSIGNED NULL DEFAULT 0'; + protected $columnName = 'visit_exit_idaction_url'; + protected $columnType = 'INTEGER(11) UNSIGNED NULL DEFAULT 0'; protected function configureSegments() { diff --git a/plugins/Actions/Columns/PageTitle.php b/plugins/Actions/Columns/PageTitle.php index 94f3b09dd6c16466763659ffc16f331b5ca6b2f6..5dbbecdac6b5a4879b4c97cbb0e144f336a1d452 100644 --- a/plugins/Actions/Columns/PageTitle.php +++ b/plugins/Actions/Columns/PageTitle.php @@ -15,8 +15,8 @@ use Piwik\Tracker\Request; class PageTitle extends ActionDimension { - protected $fieldName = 'idaction_name'; - protected $fieldType = 'INTEGER(10) UNSIGNED'; + protected $columnName = 'idaction_name'; + protected $columnType = 'INTEGER(10) UNSIGNED'; protected function configureSegments() { diff --git a/plugins/Actions/Columns/PageUrl.php b/plugins/Actions/Columns/PageUrl.php index e36a3db163185f3a6fa4404efbac030f4b5ae2d6..c6c149ee61a50d07395cc6a47aacc5c1f3377c85 100644 --- a/plugins/Actions/Columns/PageUrl.php +++ b/plugins/Actions/Columns/PageUrl.php @@ -14,8 +14,8 @@ use Piwik\Plugins\Actions\Segment; class PageUrl extends ActionDimension { - protected $fieldName = 'idaction_url'; - protected $fieldType = 'INTEGER(10) UNSIGNED DEFAULT NULL'; + protected $columnName = 'idaction_url'; + protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL'; protected function configureSegments() { diff --git a/plugins/Actions/Columns/ServerTime.php b/plugins/Actions/Columns/ServerTime.php index c32705a3eb8d906ffbd9ee9999c874cb325b9832..4273d553e59ead5dc4db2c17150636dfa4d43408 100644 --- a/plugins/Actions/Columns/ServerTime.php +++ b/plugins/Actions/Columns/ServerTime.php @@ -18,15 +18,21 @@ use Piwik\Tracker; class ServerTime extends ActionDimension { - protected $fieldName = 'server_time'; - protected $fieldType = 'DATETIME NOT NULL'; + protected $columnName = 'server_time'; + protected $columnType = 'DATETIME NOT NULL'; - public function install() + public function install($actionColumns) { - parent::install(); + if (in_array($this->columnName, $actionColumns)) { + return; + } - $sql = "ALTER TABLE `" . Common::prefixTable("log_link_visit_action") . "` ADD INDEX index_idsite_servertime ( idsite, server_time )"; - Db::exec($sql); + return array( + Common::prefixTable("log_link_visit_action") => array( + "ADD COLUMN server_time DATETIME NOT NULL", + "ADD INDEX index_idsite_servertime ( idsite, server_time )" + ) + ); } public function getName() diff --git a/plugins/Actions/Columns/TimeSpentRefAction.php b/plugins/Actions/Columns/TimeSpentRefAction.php index a65067ca68be66a719e46b63a0e01bbd702ce74a..10485e1fb85b900879c48fc768247f510b548f96 100644 --- a/plugins/Actions/Columns/TimeSpentRefAction.php +++ b/plugins/Actions/Columns/TimeSpentRefAction.php @@ -15,8 +15,8 @@ use Piwik\Tracker\Visitor; class TimeSpentRefAction extends ActionDimension { - protected $fieldName = 'time_spent_ref_action'; - protected $fieldType = 'INTEGER(10) UNSIGNED NOT NULL'; + protected $columnName = 'time_spent_ref_action'; + protected $columnType = 'INTEGER(10) UNSIGNED NOT NULL'; public function getName() { diff --git a/plugins/Actions/Columns/VisitTotalActions.php b/plugins/Actions/Columns/VisitTotalActions.php index 0520160174146ca7bbbe0224a36e187bb6a0f2f8..37f8acfba2032906a133539a7a90dd37cdd0f072 100644 --- a/plugins/Actions/Columns/VisitTotalActions.php +++ b/plugins/Actions/Columns/VisitTotalActions.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class VisitTotalActions extends VisitDimension { - protected $fieldName = 'visit_total_actions'; - protected $fieldType = 'SMALLINT(5) UNSIGNED NOT NULL'; + protected $columnName = 'visit_total_actions'; + protected $columnType = 'SMALLINT(5) UNSIGNED NOT NULL'; protected function configureSegments() { diff --git a/plugins/Actions/Columns/VisitTotalSearches.php b/plugins/Actions/Columns/VisitTotalSearches.php index 059f4a512ae2bd14684b326018399d7d9e990f11..47eec61b1e5ee710969ce46fdfba93c819ce2f5b 100644 --- a/plugins/Actions/Columns/VisitTotalSearches.php +++ b/plugins/Actions/Columns/VisitTotalSearches.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class VisitTotalSearches extends VisitDimension { - protected $fieldName = 'visit_total_searches'; - protected $fieldType = 'SMALLINT(5) UNSIGNED NOT NULL'; + protected $columnName = 'visit_total_searches'; + protected $columnType = 'SMALLINT(5) UNSIGNED NOT NULL'; protected function configureSegments() { diff --git a/plugins/CoreHome/Columns/IdSite.php b/plugins/CoreHome/Columns/IdSite.php index c367764c720b7dc052f89878951d86ff3a4c0b5a..471e01f98d148313fefb16bc643a9b74e5418f84 100644 --- a/plugins/CoreHome/Columns/IdSite.php +++ b/plugins/CoreHome/Columns/IdSite.php @@ -16,7 +16,7 @@ use Piwik\Tracker\Visitor; class IdSite extends VisitDimension { - protected $fieldName = 'idsite'; + protected $columnName = 'idsite'; // we do not install or define column definition here as we need to create this column when installing as there is // an index on it. Currently we do not define the index here... although we could overwrite the install() method // and add column 'idsite' and add index. Problem is there is also an index diff --git a/plugins/CoreHome/Columns/VisitFirstActionTime.php b/plugins/CoreHome/Columns/VisitFirstActionTime.php index d74458dc9f9e2c45484f941ae3c029e22b165d04..1836fe8c7399eacc5a3f617d53653db766d8d0a4 100644 --- a/plugins/CoreHome/Columns/VisitFirstActionTime.php +++ b/plugins/CoreHome/Columns/VisitFirstActionTime.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Visitor; class VisitFirstActionTime extends VisitDimension { - protected $fieldName = 'visit_first_action_time'; - protected $fieldType = 'DATETIME NOT NULL'; + protected $columnName = 'visit_first_action_time'; + protected $columnType = 'DATETIME NOT NULL'; public function getName() { diff --git a/plugins/CoreHome/Columns/VisitGoalBuyer.php b/plugins/CoreHome/Columns/VisitGoalBuyer.php index d371d85ec3edaa446751babb746ca0b1ab8fb7da..5a1f98279cbe16ea31284b756f869cb9a2badfcd 100644 --- a/plugins/CoreHome/Columns/VisitGoalBuyer.php +++ b/plugins/CoreHome/Columns/VisitGoalBuyer.php @@ -31,8 +31,8 @@ class VisitGoalBuyer extends VisitDimension self::TYPE_BUYER_ORDERED_AND_OPEN_CART => 'orderedThenAbandonedCart', ); - protected $fieldName = 'visit_goal_buyer'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'visit_goal_buyer'; + protected $columnType = 'TINYINT(1) NOT NULL'; protected function configureSegments() { @@ -72,7 +72,7 @@ class VisitGoalBuyer extends VisitDimension */ public function onExistingVisit(Request $request, Visitor $visitor, $action) { - $goalBuyer = $visitor->getVisitorColumn($this->fieldName); + $goalBuyer = $visitor->getVisitorColumn($this->columnName); // Ecommerce buyer status $visitEcommerceStatus = $this->getBuyerType($request, $goalBuyer); diff --git a/plugins/CoreHome/Columns/VisitGoalConverted.php b/plugins/CoreHome/Columns/VisitGoalConverted.php index 66398b9ce3bc579ec21566e179dfe77c4c4bc495..56d13f7643d286d843a4173988df9b7368fcc943 100644 --- a/plugins/CoreHome/Columns/VisitGoalConverted.php +++ b/plugins/CoreHome/Columns/VisitGoalConverted.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Visitor; class VisitGoalConverted extends VisitDimension { - protected $fieldName = 'visit_goal_converted'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'visit_goal_converted'; + protected $columnType = 'TINYINT(1) NOT NULL'; protected function configureSegments() { diff --git a/plugins/CoreHome/Columns/VisitLastActionTime.php b/plugins/CoreHome/Columns/VisitLastActionTime.php index b4ad30c2147a0277c6e8342984055b6bb835ae48..e261f81ef417c79a6647a2486ddd0e2b8e2aeffb 100644 --- a/plugins/CoreHome/Columns/VisitLastActionTime.php +++ b/plugins/CoreHome/Columns/VisitLastActionTime.php @@ -16,7 +16,7 @@ use Piwik\Tracker\Visitor; class VisitLastActionTime extends VisitDimension { - protected $fieldName = 'visit_last_action_time'; + protected $columnName = 'visit_last_action_time'; // we do not install or define column definition here as we need to create this column when installing as there is // an index on it. Currently we do not define the index here... although we could overwrite the install() method // and add column 'visit_last_action_time' and add index. Problem is there is also an index diff --git a/plugins/CoreHome/Columns/VisitTotalTime.php b/plugins/CoreHome/Columns/VisitTotalTime.php index 36f885b1353711008d8c92b68dcc4e11746ff954..a529bbdef35983be9b82c3bdaa32a52e38a62280 100644 --- a/plugins/CoreHome/Columns/VisitTotalTime.php +++ b/plugins/CoreHome/Columns/VisitTotalTime.php @@ -18,8 +18,8 @@ use Piwik\Tracker\Visitor; class VisitTotalTime extends VisitDimension { - protected $fieldName = 'visit_total_time'; - protected $fieldType = 'SMALLINT(5) UNSIGNED NOT NULL'; + protected $columnName = 'visit_total_time'; + protected $columnType = 'SMALLINT(5) UNSIGNED NOT NULL'; protected function configureSegments() { diff --git a/plugins/CoreHome/Columns/VisitorDaysSinceFirst.php b/plugins/CoreHome/Columns/VisitorDaysSinceFirst.php index 2bb1f3c2e27b48b0e6989c0539918f76aad15988..22e6bb5850c28166ac1ce5a7a30b029da41c2539 100644 --- a/plugins/CoreHome/Columns/VisitorDaysSinceFirst.php +++ b/plugins/CoreHome/Columns/VisitorDaysSinceFirst.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Visitor; class VisitorDaysSinceFirst extends VisitDimension { - protected $fieldName = 'visitor_days_since_first'; - protected $fieldType = 'SMALLINT(5) UNSIGNED NOT NULL'; + protected $columnName = 'visitor_days_since_first'; + protected $columnType = 'SMALLINT(5) UNSIGNED NOT NULL'; protected function configureSegments() { @@ -52,6 +52,6 @@ class VisitorDaysSinceFirst extends VisitDimension */ public function onRecordGoal(Request $request, Visitor $visitor, $action) { - return $visitor->getVisitorColumn($this->fieldName); + return $visitor->getVisitorColumn($this->columnName); } } \ No newline at end of file diff --git a/plugins/CoreHome/Columns/VisitorDaysSinceOrder.php b/plugins/CoreHome/Columns/VisitorDaysSinceOrder.php index 8a3b6b0dbe5657140e9c6f4ffa2376f135c80a9a..5b961b27f39d0356352e84b6bc4e0f9a2d74ae75 100644 --- a/plugins/CoreHome/Columns/VisitorDaysSinceOrder.php +++ b/plugins/CoreHome/Columns/VisitorDaysSinceOrder.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Visitor; class VisitorDaysSinceOrder extends VisitDimension { - protected $fieldName = 'visitor_days_since_order'; - protected $fieldType = 'SMALLINT(5) UNSIGNED NOT NULL'; + protected $columnName = 'visitor_days_since_order'; + protected $columnType = 'SMALLINT(5) UNSIGNED NOT NULL'; protected function configureSegments() { @@ -59,6 +59,6 @@ class VisitorDaysSinceOrder extends VisitDimension */ public function onRecordGoal(Request $request, Visitor $visitor, $action) { - return $visitor->getVisitorColumn($this->fieldName); + return $visitor->getVisitorColumn($this->columnName); } } \ No newline at end of file diff --git a/plugins/CoreHome/Columns/VisitorReturning.php b/plugins/CoreHome/Columns/VisitorReturning.php index aed4ec4d7215772758011f4cdaefb2c3958dbae6..6f66225cb8187609232a86293f942195d96f5fdc 100644 --- a/plugins/CoreHome/Columns/VisitorReturning.php +++ b/plugins/CoreHome/Columns/VisitorReturning.php @@ -21,8 +21,8 @@ class VisitorReturning extends VisitDimension const IS_RETURNING = 1; const IS_NEW = 0; - protected $fieldName = 'visitor_returning'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'visitor_returning'; + protected $columnType = 'TINYINT(1) NOT NULL'; protected $conversionField = true; protected function configureSegments() @@ -79,6 +79,6 @@ class VisitorReturning extends VisitDimension */ public function onRecordGoal(Request $request, Visitor $visitor, $action) { - return $visitor->getVisitorColumn($this->fieldName); + return $visitor->getVisitorColumn($this->columnName); } } \ No newline at end of file diff --git a/plugins/CoreHome/Columns/VisitsCount.php b/plugins/CoreHome/Columns/VisitsCount.php index d1e0069df65171f3e7f49503a70e3401f2756a04..26e29fc7515d994859111c9b8ee0a024aacfe38d 100644 --- a/plugins/CoreHome/Columns/VisitsCount.php +++ b/plugins/CoreHome/Columns/VisitsCount.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Visitor; class VisitsCount extends VisitDimension { - protected $fieldName = 'visitor_count_visits'; - protected $fieldType = 'SMALLINT(5) UNSIGNED NOT NULL'; + protected $columnName = 'visitor_count_visits'; + protected $columnType = 'SMALLINT(5) UNSIGNED NOT NULL'; public function getName() { @@ -52,6 +52,6 @@ class VisitsCount extends VisitDimension */ public function onRecordGoal(Request $request, Visitor $visitor, $action) { - return $visitor->getVisitorColumn($this->fieldName); + return $visitor->getVisitorColumn($this->columnName); } } \ No newline at end of file diff --git a/plugins/CoreUpdater/CoreUpdater.php b/plugins/CoreUpdater/CoreUpdater.php index cbd563e8b0eb9e3ef51589b1e78ec45c0ea7d78a..d928b4bb26febe6dbcec6c4f253694df3626ef78 100644 --- a/plugins/CoreUpdater/CoreUpdater.php +++ b/plugins/CoreUpdater/CoreUpdater.php @@ -14,7 +14,8 @@ use Piwik\Common; use Piwik\Filesystem; use Piwik\FrontController; use Piwik\Piwik; -use Piwik\ScheduledTask; +use Piwik\Plugin\ActionDimension; +use Piwik\Plugin\VisitDimension; use Piwik\ScheduledTime; use Piwik\UpdateCheck; use Piwik\Updater; @@ -64,7 +65,7 @@ class CoreUpdater extends \Piwik\Plugin if ($name == 'core') { $coreError = true; break; - } else { + } elseif (\Piwik\Plugin\Manager::getInstance()->isPluginActivated($name)) { \Piwik\Plugin\Manager::getInstance()->deactivatePlugin($name); $deactivatedPlugins[] = $name; } @@ -94,11 +95,25 @@ class CoreUpdater extends \Piwik\Plugin $manager = \Piwik\Plugin\Manager::getInstance(); $plugins = $manager->getLoadedPlugins(); foreach ($plugins as $pluginName => $plugin) { - if($manager->isPluginInstalled($pluginName)) { + if ($manager->isPluginInstalled($pluginName)) { $updater->addComponentToCheck($pluginName, $plugin->getVersion()); } } + foreach (VisitDimension::getAllDimensions() as $dimension) { + $columnName = $dimension->getColumnName(); + if ($columnName) { + $updater->addComponentToCheck('log_visit.' . $columnName, $dimension->getVersion()); + } + } + + foreach (ActionDimension::getAllDimensions() as $dimension) { + $columnName = $dimension->getColumnName(); + if ($columnName) { + $updater->addComponentToCheck('log_link_visit_action.' . $columnName, $dimension->getVersion()); + } + } + $componentsWithUpdateFile = $updater->getComponentsWithUpdateFile(); if (count($componentsWithUpdateFile) == 0 && !$updater->hasNewVersion('core')) { diff --git a/plugins/DevicesDetection/Columns/BrowserName.php b/plugins/DevicesDetection/Columns/BrowserName.php index bc13acbcc83f849ff7c06a8fe0016552084e2549..1237d6676b928ea76a516bad03a16965e8d19040 100644 --- a/plugins/DevicesDetection/Columns/BrowserName.php +++ b/plugins/DevicesDetection/Columns/BrowserName.php @@ -15,7 +15,7 @@ use Piwik\Tracker\Action; class BrowserName extends Base { - protected $fieldName = 'config_browser_name'; + protected $columnName = 'config_browser_name'; public function getName() { diff --git a/plugins/DevicesDetection/Columns/BrowserVersion.php b/plugins/DevicesDetection/Columns/BrowserVersion.php index 20666f32657fd6b78e398848d56745f88c9f7ae6..1fa60f3ab2b2db8cbd42349c41851d54c50c4316 100644 --- a/plugins/DevicesDetection/Columns/BrowserVersion.php +++ b/plugins/DevicesDetection/Columns/BrowserVersion.php @@ -15,7 +15,7 @@ use Piwik\Tracker\Action; class BrowserVersion extends Base { - protected $fieldName = 'config_browser_version'; + protected $columnName = 'config_browser_version'; public function getName() { diff --git a/plugins/DevicesDetection/Columns/DeviceBrand.php b/plugins/DevicesDetection/Columns/DeviceBrand.php index 4ac550fa122a1f6a1c4ac34b8b4b2672e23df596..d5b06617ece457693f49ece14d2020567bedb610 100644 --- a/plugins/DevicesDetection/Columns/DeviceBrand.php +++ b/plugins/DevicesDetection/Columns/DeviceBrand.php @@ -15,8 +15,8 @@ use Piwik\Tracker\Action; class DeviceBrand extends Base { - protected $fieldName = 'config_device_brand'; - protected $fieldType = 'VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL'; + protected $columnName = 'config_device_brand'; + protected $columnType = 'VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL'; public function getName() { diff --git a/plugins/DevicesDetection/Columns/DeviceModel.php b/plugins/DevicesDetection/Columns/DeviceModel.php index ae5dacb517fa1537fdf5e145cd38b4d5e6adfbc3..488eeb615e8e84c9b2292d481929b723f7709270 100644 --- a/plugins/DevicesDetection/Columns/DeviceModel.php +++ b/plugins/DevicesDetection/Columns/DeviceModel.php @@ -15,8 +15,8 @@ use Piwik\Tracker\Action; class DeviceModel extends Base { - protected $fieldName = 'config_device_model'; - protected $fieldType = 'VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL'; + protected $columnName = 'config_device_model'; + protected $columnType = 'VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL'; public function getName() { diff --git a/plugins/DevicesDetection/Columns/DeviceType.php b/plugins/DevicesDetection/Columns/DeviceType.php index 3e243a475498e174c9f13681d71364858420584f..37b7cc06797d872ea692ad5c60fefd868025ed32 100644 --- a/plugins/DevicesDetection/Columns/DeviceType.php +++ b/plugins/DevicesDetection/Columns/DeviceType.php @@ -19,8 +19,8 @@ use DeviceDetector\Parser\Device\DeviceParserAbstract as DeviceParser; class DeviceType extends Base { - protected $fieldName = 'config_device_type'; - protected $fieldType = 'TINYINT( 100 ) NULL DEFAULT NULL'; + protected $columnName = 'config_device_type'; + protected $columnType = 'TINYINT( 100 ) NULL DEFAULT NULL'; protected function configureSegments() { diff --git a/plugins/DevicesDetection/Columns/Os.php b/plugins/DevicesDetection/Columns/Os.php index f6c770dc19a8bb0d87b03c0f1b3364a86b90154e..599edb3285bf6a1183e028b66065277b61e96621 100644 --- a/plugins/DevicesDetection/Columns/Os.php +++ b/plugins/DevicesDetection/Columns/Os.php @@ -16,7 +16,7 @@ use Piwik\Tracker\Action; class Os extends Base { - protected $fieldName = 'config_os'; + protected $columnName = 'config_os'; public function getName() { diff --git a/plugins/DevicesDetection/Columns/OsVersion.php b/plugins/DevicesDetection/Columns/OsVersion.php index 786db1ef75af8e49d734397a466eb0b9a5d16577..e9913f740ea3e885f31fd86f78205c21f2eb44cd 100644 --- a/plugins/DevicesDetection/Columns/OsVersion.php +++ b/plugins/DevicesDetection/Columns/OsVersion.php @@ -15,8 +15,8 @@ use Piwik\Tracker\Action; class OsVersion extends Base { - protected $fieldName = 'config_os_version'; - protected $fieldType = 'VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL'; + protected $columnName = 'config_os_version'; + protected $columnType = 'VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL'; public function getName() { diff --git a/plugins/Events/Columns/EventAction.php b/plugins/Events/Columns/EventAction.php index bb02fc4ad130e985917a0630679fc196e576d207..a2d48266f817c135aaca6cb5d29913bddc3f62a3 100644 --- a/plugins/Events/Columns/EventAction.php +++ b/plugins/Events/Columns/EventAction.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Request; class EventAction extends ActionDimension { - protected $fieldName = 'idaction_event_action'; - protected $fieldType = 'INTEGER(10) UNSIGNED DEFAULT NULL'; + protected $columnName = 'idaction_event_action'; + protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL'; protected function configureSegments() { diff --git a/plugins/Events/Columns/EventCategory.php b/plugins/Events/Columns/EventCategory.php index 83eb004c3e82c1a774a3a85e834dc03c12550258..fdba5c5ece4cf133d4573eb2cdf8ce39b1899591 100644 --- a/plugins/Events/Columns/EventCategory.php +++ b/plugins/Events/Columns/EventCategory.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Request; class EventCategory extends ActionDimension { - protected $fieldName = 'idaction_event_category'; - protected $fieldType = 'INTEGER(10) UNSIGNED DEFAULT NULL'; + protected $columnName = 'idaction_event_category'; + protected $columnType = 'INTEGER(10) UNSIGNED DEFAULT NULL'; protected function configureSegments() { diff --git a/plugins/Events/Columns/EventName.php b/plugins/Events/Columns/EventName.php index 1a612d9df985faa06fd3dfe63446fa5575f435d4..c769cb3c5108b74344275ce4cc321ed92e3f1b43 100644 --- a/plugins/Events/Columns/EventName.php +++ b/plugins/Events/Columns/EventName.php @@ -17,7 +17,7 @@ use Piwik\Tracker\Request; class EventName extends ActionDimension { - protected $fieldName = 'idaction_name'; + protected $columnName = 'idaction_name'; protected function configureSegments() { diff --git a/plugins/Events/Columns/TotalEvents.php b/plugins/Events/Columns/TotalEvents.php index eab3e5e75ff7fd41077a1efc0401c12892a849ba..ee779ca80b3ec06964cd41492b754339edf32412 100644 --- a/plugins/Events/Columns/TotalEvents.php +++ b/plugins/Events/Columns/TotalEvents.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class TotalEvents extends VisitDimension { - protected $fieldName = 'visit_total_events'; - protected $fieldType = 'SMALLINT(5) UNSIGNED NOT NULL'; + protected $columnName = 'visit_total_events'; + protected $columnType = 'SMALLINT(5) UNSIGNED NOT NULL'; protected function configureSegments() { diff --git a/plugins/Goals/Columns/IdGoal.php b/plugins/Goals/Columns/IdGoal.php index 9d3c009281902ecb35c2678ce0f266a10869de4a..e519cdfef32caba534bd4ce11b085ea0f4f4e526 100644 --- a/plugins/Goals/Columns/IdGoal.php +++ b/plugins/Goals/Columns/IdGoal.php @@ -15,7 +15,7 @@ use Piwik\Plugin\VisitDimension; // TODO this is a conversion dimension class IdGoal extends VisitDimension { - protected $fieldName = 'idgoal'; + protected $columnName = 'idgoal'; protected function configureSegments() { diff --git a/plugins/Provider/Columns/Provider.php b/plugins/Provider/Columns/Provider.php index 95921411fe3ac9f7b4f70541cd38226f83b2089d..9d1c0aa57ce0f38d97ade587d91c47cea22c36d3 100644 --- a/plugins/Provider/Columns/Provider.php +++ b/plugins/Provider/Columns/Provider.php @@ -21,7 +21,7 @@ use Piwik\Plugins\Provider\Provider as ProviderPlugin; class Provider extends VisitDimension { - protected $fieldName = 'location_provider'; + protected $columnName = 'location_provider'; protected function configureSegments() { diff --git a/plugins/Referrers/Columns/Base.php b/plugins/Referrers/Columns/Base.php index 0c98357b06f81d8efadd6b0f8ef53aa7f62628a6..34615dcba72096fb071da426e72e9a1670cf2508 100644 --- a/plugins/Referrers/Columns/Base.php +++ b/plugins/Referrers/Columns/Base.php @@ -378,8 +378,8 @@ abstract class Base extends VisitDimension 'referer_visit_server_date' => date("Y-m-d", $time), ); - if (array_key_exists($this->fieldName, $fields)) { - return $fields[$this->fieldName]; + if (array_key_exists($this->columnName, $fields)) { + return $fields[$this->columnName]; } return false; diff --git a/plugins/Referrers/Columns/Keyword.php b/plugins/Referrers/Columns/Keyword.php index f084cc6b5190f936dbc569bfe5d7ceec5f70e466..b41f0937869d6df08bf284b4f7e22f2c4fe8add3 100644 --- a/plugins/Referrers/Columns/Keyword.php +++ b/plugins/Referrers/Columns/Keyword.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class Keyword extends Base { - protected $fieldName = 'referer_keyword'; - protected $fieldType = 'VARCHAR(255) NULL'; + protected $columnName = 'referer_keyword'; + protected $columnType = 'VARCHAR(255) NULL'; protected function configureSegments() { diff --git a/plugins/Referrers/Columns/ReferrerName.php b/plugins/Referrers/Columns/ReferrerName.php index 98f7f4c45f6ef4411a8c1239163e4bd1b57b3464..9ed8eba2b84c2abfc2a042672b233821630098bf 100644 --- a/plugins/Referrers/Columns/ReferrerName.php +++ b/plugins/Referrers/Columns/ReferrerName.php @@ -15,8 +15,8 @@ use Piwik\Tracker\Action; class ReferrerName extends Base { - protected $fieldName = 'referer_name'; - protected $fieldType = 'VARCHAR(70) NULL'; + protected $columnName = 'referer_name'; + protected $columnType = 'VARCHAR(70) NULL'; protected function configureSegments() { diff --git a/plugins/Referrers/Columns/ReferrerType.php b/plugins/Referrers/Columns/ReferrerType.php index 4313ea9d8a928b452458a6c2468a06202143dd24..81ade6ea2d3ece185e1c46c0d418c19dde119b34 100644 --- a/plugins/Referrers/Columns/ReferrerType.php +++ b/plugins/Referrers/Columns/ReferrerType.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class ReferrerType extends Base { - protected $fieldName = 'referer_type'; - protected $fieldType = 'TINYINT(1) UNSIGNED NULL'; + protected $columnName = 'referer_type'; + protected $columnType = 'TINYINT(1) UNSIGNED NULL'; protected function configureSegments() { diff --git a/plugins/Referrers/Columns/ReferrerUrl.php b/plugins/Referrers/Columns/ReferrerUrl.php index 9ceb8bc0353e64480d424f773812936848389f77..0b8d779794bdad33aba20e33a5f4828444f303e1 100644 --- a/plugins/Referrers/Columns/ReferrerUrl.php +++ b/plugins/Referrers/Columns/ReferrerUrl.php @@ -15,8 +15,8 @@ use Piwik\Tracker\Action; class ReferrerUrl extends Base { - protected $fieldName = 'referer_url'; - protected $fieldType = 'TEXT NOT NULL'; + protected $columnName = 'referer_url'; + protected $columnType = 'TEXT NOT NULL'; protected function configureSegments() { diff --git a/plugins/Referrers/Columns/ReferrerVisitServerDate.php b/plugins/Referrers/Columns/ReferrerVisitServerDate.php index 2d2da3bed6a402d2fc7af45fc4a3589925427ff2..258c591130de817eb4cccc019304b918120e27b0 100644 --- a/plugins/Referrers/Columns/ReferrerVisitServerDate.php +++ b/plugins/Referrers/Columns/ReferrerVisitServerDate.php @@ -14,8 +14,8 @@ use Piwik\Tracker\Action; class ReferrerVisitServerDate extends Base { - protected $fieldName = 'referer_visit_server_date'; - protected $fieldType = 'date default NULL'; + protected $columnName = 'referer_visit_server_date'; + protected $columnType = 'date default NULL'; public function getName() { diff --git a/plugins/UserCountry/Columns/City.php b/plugins/UserCountry/Columns/City.php index 7eeb3e9a8406b211f02a78cb850d0409ec2d5f83..c0685c6f3d643262613bac6b90e7aca3bb682e2a 100644 --- a/plugins/UserCountry/Columns/City.php +++ b/plugins/UserCountry/Columns/City.php @@ -17,8 +17,8 @@ use Piwik\Plugins\UserCountry\Segment; class City extends Base { - protected $fieldName = 'location_city'; - protected $fieldType = 'varchar(255) DEFAULT NULL'; + protected $columnName = 'location_city'; + protected $columnType = 'varchar(255) DEFAULT NULL'; protected function configureSegments() { @@ -72,6 +72,6 @@ class City extends Base */ public function onRecordGoal(Request $request, Visitor $visitor, $action) { - return $visitor->getVisitorColumn($this->fieldName); + return $visitor->getVisitorColumn($this->columnName); } } \ No newline at end of file diff --git a/plugins/UserCountry/Columns/Country.php b/plugins/UserCountry/Columns/Country.php index 2ef8a06eb362d34fe7f8f3f7c5290e2a7c217f3f..3f2751da1aeae04a061bb562e535daf8ca7e5296 100644 --- a/plugins/UserCountry/Columns/Country.php +++ b/plugins/UserCountry/Columns/Country.php @@ -22,8 +22,8 @@ use Piwik\Tracker\Request; class Country extends Base { - protected $fieldName = 'location_country'; - protected $fieldType = 'CHAR(3) NOT NULL'; + protected $columnName = 'location_country'; + protected $columnType = 'CHAR(3) NOT NULL'; protected function configureSegments() { @@ -124,7 +124,7 @@ class Country extends Base */ public function onRecordGoal(Request $request, Visitor $visitor, $action) { - $country = $visitor->getVisitorColumn($this->fieldName); + $country = $visitor->getVisitorColumn($this->columnName); if (isset($country) && false !== $country) { return $country; diff --git a/plugins/UserCountry/Columns/Latitude.php b/plugins/UserCountry/Columns/Latitude.php index 7b5b655b7e3a3e74071da32a8a95892f8e94ee92..7b195eec407bf65c61c6833fe037865c2cef4ef6 100644 --- a/plugins/UserCountry/Columns/Latitude.php +++ b/plugins/UserCountry/Columns/Latitude.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Action; class Latitude extends Base { - protected $fieldName = 'location_latitude'; - protected $fieldType = 'float(10, 6) DEFAULT NULL'; + protected $columnName = 'location_latitude'; + protected $columnType = 'float(10, 6) DEFAULT NULL'; protected function configureSegments() { @@ -72,6 +72,6 @@ class Latitude extends Base */ public function onRecordGoal(Request $request, Visitor $visitor, $action) { - return $visitor->getVisitorColumn($this->fieldName); + return $visitor->getVisitorColumn($this->columnName); } } \ No newline at end of file diff --git a/plugins/UserCountry/Columns/Longitude.php b/plugins/UserCountry/Columns/Longitude.php index c47a7a516200466402c8b4037d260f09d2bc3f98..969b39033fb073c62bc5ddffb794286112607b99 100644 --- a/plugins/UserCountry/Columns/Longitude.php +++ b/plugins/UserCountry/Columns/Longitude.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Action; class Longitude extends Base { - protected $fieldName = 'location_longitude'; - protected $fieldType = 'float(10, 6) DEFAULT NULL'; + protected $columnName = 'location_longitude'; + protected $columnType = 'float(10, 6) DEFAULT NULL'; protected function configureSegments() { @@ -72,6 +72,6 @@ class Longitude extends Base */ public function onRecordGoal(Request $request, Visitor $visitor, $action) { - return $visitor->getVisitorColumn($this->fieldName); + return $visitor->getVisitorColumn($this->columnName); } } \ No newline at end of file diff --git a/plugins/UserCountry/Columns/Provider.php b/plugins/UserCountry/Columns/Provider.php index 27048b76c85412ff64a7334643e8b2047f6ce034..8bff75165968fd07944add96f38416e7fb3eefb9 100644 --- a/plugins/UserCountry/Columns/Provider.php +++ b/plugins/UserCountry/Columns/Provider.php @@ -16,7 +16,7 @@ use Piwik\Tracker\Request; class Provider extends Base { - protected $fieldName = 'location_provider'; + protected $columnName = 'location_provider'; public function getName() { diff --git a/plugins/UserCountry/Columns/Region.php b/plugins/UserCountry/Columns/Region.php index a7d86c41f519eb98354a570eb9d3a9adb6881437..3eadd5ea8caf4383d5d04eb12728cb36ed545dee 100644 --- a/plugins/UserCountry/Columns/Region.php +++ b/plugins/UserCountry/Columns/Region.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Action; class Region extends Base { - protected $fieldName = 'location_region'; - protected $fieldType = 'char(2) DEFAULT NULL'; + protected $columnName = 'location_region'; + protected $columnType = 'char(2) DEFAULT NULL'; protected function configureSegments() { @@ -72,6 +72,6 @@ class Region extends Base */ public function onRecordGoal(Request $request, Visitor $visitor, $action) { - return $visitor->getVisitorColumn($this->fieldName); + return $visitor->getVisitorColumn($this->columnName); } } \ No newline at end of file diff --git a/plugins/UserSettings/Columns/Browser.php b/plugins/UserSettings/Columns/Browser.php index c43a1b2d2c392a0a74762c812041d8dc1c39f998..edb9b6f150515dce4da2ae68121cde96591d40bb 100644 --- a/plugins/UserSettings/Columns/Browser.php +++ b/plugins/UserSettings/Columns/Browser.php @@ -14,8 +14,8 @@ use Piwik\Plugins\UserSettings\Segment; class Browser extends BrowserName { - protected $fieldName = 'config_browser_name'; - protected $fieldType = 'VARCHAR(10) NOT NULL'; + protected $columnName = 'config_browser_name'; + protected $columnType = 'VARCHAR(10) NOT NULL'; protected function configureSegments() { diff --git a/plugins/UserSettings/Columns/Browserversion.php b/plugins/UserSettings/Columns/Browserversion.php index 6ab88c4469750996aaab4f8a9fff4017b29f3858..29c753ba609338e918893c24fdb1fc1763573c82 100644 --- a/plugins/UserSettings/Columns/Browserversion.php +++ b/plugins/UserSettings/Columns/Browserversion.php @@ -13,8 +13,8 @@ use Piwik\Plugins\UserSettings\Segment; class BrowserVersion extends \Piwik\Plugins\DevicesDetection\Columns\BrowserVersion { - protected $fieldName = 'config_browser_version'; - protected $fieldType = 'VARCHAR(20) NOT NULL'; + protected $columnName = 'config_browser_version'; + protected $columnType = 'VARCHAR(20) NOT NULL'; protected function configureSegments() { diff --git a/plugins/UserSettings/Columns/Language.php b/plugins/UserSettings/Columns/Language.php index 989f2c1e50c671f169157d1e7df68bdee0867471..f971d75f035cb05e7245a8c211927c8fc597b272 100644 --- a/plugins/UserSettings/Columns/Language.php +++ b/plugins/UserSettings/Columns/Language.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Visitor; class Language extends VisitDimension { - protected $fieldName = 'location_browser_lang'; - protected $fieldType = 'VARCHAR(20) NOT NULL'; + protected $columnName = 'location_browser_lang'; + protected $columnType = 'VARCHAR(20) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/Operatingsystem.php b/plugins/UserSettings/Columns/Operatingsystem.php index c402f286e769fc4e2812e4051ec649b36c8a3f27..0476fdf114569d698599626fc7b91cabca92a0bf 100644 --- a/plugins/UserSettings/Columns/Operatingsystem.php +++ b/plugins/UserSettings/Columns/Operatingsystem.php @@ -14,8 +14,8 @@ use Piwik\Plugins\UserSettings\Segment; class Operatingsystem extends Os { - protected $fieldName = 'config_os'; - protected $fieldType = 'CHAR(3) NOT NULL'; + protected $columnName = 'config_os'; + protected $columnType = 'CHAR(3) NOT NULL'; protected function configureSegments() { diff --git a/plugins/UserSettings/Columns/PluginCookie.php b/plugins/UserSettings/Columns/PluginCookie.php index 8edb22a962da60af967b82f60434c0c9af88c3bd..eade14b29762587e67f72c5ea0629731308d51b6 100644 --- a/plugins/UserSettings/Columns/PluginCookie.php +++ b/plugins/UserSettings/Columns/PluginCookie.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginCookie extends VisitDimension { - protected $fieldName = 'config_cookie'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_cookie'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/PluginDirector.php b/plugins/UserSettings/Columns/PluginDirector.php index 8cbbad84d13206b2cff9043beca70c352a16dcc7..f8acc0c56b5d919b7d153ec5ae2bea5120f03714 100644 --- a/plugins/UserSettings/Columns/PluginDirector.php +++ b/plugins/UserSettings/Columns/PluginDirector.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginDirector extends VisitDimension { - protected $fieldName = 'config_director'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_director'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/PluginFlash.php b/plugins/UserSettings/Columns/PluginFlash.php index d4a6a74f3f3c2742769f41f8ea24a05efb28e1bf..ccf5efe5c2860004f4eec5237a2235af413e233c 100644 --- a/plugins/UserSettings/Columns/PluginFlash.php +++ b/plugins/UserSettings/Columns/PluginFlash.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginFlash extends VisitDimension { - protected $fieldName = 'config_flash'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_flash'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/PluginGears.php b/plugins/UserSettings/Columns/PluginGears.php index 1b7bbf3519713d13c84b35afcd8bf9b89ed8d43a..eeb9405c89f2d3c4f1f9b56ea6c949ced19e7895 100644 --- a/plugins/UserSettings/Columns/PluginGears.php +++ b/plugins/UserSettings/Columns/PluginGears.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginGears extends VisitDimension { - protected $fieldName = 'config_gears'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_gears'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/PluginJava.php b/plugins/UserSettings/Columns/PluginJava.php index 8780271f3951fd3f93f9e4753cb6eecd0cad9cae..e872bcdddb76842fcc3fde078ac807b8093e2321 100644 --- a/plugins/UserSettings/Columns/PluginJava.php +++ b/plugins/UserSettings/Columns/PluginJava.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginJava extends VisitDimension { - protected $fieldName = 'config_java'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_java'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/PluginPdf.php b/plugins/UserSettings/Columns/PluginPdf.php index 036cc7704ec4962445525e3519de966800805631..236cec3e741b0313c71f6ef597a246390f9fab07 100644 --- a/plugins/UserSettings/Columns/PluginPdf.php +++ b/plugins/UserSettings/Columns/PluginPdf.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginPdf extends VisitDimension { - protected $fieldName = 'config_pdf'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_pdf'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/PluginQuickTime.php b/plugins/UserSettings/Columns/PluginQuickTime.php index 9f918629f125372c5955979dbe3f7dcd7eb1f447..30304ecf28a9d46e5e234cfced12a733ab66df93 100644 --- a/plugins/UserSettings/Columns/PluginQuickTime.php +++ b/plugins/UserSettings/Columns/PluginQuickTime.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginQuickTime extends VisitDimension { - protected $fieldName = 'config_quicktime'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_quicktime'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/PluginRealPlayer.php b/plugins/UserSettings/Columns/PluginRealPlayer.php index c64236510d703fb39adfb87c7601e438853aaa74..cfc7c59d43ff97f529c91a233918f0021a1639b0 100644 --- a/plugins/UserSettings/Columns/PluginRealPlayer.php +++ b/plugins/UserSettings/Columns/PluginRealPlayer.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginRealPlayer extends VisitDimension { - protected $fieldName = 'config_realplayer'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_realplayer'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/PluginSilverlight.php b/plugins/UserSettings/Columns/PluginSilverlight.php index a3efca235fd82148b91831df249b93feab0709cf..a5b4e2abeae02bf024504aebb55313715af7bb08 100644 --- a/plugins/UserSettings/Columns/PluginSilverlight.php +++ b/plugins/UserSettings/Columns/PluginSilverlight.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginSilverlight extends VisitDimension { - protected $fieldName = 'config_silverlight'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_silverlight'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/PluginWindowsMedia.php b/plugins/UserSettings/Columns/PluginWindowsMedia.php index e7a084072969ef15625315163158a339e627e564..388b6acd6f1104bd22a8e545ef4780592fa1f0c9 100644 --- a/plugins/UserSettings/Columns/PluginWindowsMedia.php +++ b/plugins/UserSettings/Columns/PluginWindowsMedia.php @@ -16,8 +16,8 @@ use Piwik\Tracker\Action; class PluginWindowsMedia extends VisitDimension { - protected $fieldName = 'config_windowsmedia'; - protected $fieldType = 'TINYINT(1) NOT NULL'; + protected $columnName = 'config_windowsmedia'; + protected $columnType = 'TINYINT(1) NOT NULL'; public function getName() { diff --git a/plugins/UserSettings/Columns/Resolution.php b/plugins/UserSettings/Columns/Resolution.php index baacede4bdcb74de519f999f48bc3b43fa189db7..eddd468741ef48aabcf6eefb43a60867792adbb9 100644 --- a/plugins/UserSettings/Columns/Resolution.php +++ b/plugins/UserSettings/Columns/Resolution.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class Resolution extends VisitDimension { - protected $fieldName = 'config_resolution'; - protected $fieldType = 'VARCHAR(9) NOT NULL'; + protected $columnName = 'config_resolution'; + protected $columnType = 'VARCHAR(9) NOT NULL'; protected function configureSegments() { diff --git a/plugins/VisitTime/Columns/Localtime.php b/plugins/VisitTime/Columns/Localtime.php index d3d32d0080de74a8bba20ceac19117ba2c139dae..1deaac6a0d2622f6bb5aa5db0ff210688a83e081 100644 --- a/plugins/VisitTime/Columns/Localtime.php +++ b/plugins/VisitTime/Columns/Localtime.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class LocalTime extends VisitDimension { - protected $fieldName = 'visitor_localtime'; - protected $fieldType = 'TIME NOT NULL'; + protected $columnName = 'visitor_localtime'; + protected $columnType = 'TIME NOT NULL'; protected function configureSegments() { diff --git a/plugins/VisitTime/Columns/Servertime.php b/plugins/VisitTime/Columns/Servertime.php index 7b715651d8d41a23463d97c5b12b43745b3c5669..ad7478db6eb29a254ae39b6ef8c6276ccbfb490a 100644 --- a/plugins/VisitTime/Columns/Servertime.php +++ b/plugins/VisitTime/Columns/Servertime.php @@ -14,7 +14,7 @@ use Piwik\Plugins\VisitTime\Segment; class ServerTime extends VisitDimension { - protected $fieldName = 'visit_last_action_time'; + protected $columnName = 'visit_last_action_time'; protected function configureSegments() { diff --git a/plugins/VisitorInterest/Columns/Visitsbydayssincelastvisit.php b/plugins/VisitorInterest/Columns/Visitsbydayssincelastvisit.php index 481b7986804d4157da7aaebdc494c580f1de3774..ef39ba6d4eae2f4d29dda184e1feca02f5a096de 100644 --- a/plugins/VisitorInterest/Columns/Visitsbydayssincelastvisit.php +++ b/plugins/VisitorInterest/Columns/Visitsbydayssincelastvisit.php @@ -17,8 +17,8 @@ use Piwik\Tracker\Visitor; class VisitsByDaysSinceLastVisit extends VisitDimension { - protected $fieldName = 'visitor_days_since_last'; - protected $fieldType = 'SMALLINT(5) UNSIGNED NOT NULL'; + protected $columnName = 'visitor_days_since_last'; + protected $columnType = 'SMALLINT(5) UNSIGNED NOT NULL'; protected function configureSegments() { diff --git a/tests/PHPUnit/Fixture.php b/tests/PHPUnit/Fixture.php index 77639daa335a8b02fbbd6b963485385a7a8fa578..c609341c64331accd3b4a19cb31603bfcec79c44 100644 --- a/tests/PHPUnit/Fixture.php +++ b/tests/PHPUnit/Fixture.php @@ -29,6 +29,7 @@ use Piwik\Site; use Piwik\Tracker\Cache; use Piwik\Translate; use Piwik\Url; +use Piwik\Columns\Updates as ColumnsUpdates; /** * Base type for all integration test fixtures. Integration test fixtures @@ -152,6 +153,7 @@ class Fixture extends PHPUnit_Framework_Assert DbHelper::createTables(); \Piwik\Plugin\Manager::getInstance()->unloadPlugins(); + } catch (Exception $e) { static::fail("TEST INITIALIZATION FAILED: " . $e->getMessage() . "\n" . $e->getTraceAsString()); } @@ -300,6 +302,8 @@ class Fixture extends PHPUnit_Framework_Assert Log::info("Plugin loading messages: %s", implode(" --- ", $messages)); } + ColumnsUpdates::update(); + // Activate them foreach($plugins as $name) { if (!$pluginsManager->isPluginActivated($name)) {