示例#1
0
 /**
  * @param ActionDimension|ConversionDimension|VisitDimension $dimension
  * @param string $componentPrefix
  * @param array $columns
  * @param array $versions
  * @return array The modified versions array
  */
 private static function mixinVersions($dimension, $componentPrefix, $columns, $versions)
 {
     $columnName = $dimension->getColumnName();
     if (!$columnName || !$dimension->hasColumnType()) {
         return $versions;
     }
     $component = $componentPrefix . $columnName;
     $version = $dimension->getVersion();
     if (array_key_exists($columnName, $columns) && false === PiwikUpdater::getCurrentRecordedComponentVersion($component) && self::wasDimensionMovedFromCoreToPlugin($component, $version)) {
         PiwikUpdater::recordComponentSuccessfullyUpdated($component, $version);
         return $versions;
     }
     $versions[$component] = $version;
     return $versions;
 }
示例#2
0
文件: Manager.php 项目: 962464/piwik
 /**
  * @param VisitDimension|ActionDimension|ConversionDimension $dimension
  * @param VisitDimension[]|ActionDimension[]|ConversionDimension[] $allDimensions
  * @return bool
  */
 private function doesAnotherPluginDefineSameColumnWithDbEntry($dimension, $allDimensions)
 {
     $module = $dimension->getModule();
     $columnName = $dimension->getColumnName();
     foreach ($allDimensions as $dim) {
         if ($dim->getColumnName() === $columnName && $dim->hasColumnType() && $dim->getModule() !== $module) {
             return true;
         }
     }
     return false;
 }
示例#3
0
 /**
  * @param ActionDimension|ConversionDimension|VisitDimension $dimension
  * @param string $componentPrefix
  * @param array $columns
  * @param array $versions
  * @return array The modified versions array
  */
 private function mixinVersions(PiwikUpdater $updater, $dimension, $componentPrefix, $columns, $versions)
 {
     $columnName = $dimension->getColumnName();
     // dimensions w/o columns do not need DB updates
     if (!$columnName || !$dimension->hasColumnType()) {
         return $versions;
     }
     $component = $componentPrefix . $columnName;
     $version = $dimension->getVersion();
     // if the column exists in the table, but has no associated version, and was one of the core columns
     // that was moved when the dimension refactor took place, then:
     // - set the installed version in the DB to the current code version
     // - and do not check for updates since we just set the version to the latest
     if (array_key_exists($columnName, $columns) && false === $updater->getCurrentComponentVersion($component) && self::wasDimensionMovedFromCoreToPlugin($component, $version)) {
         $updater->markComponentSuccessfullyUpdated($component, $version);
         return $versions;
     }
     $versions[$component] = $version;
     return $versions;
 }