本文整理汇总了PHP中TYPO3\CMS\Core\Utility\ExtensionManagementUtility::unloadExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManagementUtility::unloadExtension方法的具体用法?PHP ExtensionManagementUtility::unloadExtension怎么用?PHP ExtensionManagementUtility::unloadExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\ExtensionManagementUtility
的用法示例。
在下文中一共展示了ExtensionManagementUtility::unloadExtension方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeAction
/**
* Uninstall one or multiple extensions
* Extension keys are read from get vars, more than one extension has to be comma separated
* Cache is cleared "hard" after uninstalling
*
* @return string "OK"
*/
protected function executeAction()
{
$getVars = Utility\GeneralUtility::_GET('install');
if (isset($getVars['uninstallExtension']) && isset($getVars['uninstallExtension']['extensions'])) {
$extensionsToUninstall = Utility\GeneralUtility::trimExplode(',', $getVars['uninstallExtension']['extensions']);
foreach ($extensionsToUninstall as $extension) {
if (Utility\ExtensionManagementUtility::isLoaded($extension)) {
Utility\ExtensionManagementUtility::unloadExtension($extension);
}
}
}
return 'OK';
}
示例2: executeAction
/**
* Uninstall one or multiple extensions
* Extension keys are read from get vars, more than one extension has to be comma separated
*
* @return string "OK" on success, the error message otherwise
*/
protected function executeAction()
{
$getVars = GeneralUtility::_GET('install');
if (isset($getVars['uninstallExtension']) && isset($getVars['uninstallExtension']['extensions'])) {
$extensionsToUninstall = GeneralUtility::trimExplode(',', $getVars['uninstallExtension']['extensions']);
foreach ($extensionsToUninstall as $extension) {
if (ExtensionManagementUtility::isLoaded($extension)) {
try {
ExtensionManagementUtility::unloadExtension($extension);
} catch (\Exception $e) {
return $e->getMessage();
}
}
}
}
return 'OK';
}
示例3: unloadExtensionCallsPackageManagerToDeactivatePackage
/**
* @test
*/
public function unloadExtensionCallsPackageManagerToDeactivatePackage()
{
$packageName = $this->getUniqueId('foo');
/** @var PackageManager|\PHPUnit_Framework_MockObject_MockObject $packageManager */
$packageManager = $this->getMock(PackageManager::class, array('isPackageActive', 'deactivatePackage'));
$packageManager->expects($this->any())->method('isPackageActive')->will($this->returnValue(TRUE));
$packageManager->expects($this->once())->method('deactivatePackage')->with($packageName);
ExtensionManagementUtility::setPackageManager($packageManager);
ExtensionManagementUtility::unloadExtension($packageName);
}
示例4: unloadExtensionCallsPackageManagerToDeactivatePackage
/**
* @test
*/
public function unloadExtensionCallsPackageManagerToDeactivatePackage()
{
$packageName = $this->getUniqueId('foo');
$packageManager = $this->getMock('TYPO3\\CMS\\Core\\Package\\PackageManager', array('isPackageActive', 'deactivatePackage'));
$packageManager->expects($this->any())->method('isPackageActive')->will($this->returnValue(TRUE));
$packageManager->expects($this->once())->method('deactivatePackage')->with($packageName);
ExtensionManagementUtility::setPackageManager($packageManager);
ExtensionManagementUtility::unloadExtension($packageName);
}
示例5: executeUnloadDbalExtension
/**
* Remove dbal and adodb from list of loaded extensions
*
* @return \TYPO3\CMS\Install\Status\StatusInterface
*/
protected function executeUnloadDbalExtension()
{
if (ExtensionManagementUtility::isLoaded('adodb')) {
ExtensionManagementUtility::unloadExtension('adodb');
}
if (ExtensionManagementUtility::isLoaded('dbal')) {
ExtensionManagementUtility::unloadExtension('dbal');
}
// @TODO: Remove configuration from TYPO3_CONF_VARS['EXTCONF']['dbal']
/** @var $errorStatus \TYPO3\CMS\Install\Status\WarningStatus */
$warningStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\WarningStatus::class);
$warningStatus->setTitle('Removed database abstraction layer');
return $warningStatus;
}
示例6: prepareExtensionForImport
/**
* Prepares an extension for import from TER
* Uninstalls the extension if it is already loaded (case: update)
* and reloads the caches.
*
* @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
* @return void
*/
protected function prepareExtensionForImport(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
{
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extension->getExtensionKey())) {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::unloadExtension($extension->getExtensionKey());
$this->installUtility->reloadCaches();
}
}
示例7: unloadExtension
/**
* Wrapper function for unloading extensions
*
* @param string $extensionKey
* @return void
*/
protected function unloadExtension($extensionKey)
{
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::unloadExtension($extensionKey);
}