本文整理汇总了PHP中Piwik\Updater::getCurrentComponentVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP Updater::getCurrentComponentVersion方法的具体用法?PHP Updater::getCurrentComponentVersion怎么用?PHP Updater::getCurrentComponentVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Updater
的用法示例。
在下文中一共展示了Updater::getCurrentComponentVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: throwIfPiwikVersionIsOlderThanDBSchema
/**
* This method ensures that Piwik Platform cannot be running when using a NEWER database.
*/
private function throwIfPiwikVersionIsOlderThanDBSchema()
{
// When developing this situation happens often when switching branches
if (Development::isEnabled()) {
return;
}
$updater = new Updater();
$dbSchemaVersion = $updater->getCurrentComponentVersion('core');
$current = Version::VERSION;
if (-1 === version_compare($current, $dbSchemaVersion)) {
$messages = array(Piwik::translate('General_ExceptionDatabaseVersionNewerThanCodebase', array($current, $dbSchemaVersion)), Piwik::translate('General_ExceptionDatabaseVersionNewerThanCodebaseWait'), Piwik::translate('General_ExceptionContactSupportGeneric', array('', '')));
throw new DatabaseSchemaIsNewerThanCodebaseException(implode(" ", $messages));
}
}
示例2: mixinVersions
/**
* @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;
}
示例3: getCurrentVersionForCore
private function getCurrentVersionForCore(Updater $updater)
{
$currentVersion = $updater->getCurrentComponentVersion('core');
if ($currentVersion === false) {
$currentVersion = "<= 0.2.9";
}
return $currentVersion;
}
示例4: getCurrentRecordedComponentVersion
/**
* Retrieve the current version of a recorded component
* @param string $name
* @return false|string
* @throws \Exception
*/
public static function getCurrentRecordedComponentVersion($name)
{
return self::$activeInstance->getCurrentComponentVersion($name);
}