本文整理汇总了PHP中TYPO3\CMS\Core\Utility\ExtensionManagementUtility::deactivateService方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManagementUtility::deactivateService方法的具体用法?PHP ExtensionManagementUtility::deactivateService怎么用?PHP ExtensionManagementUtility::deactivateService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\ExtensionManagementUtility
的用法示例。
在下文中一共展示了ExtensionManagementUtility::deactivateService方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeInstanceService
/**
* Find the best service and check if it works.
* Returns object of the service class.
*
* @param string $serviceType Type of service (service key).
* @param string $serviceSubType Sub type like file extensions or similar. Defined by the service.
* @param mixed $excludeServiceKeys List of service keys which should be excluded in the search for a service. Array or comma list.
* @return object The service object or an array with error info's.
*/
public static function makeInstanceService($serviceType, $serviceSubType = '', $excludeServiceKeys = array())
{
$error = FALSE;
if (!is_array($excludeServiceKeys)) {
$excludeServiceKeys = self::trimExplode(',', $excludeServiceKeys, TRUE);
}
$requestInfo = array('requestedServiceType' => $serviceType, 'requestedServiceSubType' => $serviceSubType, 'requestedExcludeServiceKeys' => $excludeServiceKeys);
while ($info = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::findService($serviceType, $serviceSubType, $excludeServiceKeys)) {
// provide information about requested service to service object
$info = array_merge($info, $requestInfo);
// Check persistent object and if found, call directly and exit.
if (is_object($GLOBALS['T3_VAR']['makeInstanceService'][$info['className']])) {
// update request info in persistent object
$GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->info = $info;
// reset service and return object
$GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->reset();
return $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']];
} else {
if (isset($info['classFile'])) {
// @deprecated since 6.1, will be removed in TYPO3 CMS 6.3
// Option is deprecated, since we now have the autoloader function
self::deprecationLog('The option "classFile" of "' . $info['className'] . '" in T3_SERVICES has been deprecated, as this should now be done by the respective ' . 'ext_autoload.php of each extension. This option will be removed in TYPO3 CMS v6.3.');
$requireFile = self::getFileAbsFileName($info['classFile']);
if (@is_file($requireFile)) {
self::requireOnce($requireFile);
}
}
$obj = self::makeInstance($info['className']);
if (is_object($obj)) {
if (!@is_callable(array($obj, 'init'))) {
// use silent logging??? I don't think so.
die('Broken service:' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($info));
}
$obj->info = $info;
// service available?
if ($obj->init()) {
// create persistent object
$GLOBALS['T3_VAR']['makeInstanceService'][$info['className']] = $obj;
return $obj;
}
$error = $obj->getLastErrorArray();
unset($obj);
}
}
// deactivate the service
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::deactivateService($info['serviceType'], $info['serviceKey']);
}
return $error;
}
示例2: deactivateService
/**
* Deactivate the service. Use this if the service fails at runtime and will not be available.
*
* @return void
* @todo Define visibility
*/
public function deactivateService()
{
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::deactivateService($this->info['serviceType'], $this->info['serviceKey']);
}
示例3: makeInstanceService
/**
* Find the best service and check if it works.
* Returns object of the service class.
*
* @param string $serviceType Type of service (service key).
* @param string $serviceSubType Sub type like file extensions or similar. Defined by the service.
* @param mixed $excludeServiceKeys List of service keys which should be excluded in the search for a service. Array or comma list.
* @return object|string[] The service object or an array with error infos.
*/
public static function makeInstanceService($serviceType, $serviceSubType = '', $excludeServiceKeys = [])
{
$error = false;
if (!is_array($excludeServiceKeys)) {
$excludeServiceKeys = self::trimExplode(',', $excludeServiceKeys, true);
}
$requestInfo = ['requestedServiceType' => $serviceType, 'requestedServiceSubType' => $serviceSubType, 'requestedExcludeServiceKeys' => $excludeServiceKeys];
while ($info = ExtensionManagementUtility::findService($serviceType, $serviceSubType, $excludeServiceKeys)) {
// provide information about requested service to service object
$info = array_merge($info, $requestInfo);
// Check persistent object and if found, call directly and exit.
if (is_object($GLOBALS['T3_VAR']['makeInstanceService'][$info['className']])) {
// update request info in persistent object
$GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->info = $info;
// reset service and return object
$GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->reset();
return $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']];
} else {
$obj = self::makeInstance($info['className']);
if (is_object($obj)) {
if (!@is_callable([$obj, 'init'])) {
// use silent logging??? I don't think so.
die('Broken service:' . DebugUtility::viewArray($info));
}
$obj->info = $info;
// service available?
if ($obj->init()) {
// create persistent object
$GLOBALS['T3_VAR']['makeInstanceService'][$info['className']] = $obj;
return $obj;
}
$error = $obj->getLastErrorArray();
unset($obj);
}
}
// deactivate the service
ExtensionManagementUtility::deactivateService($info['serviceType'], $info['serviceKey']);
}
return $error;
}
示例4: makeInstanceService
/**
* Find the best service and check if it works.
* Returns object of the service class.
*
* @param string $serviceType Type of service (service key).
* @param string $serviceSubType Sub type like file extensions or similar. Defined by the service.
* @param mixed $excludeServiceKeys List of service keys which should be excluded in the search for a service. Array or comma list.
* @return object The service object or an array with error info's.
*/
public static function makeInstanceService($serviceType, $serviceSubType = '', $excludeServiceKeys = array())
{
$error = FALSE;
if (!is_array($excludeServiceKeys)) {
$excludeServiceKeys = self::trimExplode(',', $excludeServiceKeys, 1);
}
$requestInfo = array('requestedServiceType' => $serviceType, 'requestedServiceSubType' => $serviceSubType, 'requestedExcludeServiceKeys' => $excludeServiceKeys);
while ($info = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::findService($serviceType, $serviceSubType, $excludeServiceKeys)) {
// provide information about requested service to service object
$info = array_merge($info, $requestInfo);
// Check persistent object and if found, call directly and exit.
if (is_object($GLOBALS['T3_VAR']['makeInstanceService'][$info['className']])) {
// update request info in persistent object
$GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->info = $info;
// reset service and return object
$GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->reset();
return $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']];
} else {
$requireFile = self::getFileAbsFileName($info['classFile']);
if (@is_file($requireFile)) {
self::requireOnce($requireFile);
$obj = self::makeInstance($info['className']);
if (is_object($obj)) {
if (!@is_callable(array($obj, 'init'))) {
// use silent logging??? I don't think so.
die('Broken service:' . \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($info));
}
$obj->info = $info;
// service available?
if ($obj->init()) {
// create persistent object
$GLOBALS['T3_VAR']['makeInstanceService'][$info['className']] = $obj;
// needed to delete temp files
register_shutdown_function(array(&$obj, '__destruct'));
return $obj;
}
$error = $obj->getLastErrorArray();
unset($obj);
}
}
}
// deactivate the service
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::deactivateService($info['serviceType'], $info['serviceKey']);
}
return $error;
}