コード例 #1
0
ファイル: VersionUtility.php プロジェクト: busynoggin/flux
 /**
  * @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
0
 /**
  * @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
0
 /**
  * @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
0
 /**
  * @param Dependency $dependency
  * @return bool
  */
 protected function isLoadedVersionCompatible(Dependency $dependency)
 {
     $extensionVersion = ExtensionManagementUtility::getExtensionVersion($dependency->getIdentifier());
     return $this->isVersionCompatible($extensionVersion, $dependency);
 }
コード例 #5
0
ファイル: CoreUtility.php プロジェクト: fluidtypo3/vhs
 /**
  * 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
0
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
0
 /**
  * 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
0
ファイル: Assert.php プロジェクト: punktde/pt_extbase
 /**
  * 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!'));
 }
 /**
  * @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
0
 /**
  * @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
0
 /**
  * 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
0
 /**
  * @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
0
 /**
  * @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
0
 /**
  * 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 <*****@*****.**>
  */
 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
0
$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
コード例 #16
0
ファイル: HelpTask.php プロジェクト: namelesscoder/rpc
 /**
  * @return array
  */
 protected function collectSystemInformation()
 {
     return ['typo3_version' => ExtensionManagementUtility::getExtensionVersion('core'), 'rpc_version' => ExtensionManagementUtility::getExtensionVersion('rpc'), 'php_version' => PHP_VERSION, 'server_name' => $_SERVER['SERVER_NAME'], 'server_software' => $_SERVER['SERVER_SOFTWARE'], 'server_admin' => $_SERVER['SERVER_ADMIN'], 'server_ip' => $_SERVER['SERVER_ADDR'], 'ssl' => getenv('HTTPS')];
 }
コード例 #17
0
 /**
  * Return powermail version
  *
  * @return string
  */
 public function render()
 {
     return ExtensionManagementUtility::getExtensionVersion('powermail');
 }
 /**
  * Fetches related content elements for a given news record.
  *
  * @author Christian Bülter <*****@*****.**>
  * @since 15.10.15
  * @param array $newsRecord
  * @return array
  */
 public function getAttachedContentElements($newsRecord)
 {
     // since version 3.2.0 news does not use a mm-table anymore for attached
     // content elements
     if (version_compare(ExtensionManagementUtility::getExtensionVersion('news'), '3.2.0') >= 0) {
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'tx_news_related_news=' . $newsRecord['uid'] . BackendUtility::BEenableFields('tt_content') . BackendUtility::deleteClause('tt_content'));
     } else {
         $res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('*', 'tx_news_domain_model_news', 'tx_news_domain_model_news_ttcontent_mm', 'tt_content', ' AND tx_news_domain_model_news.uid = ' . $newsRecord['uid'] . BackendUtility::BEenableFields('tt_content') . BackendUtility::deleteClause('tt_content'));
     }
     $contentElements = array();
     if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
         while ($contentElement = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
             $contentElements[] = $contentElement;
         }
     }
     return $contentElements;
 }
コード例 #19
0
 /**
  * @test
  */
 public function getExtensionVersionForLoadedExtensionReturnsExtensionVersion()
 {
     ExtensionManagementUtility::clearExtensionKeyMap();
     $uniqueSuffix = $this->getUniqueId('test');
     $extensionKey = 'unloadedextension' . $uniqueSuffix;
     $packageMetaData = $this->getMock(MetaData::class, 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));
 }
コード例 #20
0
 /**
  * Gathers Extension Information
  *
  * @return array
  */
 private function gatherInformation()
 {
     /** @var ListUtility $service */
     $service = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility');
     $extensionInformation = $service->getAvailableExtensions();
     foreach ($extensionInformation as $extensionKey => $info) {
         $extensionInformation[$extensionKey]['version'] = ExtensionManagementUtility::getExtensionVersion($extensionKey);
         if (true === array_key_exists($extensionKey, $GLOBALS['TYPO3_LOADED_EXT'])) {
             $extensionInformation[$extensionKey]['installed'] = 1;
         } else {
             $extensionInformation[$extensionKey]['installed'] = 0;
         }
     }
     return $extensionInformation;
 }
コード例 #21
0
ファイル: DBUpgrade.php プロジェクト: beyond-agentur/yag
 public function initializeObject()
 {
     $this->currentAppVersion = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getExtensionVersion('yag');
     $this->determineDatabaseVersion();
 }
コード例 #22
0
 /**
  * Database Preflight
  * @return void
  */
 protected function init()
 {
     if (!$this->getVersion()) {
         $this->setVersion(ExtensionManagementUtility::getExtensionVersion('powermail'));
     }
     if ($this->getCheckFromDatabase()) {
         $this->setIsCurrentVersionUnsecure($this->getIsCurrentVersionUnsecureFromDatabase());
         $this->setIsNewerVersionAvailable($this->getIsNewerVersionAvailableFromDatabase());
         $this->setExtensionTableExists($this->getExtensionTableExistsFromDatabase());
         $this->setCurrentVersionInExtensionTableExists($this->getCurrentVersionInExtensionTableExistsFromDatabase());
     }
 }