本文整理汇总了PHP中TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManagementUtility::getExtensionVersion方法的具体用法?PHP ExtensionManagementUtility::getExtensionVersion怎么用?PHP ExtensionManagementUtility::getExtensionVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\ExtensionManagementUtility
的用法示例。
在下文中一共展示了ExtensionManagementUtility::getExtensionVersion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertExtensionVersionIsAtLeastVersion
/**
* @param string $extensionKey
* @param integer $majorVersion
* @param integer $minorVersion
* @param integer $bugfixVersion
* @return boolean
*/
public static function assertExtensionVersionIsAtLeastVersion($extensionKey, $majorVersion, $minorVersion = 0, $bugfixVersion = 0)
{
if (FALSE === ExtensionManagementUtility::isLoaded($extensionKey)) {
return FALSE;
}
$extensionVersion = ExtensionManagementUtility::getExtensionVersion($extensionKey);
list($major, $minor, $bugfix) = explode('.', $extensionVersion);
return $majorVersion <= $major && $minorVersion <= $minor && $bugfixVersion <= $bugfix;
}
示例2: saveExtensionConfiguration
/**
* @param \EBT\ExtensionBuilder\Domain\Model\Extension $extension
*/
public function saveExtensionConfiguration(\EBT\ExtensionBuilder\Domain\Model\Extension $extension)
{
$extensionBuildConfiguration = $this->configurationManager->getConfigurationFromModeler();
$extensionBuildConfiguration['log'] = array('last_modified' => date('Y-m-d h:i'), 'extension_builder_version' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion('extension_builder'), 'be_user' => $GLOBALS['BE_USER']->user['realName'] . ' (' . $GLOBALS['BE_USER']->user['uid'] . ')');
$encodeOptions = 0;
// option JSON_PRETTY_PRINT is available since PHP 5.4.0
if (defined('JSON_PRETTY_PRINT')) {
$encodeOptions |= JSON_PRETTY_PRINT;
}
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($extension->getExtensionDir() . \EBT\ExtensionBuilder\Configuration\ConfigurationManager::EXTENSION_BUILDER_SETTINGS_FILE, json_encode($extensionBuildConfiguration, $encodeOptions));
}
示例3: displayHelpIndex
/**
* @return void
*/
protected function displayHelpIndex()
{
$this->buildCommandsIndex();
$this->outputLine('Extbase %s', array(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion('extbase')));
$this->outputLine('usage: ' . $this->request->getCallingScript() . ' <command identifier>');
$this->outputLine();
$this->outputLine('The following commands are currently available:');
foreach ($this->commandsByExtensionsAndControllers as $extensionKey => $commandControllers) {
$this->outputLine('');
$this->outputLine('EXTENSION "%s":', array(strtoupper($extensionKey)));
$this->outputLine(str_repeat('-', $this->output->getMaximumLineLength()));
foreach ($commandControllers as $commands) {
foreach ($commands as $command) {
$description = wordwrap($command->getShortDescription(), $this->output->getMaximumLineLength() - 43, PHP_EOL . str_repeat(' ', 43), TRUE);
$shortCommandIdentifier = $this->commandManager->getShortestIdentifierForCommand($command);
$this->outputLine('%-2s%-40s %s', array(' ', $shortCommandIdentifier, $description));
}
$this->outputLine();
}
}
$this->outputLine('See \'' . $this->request->getCallingScript() . ' help <command identifier>\' for more information about a specific command.');
$this->outputLine();
}
示例4: isLoadedVersionCompatible
/**
* @param Dependency $dependency
* @return bool
*/
protected function isLoadedVersionCompatible(Dependency $dependency)
{
$extensionVersion = ExtensionManagementUtility::getExtensionVersion($dependency->getIdentifier());
return $this->isVersionCompatible($extensionVersion, $dependency);
}
示例5: getCurrentCoreVersion
/**
* Returns the current core minor version
*
* @return string
* @throws \TYPO3\CMS\Core\Package\Exception
*/
public static function getCurrentCoreVersion()
{
return substr(ExtensionManagementUtility::getExtensionVersion('core'), 0, 3);
}
示例6: unset
if (!$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]['disablePageTsTCEMAIN']) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/PageTS/TCEMAIN.txt">');
}
// TCEFORM
if (!$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]['disablePageTsTCEFORM']) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/PageTS/TCEFORM.txt">');
}
// Configure the RTE to match the needs of Bootstrap Package
if (!$GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]['disablePageTsRTE']) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/PageTS/RTE.txt">');
}
/***************
* Add Bootstrap Package autoconfig to realurl
*/
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('realurl')) {
$realUrlVersion = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion('realurl');
if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($realUrlVersion) < 2000000) {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration'][$_EXTKEY] = 'BK2K\\BootstrapPackage\\Hooks\\RealUrl\\AutoConfig->addConfigVersion1x';
} else {
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration'][$_EXTKEY] = 'BK2K\\BootstrapPackage\\Hooks\\RealUrl\\AutoConfig->addConfigVersion2x';
}
unset($realUrlVersion);
}
if (TYPO3_MODE === 'BE') {
/**
* Provides an example .htaccess file for Apache after extension is installed and shows a warning if TYPO3 is not running on Apache.
*/
$signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
$signalSlotDispatcher->connect('TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService', 'hasInstalledExtensions', 'BK2K\\BootstrapPackage\\Service\\InstallService', 'generateApacheHtaccess');
}
/***************
示例7: execute
/**
* Main method
*
* @throws \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
* @throws \Exception
* @return FlashMessage
*/
public function execute()
{
$this->controller->headerMessage(LocalizationUtility::translate('migrateDamMetadataCommand', 'dam_falmigration'));
if (!$this->isTableAvailable('tx_dam')) {
return $this->getResultMessage('damTableNotFound');
}
$res = $this->execSelectMigratedSysFilesQuery();
$total = $this->database->sql_num_rows($res);
$counter = 0;
$this->controller->infoMessage('Found ' . $total . ' migrated sys_file records');
$this->isInstalledFileMetadata = ExtensionManagementUtility::isLoaded('filemetadata');
$this->isInstalledLegacyMedia = ExtensionManagementUtility::isLoaded('media') && intval(ExtensionManagementUtility::getExtensionVersion('media')) < 3;
while ($record = $this->database->sql_fetch_assoc($res)) {
$this->database->exec_UPDATEquery('sys_file_metadata', 'uid = ' . $record['metadata_uid'], $this->createArrayForUpdateSysFileMetadataRecord($record));
$this->database->exec_UPDATEquery('sys_file', 'uid = ' . $record['file_uid'], $this->createArrayForUpdateSysFileRecord($record));
$this->controller->message(number_format(100 * ($counter / $total), 1) . '% of ' . $total . ' id: ' . $record['file_uid']);
$this->amountOfMigratedRecords++;
$counter++;
}
$this->database->sql_free_result($res);
return $this->getResultMessage();
}
示例8: extensionIsLoaded
/**
* Tests if an extension is loaded with an optionally given version.
*
* @param string $extensionKey Extension key of the extension that we want to be loaded
* @param string $version Version of the extension that we want to have loaded
*/
public static function extensionIsLoaded($extensionKey, $version = '0.0.0')
{
// Check whether extension is loaded at all
self::isTrue(ExtensionManagementUtility::isLoaded($extensionKey), array('message' => 'Extension ' . $extensionKey . ' is not loaded!'));
// Check whether extension is loaded with required version
list($sanitizedVersion, ) = explode('-', $version);
$loadedVersion = ExtensionManagementUtility::getExtensionVersion($extensionKey);
self::test(version_compare($sanitizedVersion, $loadedVersion) >= 0, true, array('message' => 'Extension ' . $extensionKey . ' was installed with version ' . $loadedVersion . ' but version ' . $version . ' is required!'));
}
示例9: getExtensionVersionForLoadedExtensionReturnsExtensionVersion
/**
* @test
*/
public function getExtensionVersionForLoadedExtensionReturnsExtensionVersion()
{
ExtensionManagementUtility::clearExtensionKeyMap();
$className = $this->getUniqueId('ExtensionManagementUtility');
eval('namespace ' . __NAMESPACE__ . ';' . 'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility {' . ' public static function isLoaded() {' . ' return TRUE;' . ' }' . '}');
$className = __NAMESPACE__ . '\\' . $className;
ExtensionManagementUtility::clearExtensionKeyMap();
$uniqueSuffix = $this->getUniqueId('test');
$extensionKey = 'unloadedextension' . $uniqueSuffix;
$packageMetaData = $this->getMock('TYPO3\\Flow\\Package\\MetaData', array('getVersion'), array($extensionKey));
$packageMetaData->expects($this->any())->method('getVersion')->will($this->returnValue('1.2.3'));
$packageManager = $this->createMockPackageManagerWithMockPackage($extensionKey, array('getPackagePath', 'getPackageKey', 'getPackageMetaData'));
/** @var \PHPUnit_Framework_MockObject_MockObject $package */
$package = $packageManager->getPackage($extensionKey);
$package->expects($this->any())->method('getPackageMetaData')->will($this->returnValue($packageMetaData));
ExtensionManagementUtility::setPackageManager($packageManager);
$this->assertEquals('1.2.3', ExtensionManagementUtility::getExtensionVersion($extensionKey));
}
示例10: segmentsToArguments
/**
* @param string $extensionKey
* @param array $segments
* @return array
*/
protected function segmentsToArguments($extensionKey, $segments)
{
$arguments = array('extensionKey' => $extensionKey, 'version' => ExtensionManagementUtility::getExtensionVersion($extensionKey));
foreach ($segments as $index => $segment) {
$arguments['p' . ($index + 1)] = $segment;
}
return $arguments;
}
示例11: compareVersion
/**
* check version of static_info_tables_LANGUAGE
*
* @param $langKey
* @param $version
*
* @return boolean
*/
protected function compareVersion($langKey, $version)
{
return version_compare(ExtensionManagementUtility::getExtensionVersion('static_info_tables_' . $langKey), $version) >= 0;
}
示例12: getExtensionVersionForNotLoadedExtensionReturnsEmptyString
/**
* @test
*/
public function getExtensionVersionForNotLoadedExtensionReturnsEmptyString()
{
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::clearExtensionKeyMap();
$uniqueSuffix = uniqid('test');
$extensionKey = 'unloadedextension' . $uniqueSuffix;
$this->assertEquals('', \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion($extensionKey));
}
示例13: isLoadedVersionCompatible
/**
* @param \TYPO3\CMS\Extensionmanager\Domain\Model\Dependency $dependency
* @return boolean
*/
protected function isLoadedVersionCompatible(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency $dependency)
{
$extensionVersion = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion($dependency->getIdentifier());
return $this->isVersionCompatible($extensionVersion, $dependency);
}
示例14: getTemplateSource
/**
* Resolve the template path and filename for the given action. If $actionName
* is NULL, looks into the current request.
*
* @param string $actionName Name of the action. If NULL, will be taken from request.
* @throws InvalidTemplateResourceException
* @throws \TYPO3\CMS\Core\Package\Exception
* @return string Full path to template
* @author Sebastian Kurfürst <sebastian@typo3.org>
*/
protected function getTemplateSource($actionName = null)
{
/**
* As in 1.3.0 resolving was part of this method we had to overwrite the complete method
* This is not longer necessary in Version 1.4.0
*/
if (substr(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion('fluid'), 0, 3) == '1.4') {
return parent::getTemplateSource($actionName);
}
if ($this->templatePathAndFilename !== null) {
$templatePathAndFilename = $this->templatePathAndFilename;
} else {
$actionName = $actionName !== null ? $actionName : $this->controllerContext->getRequest()->getControllerActionName();
$actionName = ucfirst($actionName);
$paths = $this->expandGenericPathPattern($this->templatePathAndFilenamePattern, false, false);
$paths[] = $this->getTemplatePathAndFilename($actionName);
$found = false;
foreach ($paths as &$templatePathAndFilename) {
// These tokens are replaced by the Backporter for the graceful fallback in version 4.
$fallbackPath = str_replace('@action', strtolower($actionName), $templatePathAndFilename);
$templatePathAndFilename = str_replace('@action', $actionName, $templatePathAndFilename);
if (file_exists($templatePathAndFilename)) {
$found = true;
break;
} elseif (file_exists($fallbackPath)) {
$found = true;
$templatePathAndFilename = $fallbackPath;
GeneralUtility::deprecationLog('the template filename "' . $fallbackPath . '" is lowercase. This is deprecated since TYPO3 4.4. Please rename the template to "' . basename($templatePathAndFilename) . '"');
break;
}
}
if (!$found) {
throw new InvalidTemplateResourceException('Template could not be loaded. I tried "' . implode('", "', $paths) . '"', 1225709595);
}
}
$templateSource = file_get_contents($templatePathAndFilename);
if ($templateSource === false) {
throw new InvalidTemplateResourceException('"' . $templatePathAndFilename . '" is not a valid template resource URI.', 1257246929);
}
return $templateSource;
}
示例15: exec
$userTSConfig = GeneralUtility::getUrl($userTSConfigAbsFileName);
$userTSConfig = str_replace('###PACKAGE_KEY###', $_EXTKEY, $userTSConfig);
ExtensionManagementUtility::addUserTSConfig($userTSConfig);
# Register constants to use package key and version in TS later
if (TYPO3_MODE === 'FE') {
$packageVersion = exec('git --git-dir="' . ExtensionManagementUtility::extPath($_EXTKEY) . '/.git" describe --tags --always --long');
$packageVersion .= ' (' . exec('git --git-dir="' . ExtensionManagementUtility::extPath($_EXTKEY) . '/.git" rev-parse --abbrev-ref HEAD') . ')';
} else {
$packageVersion = '(only available in FE mode)';
}
ExtensionManagementUtility::addTypoScriptConstants('plugin.templatebootstrap.packageKey=' . $_EXTKEY);
ExtensionManagementUtility::addTypoScriptConstants('plugin.templatebootstrap.packageVersion=' . $packageVersion);
$environment = $settings['environment'];
ExtensionManagementUtility::addTypoScriptConstants('plugin.templatebootstrap.environment=' . $environment);
# Do not change this. It is used to identify which templatebootstrap version this package is originally derived from.
ExtensionManagementUtility::addTypoScriptConstants('plugin.templatebootstrap.bootstrapPackageVersion=' . ExtensionManagementUtility::getExtensionVersion($_EXTKEY));
# Load constants & setup
ExtensionManagementUtility::addTypoScript($_EXTKEY, 'constants', '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Resources/Private/TypoScript/constants.ts">', $_EXTKEY . '/Configuration/TypoScript/');
ExtensionManagementUtility::addTypoScript($_EXTKEY, 'setup', '<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Resources/Private/TypoScript/setup.ts">', $_EXTKEY . '/Configuration/TypoScript/');
# Register extconf variable to use in scripts
# (such as the layout provider hook)
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['Staempfli/TemplateBootstrap']['PackageKey'] = $_EXTKEY;
/******************************
* Add mood image and background image
* to the page overlay field list.
* Inheritance (rootline
* functionality) will be implemented by
* the TSRootLineMedia class.
******************************/
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields'] .= ',tx_' . $_EXTKEY . '_moodimage,tx_' . $_EXTKEY . '_backgroundimage';
# Use signal 'afterExtensionConfigurationWrite' to handle post installation tasks