Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Columns/Dimension.php76
-rw-r--r--core/Columns/Updates.php110
-rw-r--r--core/Db/Schema.php11
-rw-r--r--core/Db/Schema/Mysql.php20
-rw-r--r--core/Db/SchemaInterface.php8
-rw-r--r--core/DbHelper.php11
-rw-r--r--core/Plugin/ActionDimension.php86
-rw-r--r--core/Plugin/Manager.php29
-rw-r--r--core/Plugin/VisitDimension.php129
-rw-r--r--core/Tracker/Action.php4
-rw-r--r--core/Tracker/GoalManager.php2
-rw-r--r--core/Tracker/Visit.php2
-rw-r--r--core/Tracker/Visitor.php2
-rw-r--r--core/Updater.php60
-rw-r--r--plugins/Actions/Columns/EntryPageTitle.php4
-rw-r--r--plugins/Actions/Columns/EntryPageUrl.php4
-rw-r--r--plugins/Actions/Columns/ExitPageTitle.php4
-rw-r--r--plugins/Actions/Columns/ExitPageUrl.php4
-rw-r--r--plugins/Actions/Columns/PageTitle.php4
-rw-r--r--plugins/Actions/Columns/PageUrl.php4
-rw-r--r--plugins/Actions/Columns/ServerTime.php18
-rw-r--r--plugins/Actions/Columns/TimeSpentRefAction.php4
-rw-r--r--plugins/Actions/Columns/VisitTotalActions.php4
-rw-r--r--plugins/Actions/Columns/VisitTotalSearches.php4
-rw-r--r--plugins/CoreHome/Columns/IdSite.php2
-rw-r--r--plugins/CoreHome/Columns/VisitFirstActionTime.php4
-rw-r--r--plugins/CoreHome/Columns/VisitGoalBuyer.php6
-rw-r--r--plugins/CoreHome/Columns/VisitGoalConverted.php4
-rw-r--r--plugins/CoreHome/Columns/VisitLastActionTime.php2
-rw-r--r--plugins/CoreHome/Columns/VisitTotalTime.php4
-rw-r--r--plugins/CoreHome/Columns/VisitorDaysSinceFirst.php6
-rw-r--r--plugins/CoreHome/Columns/VisitorDaysSinceOrder.php6
-rw-r--r--plugins/CoreHome/Columns/VisitorReturning.php6
-rw-r--r--plugins/CoreHome/Columns/VisitsCount.php6
-rw-r--r--plugins/CoreUpdater/CoreUpdater.php21
-rw-r--r--plugins/DevicesDetection/Columns/BrowserName.php2
-rw-r--r--plugins/DevicesDetection/Columns/BrowserVersion.php2
-rw-r--r--plugins/DevicesDetection/Columns/DeviceBrand.php4
-rw-r--r--plugins/DevicesDetection/Columns/DeviceModel.php4
-rw-r--r--plugins/DevicesDetection/Columns/DeviceType.php4
-rw-r--r--plugins/DevicesDetection/Columns/Os.php2
-rw-r--r--plugins/DevicesDetection/Columns/OsVersion.php4
-rw-r--r--plugins/Events/Columns/EventAction.php4
-rw-r--r--plugins/Events/Columns/EventCategory.php4
-rw-r--r--plugins/Events/Columns/EventName.php2
-rw-r--r--plugins/Events/Columns/TotalEvents.php4
-rw-r--r--plugins/Goals/Columns/IdGoal.php2
-rw-r--r--plugins/Provider/Columns/Provider.php2
-rw-r--r--plugins/Referrers/Columns/Base.php4
-rw-r--r--plugins/Referrers/Columns/Keyword.php4
-rw-r--r--plugins/Referrers/Columns/ReferrerName.php4
-rw-r--r--plugins/Referrers/Columns/ReferrerType.php4
-rw-r--r--plugins/Referrers/Columns/ReferrerUrl.php4
-rw-r--r--plugins/Referrers/Columns/ReferrerVisitServerDate.php4
-rw-r--r--plugins/UserCountry/Columns/City.php6
-rw-r--r--plugins/UserCountry/Columns/Country.php6
-rw-r--r--plugins/UserCountry/Columns/Latitude.php6
-rw-r--r--plugins/UserCountry/Columns/Longitude.php6
-rw-r--r--plugins/UserCountry/Columns/Provider.php2
-rw-r--r--plugins/UserCountry/Columns/Region.php6
-rw-r--r--plugins/UserSettings/Columns/Browser.php4
-rw-r--r--plugins/UserSettings/Columns/Browserversion.php4
-rw-r--r--plugins/UserSettings/Columns/Language.php4
-rw-r--r--plugins/UserSettings/Columns/Operatingsystem.php4
-rw-r--r--plugins/UserSettings/Columns/PluginCookie.php4
-rw-r--r--plugins/UserSettings/Columns/PluginDirector.php4
-rw-r--r--plugins/UserSettings/Columns/PluginFlash.php4
-rw-r--r--plugins/UserSettings/Columns/PluginGears.php4
-rw-r--r--plugins/UserSettings/Columns/PluginJava.php4
-rw-r--r--plugins/UserSettings/Columns/PluginPdf.php4
-rw-r--r--plugins/UserSettings/Columns/PluginQuickTime.php4
-rw-r--r--plugins/UserSettings/Columns/PluginRealPlayer.php4
-rw-r--r--plugins/UserSettings/Columns/PluginSilverlight.php4
-rw-r--r--plugins/UserSettings/Columns/PluginWindowsMedia.php4
-rw-r--r--plugins/UserSettings/Columns/Resolution.php4
-rw-r--r--plugins/VisitTime/Columns/Localtime.php4
-rw-r--r--plugins/VisitTime/Columns/Servertime.php2
-rw-r--r--plugins/VisitorInterest/Columns/Visitsbydayssincelastvisit.php4
-rw-r--r--tests/PHPUnit/Fixture.php4
79 files changed, 515 insertions, 326 deletions
diff --git a/core/Columns/Dimension.php b/core/Columns/Dimension.php
new file mode 100644
index 0000000000..26ede26f72
--- /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 0000000000..30cfa017cd
--- /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 834dfdda36..5c0e9ada1b 100644
--- a/core/Db/Schema.php
+++ b/core/Db/Schema.php
@@ -234,6 +234,17 @@ class Schema extends Singleton
}
/**
+ * 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
*
* @return bool True if tables exist; false otherwise
diff --git a/core/Db/Schema/Mysql.php b/core/Db/Schema/Mysql.php
index 7521634080..cb055e5354 100644
--- a/core/Db/Schema/Mysql.php
+++ b/core/Db/Schema/Mysql.php
@@ -316,6 +316,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
*
* @param bool $forceReload Invalidate cache
diff --git a/core/Db/SchemaInterface.php b/core/Db/SchemaInterface.php
index a8a3771ac5..eead12a87a 100644
--- a/core/Db/SchemaInterface.php
+++ b/core/Db/SchemaInterface.php
@@ -88,6 +88,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
*
* @return bool True if tables exist; false otherwise
diff --git a/core/DbHelper.php b/core/DbHelper.php
index df616b2cd6..3fc6b482fc 100644
--- a/core/DbHelper.php
+++ b/core/DbHelper.php
@@ -29,6 +29,17 @@ class DbHelper
}
/**
+ * 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.
*
* Example:
diff --git a/core/Plugin/ActionDimension.php b/core/Plugin/ActionDimension.php
index 05107382ff..2de05c3ee5 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 653963d5e0..3bbbf0084f 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 a4c205e7e3..eb2f8ffbd3 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 665c3eb447..d73094e280 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 d33a331ba8..1706f4ac25 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 8904682139..806c694f1a 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 627982e455..1c6a7cf89c 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 6d46bbf147..d0b2fd9ad3 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 8b341a1c4f..7d67002a8f 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 96acc84d28..a5d20a3859 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 71aaeed897..6a1f2948aa 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 b22246039c..dc83358ce1 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 94f3b09dd6..5dbbecdac6 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 e36a3db163..c6c149ee61 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 c32705a3eb..4273d553e5 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 a65067ca68..10485e1fb8 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 0520160174..37f8acfba2 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 059f4a512a..47eec61b1e 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 c367764c72..471e01f98d 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 d74458dc9f..1836fe8c73 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 d371d85ec3..5a1f98279c 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 66398b9ce3..56d13f7643 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 b4ad30c214..e261f81ef4 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 36f885b135..a529bbdef3 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 2bb1f3c2e2..22e6bb5850 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 8a3b6b0dbe..5b961b27f3 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 aed4ec4d72..6f66225cb8 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 d1e0069df6..26e29fc751 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 cbd563e8b0..d928b4bb26 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 bc13acbcc8..1237d6676b 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 20666f3265..1fa60f3ab2 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 4ac550fa12..d5b06617ec 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 ae5dacb517..488eeb615e 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 3e243a4754..37b7cc0679 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 f6c770dc19..599edb3285 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 786db1ef75..e9913f740e 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 bb02fc4ad1..a2d48266f8 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 83eb004c3e..fdba5c5ece 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 1a612d9df9..c769cb3c51 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 eab3e5e75f..ee779ca80b 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 9d3c009281..e519cdfef3 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 95921411fe..9d1c0aa57c 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 0c98357b06..34615dcba7 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 f084cc6b51..b41f093786 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 98f7f4c45f..9ed8eba2b8 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 4313ea9d8a..81ade6ea2d 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 9ceb8bc035..0b8d779794 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 2d2da3bed6..258c591130 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 7eeb3e9a84..c0685c6f3d 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 2ef8a06eb3..3f2751da1a 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 7b5b655b7e..7b195eec40 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 c47a7a5162..969b39033f 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 27048b76c8..8bff751659 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 a7d86c41f5..3eadd5ea8c 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 c43a1b2d2c..edb9b6f150 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 6ab88c4469..29c753ba60 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 989f2c1e50..f971d75f03 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 c402f286e7..0476fdf114 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 8edb22a962..eade14b297 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 8cbbad84d1..f8acc0c56b 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 d4a6a74f3f..ccf5efe5c2 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 1b7bbf3519..eeb9405c89 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 8780271f39..e872bcdddb 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 036cc7704e..236cec3e74 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 9f918629f1..30304ecf28 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 c64236510d..cfc7c59d43 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 a3efca235f..a5b4e2abea 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 e7a0840729..388b6acd6f 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 baacede4bd..eddd468741 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 d3d32d0080..1deaac6a0d 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 7b715651d8..ad7478db6e 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 481b798680..ef39ba6d4e 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 77639daa33..c609341c64 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)) {