Commit 9fe94376 authored by Nicole Cordes's avatar Nicole Cordes Committed by Anja Leichsenring
Browse files

[TASK] Introduce unique signal registration

Signals should be dispatch in own emit functions for better locating.
This patch moves signals to separate functions and attaches missing
suffixes to existing ones.

Resolves: #59774
Releases: 6.3, 6.2
Change-Id: I7a1411566a78e326f1f870b2d345631e7ca265e0
Reviewed-on: https://review.typo3.org/31013
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
parent 49b53d49
......@@ -383,6 +383,15 @@ class EditDocumentController {
return $this->signalSlotDispatcher;
}
/**
* Emits a signal after a function was executed
*
* @param string $signalName
*/
protected function emitFunctionAfterSignal($signalName) {
$this->getSignalSlotDispatcher()->dispatch(__CLASS__, $signalName . 'After', array($this));
}
/**
* First initialization.
*
......@@ -440,7 +449,7 @@ class EditDocumentController {
$this->getBackendUser()->setTemporaryWorkspace($this->workspace);
}
$this->getSignalSlotDispatcher()->dispatch(__CLASS__, __FUNCTION__ . 'After', array($this));
$this->emitFunctionAfterSignal(__FUNCTION__);
}
/**
......@@ -666,7 +675,7 @@ class EditDocumentController {
$this->doc->getContextMenuCode();
$this->doc->bodyTagAdditions = 'onload="window.scrollTo(0,' . MathUtility::forceIntegerInRange(GeneralUtility::_GP('_scrollPosition'), 0, 10000) . ');"';
$this->getSignalSlotDispatcher()->dispatch(__CLASS__, __FUNCTION__ . 'After', array($this));
$this->emitFunctionAfterSignal(__FUNCTION__);
}
/**
......
......@@ -365,7 +365,7 @@ class LoginController {
// Global variables will now be replaced (at last)
'SITENAME' => htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])
);
$this->emitRenderLoginFormSignal($markers);
$markers = $this->emitRenderLoginFormSignal($markers);
return HtmlParser::substituteMarkerArray($mainContent, $markers, '###|###');
}
......@@ -717,11 +717,11 @@ class LoginController {
* Emits the render login form signal
*
* @param array $markers Array with markers for the login form
* @return void
* @return array Modified markers array
*/
protected function emitRenderLoginFormSignal(array &$markers) {
protected function emitRenderLoginFormSignal(array $markers) {
$signalArguments = $this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Backend\\Controller\\LoginController', self::SIGNAL_RenderLoginForm, array($this, $markers));
$markers = $signalArguments[1];
return $signalArguments[1];
}
/**
......
......@@ -235,7 +235,7 @@ class FileIndexRepository implements SingletonInterface {
$data['tstamp'] = time();
$this->getDatabaseConnection()->exec_INSERTquery($this->table, $data);
$data['uid'] = $this->getDatabaseConnection()->sql_insert_id();
$this->emitRecordCreated($data);
$this->emitRecordCreatedSignal($data);
return $data['uid'];
}
/**
......@@ -263,7 +263,7 @@ class FileIndexRepository implements SingletonInterface {
if (count($updateRow) > 0) {
$updateRow['tstamp'] = time();
$this->getDatabaseConnection()->exec_UPDATEquery($this->table, $this->getWhereClauseForFile($file), $updateRow);
$this->emitRecordUpdated(array_intersect_key($file->getProperties(), array_flip($this->fields)));
$this->emitRecordUpdatedSignal(array_intersect_key($file->getProperties(), array_flip($this->fields)));
}
}
......@@ -352,7 +352,7 @@ class FileIndexRepository implements SingletonInterface {
*/
public function remove($fileUid) {
$this->getDatabaseConnection()->exec_DELETEquery($this->table, 'uid=' . (int)$fileUid);
$this->emitRecordDeleted($fileUid);
$this->emitRecordDeletedSignal($fileUid);
}
/*
......@@ -381,7 +381,7 @@ class FileIndexRepository implements SingletonInterface {
* @param array $data
* @signal
*/
protected function emitRecordUpdated(array $data) {
protected function emitRecordUpdatedSignal(array $data) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository', 'recordUpdated', array($data));
}
......@@ -391,7 +391,7 @@ class FileIndexRepository implements SingletonInterface {
* @param array $data
* @signal
*/
protected function emitRecordCreated(array $data) {
protected function emitRecordCreatedSignal(array $data) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository', 'recordCreated', array($data));
}
......@@ -401,7 +401,7 @@ class FileIndexRepository implements SingletonInterface {
* @param integer $fileUid
* @signal
*/
protected function emitRecordDeleted($fileUid) {
protected function emitRecordDeletedSignal($fileUid) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository', 'recordDeleted', array($fileUid));
}
}
......@@ -122,7 +122,7 @@ class MetaDataRepository implements SingletonInterface {
$record = $emptyRecord;
$record['uid'] = $this->getDatabaseConnection()->sql_insert_id();
$this->emitRecordCreated($record);
$this->emitRecordCreatedSignal($record);
return $record;
}
......@@ -148,7 +148,7 @@ class MetaDataRepository implements SingletonInterface {
$updateRow['tstamp'] = time();
$this->getDatabaseConnection()->exec_UPDATEquery($this->tableName, 'uid = ' . (int)$row['uid'], $updateRow);
$this->emitRecordUpdated(array_merge($row, $updateRow));
$this->emitRecordUpdatedSignal(array_merge($row, $updateRow));
}
}
......@@ -160,7 +160,7 @@ class MetaDataRepository implements SingletonInterface {
*/
public function removeByFileUid($fileUid) {
$this->getDatabaseConnection()->exec_DELETEquery($this->tableName, 'file=' . (int)$fileUid);
$this->emitRecordDeleted($fileUid);
$this->emitRecordDeletedSignal($fileUid);
}
/**
......@@ -199,7 +199,7 @@ class MetaDataRepository implements SingletonInterface {
* @param array $data
* @signal
*/
protected function emitRecordUpdated(array $data) {
protected function emitRecordUpdatedSignal(array $data) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository', 'recordUpdated', array($data));
}
......@@ -209,7 +209,7 @@ class MetaDataRepository implements SingletonInterface {
* @param array $data
* @signal
*/
protected function emitRecordCreated(array $data) {
protected function emitRecordCreatedSignal(array $data) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository', 'recordCreated', array($data));
}
......@@ -219,7 +219,7 @@ class MetaDataRepository implements SingletonInterface {
* @param integer $fileUid
* @signal
*/
protected function emitRecordDeleted($fileUid) {
protected function emitRecordDeletedSignal($fileUid) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository', 'recordDeleted', array($fileUid));
}
......
......@@ -179,12 +179,21 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
if (!$storageObject instanceof ResourceStorage) {
$storageObject = $this->createStorageObject($recordData, $storageConfiguration);
}
$this->signalSlotDispatcher->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceFactory', self::SIGNAL_PostProcessStorage, array($this, $storageObject));
$this->emitPostProcessStorageSignal($storageObject);
$this->storageInstances[$uid] = $storageObject;
}
return $this->storageInstances[$uid];
}
/**
* Emits a signal after a resource storage was initialized
*
* @param ResourceStorage $storageObject
*/
protected function emitPostProcessStorageSignal(ResourceStorage $storageObject) {
$this->signalSlotDispatcher->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceFactory', self::SIGNAL_PostProcessStorage, array($this, $storageObject));
}
/**
* Checks whether a file resides within a real storage in local file system.
* If no match is found, uid 0 is returned which is a fallback storage pointing to PATH_site.
......
......@@ -1062,7 +1062,7 @@ class ResourceStorage implements ResourceStorageInterface {
// We do not care whether the file exists yet because $targetFileName may be changed by an
// external slot and only then we should check how to proceed according to $conflictMode
$this->emitPreFileAddSignal($targetFileName, $targetFolder, $localFilePath);
$targetFileName = $this->emitPreFileAddSignal($targetFileName, $targetFolder, $localFilePath);
if ($conflictMode === 'cancel' && $this->driver->fileExistsInFolder($targetFileName, $targetFolder->getIdentifier())) {
throw new Exception\ExistingTargetFileNameException('File "' . $targetFileName . '" already exists in folder ' . $targetFolder->getIdentifier(), 1322121068);
......@@ -1150,7 +1150,7 @@ class ResourceStorage implements ResourceStorageInterface {
$publicUrl = NULL;
if ($this->isOnline()) {
// Pre-process the public URL by an accordant slot
$this->emitPreGeneratePublicUrl($resourceObject, $relativeToCurrentScript, array('publicUrl' => &$publicUrl));
$this->emitPreGeneratePublicUrlSignal($resourceObject, $relativeToCurrentScript, array('publicUrl' => &$publicUrl));
// If slot did not handle the signal, use the default way to determine public URL
if ($publicUrl === NULL) {
......@@ -2094,10 +2094,11 @@ class ResourceStorage implements ResourceStorageInterface {
* @param string $targetFileName
* @param Folder $targetFolder
* @param string $sourceFilePath
* @return void
* @return string Modified target file name
*/
protected function emitPreFileAddSignal(&$targetFileName, Folder $targetFolder, $sourceFilePath) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', self::SIGNAL_PreFileAdd, array(&$targetFileName, $targetFolder, $sourceFilePath, $this, $this->driver));
protected function emitPreFileAddSignal($targetFileName, Folder $targetFolder, $sourceFilePath) {
$signalArguments = $this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', self::SIGNAL_PreFileAdd, array($targetFileName, $targetFolder, $sourceFilePath, $this, $this->driver));
return $signalArguments[0];
}
/**
......@@ -2360,7 +2361,7 @@ class ResourceStorage implements ResourceStorageInterface {
* @param bool $relativeToCurrentScript
* @param array $urlData
*/
protected function emitPreGeneratePublicUrl(ResourceInterface $resourceObject, $relativeToCurrentScript, array $urlData) {
protected function emitPreGeneratePublicUrlSignal(ResourceInterface $resourceObject, $relativeToCurrentScript, array $urlData) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', self::SIGNAL_PreGeneratePublicUrl, array($this, $this->driver, $resourceObject, $relativeToCurrentScript, $urlData));
}
......
......@@ -94,7 +94,7 @@ class FileProcessingService {
// set the storage of the processed file
// Pre-process the file
$this->emitPreFileProcess($processedFile, $fileObject, $taskType, $configuration);
$this->emitPreFileProcessSignal($processedFile, $fileObject, $taskType, $configuration);
// Only handle the file if it is not processed yet
// (maybe modified or already processed by a signal)
......@@ -104,7 +104,7 @@ class FileProcessingService {
}
// Post-process (enrich) the file
$this->emitPostFileProcess($processedFile, $fileObject, $taskType, $configuration);
$this->emitPostFileProcessSignal($processedFile, $fileObject, $taskType, $configuration);
return $processedFile;
}
......@@ -163,7 +163,7 @@ class FileProcessingService {
* @param string $context
* @param array $configuration
*/
protected function emitPreFileProcess(Resource\ProcessedFile $processedFile, Resource\FileInterface $file, $context, array $configuration = array()) {
protected function emitPreFileProcessSignal(Resource\ProcessedFile $processedFile, Resource\FileInterface $file, $context, array $configuration = array()) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', self::SIGNAL_PreFileProcess, array($this, $this->driver, $processedFile, $file, $context, $configuration));
}
......@@ -175,7 +175,7 @@ class FileProcessingService {
* @param $context
* @param array $configuration
*/
protected function emitPostFileProcess(Resource\ProcessedFile $processedFile, Resource\FileInterface $file, $context, array $configuration = array()) {
protected function emitPostFileProcessSignal(Resource\ProcessedFile $processedFile, Resource\FileInterface $file, $context, array $configuration = array()) {
$this->getSignalSlotDispatcher()->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', self::SIGNAL_PostFileProcess, array($this, $this->driver, $processedFile, $file, $context, $configuration));
}
}
......@@ -96,16 +96,28 @@ class DocumentController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
$language = $this->languageUtility->getDocumentationLanguage();
$documents = $this->documentRepository->findByLanguage($language);
$this->signalSlotDispatcher->dispatch(
$documents = $this->emitAfterInitializeDocumentsSignal($language, $documents);
return $documents;
}
/**
* Emits a signal after the documents are initialized
*
* @param string $language
* @param \TYPO3\CMS\Documentation\Domain\Model\Document[] $documents
* @return \TYPO3\CMS\Documentation\Domain\Model\Document[]
*/
protected function emitAfterInitializeDocumentsSignal($language, array $documents) {
$signalArguments = $this->signalSlotDispatcher->dispatch(
__CLASS__,
'afterInitializeDocuments',
array(
'language' => $language,
'documents' => &$documents,
'documents' => $documents,
)
);
return $documents;
return $signalArguments[1];
}
/**
......
......@@ -296,7 +296,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
}
$validationResult = $this->arguments->getValidationResults();
if (!$validationResult->hasErrors()) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCallActionMethod', array('controllerName' => get_class($this), 'actionMethodName' => $this->actionMethodName, 'preparedArguments' => $preparedArguments));
$this->emitBeforeCallActionMethodSignal($preparedArguments);
$actionResult = call_user_func_array(array($this, $this->actionMethodName), $preparedArguments);
} else {
$methodTagsValues = $this->reflectionService->getMethodTagsValues(get_class($this), $this->actionMethodName);
......@@ -317,7 +317,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
$shouldCallActionMethod = FALSE;
}
if ($shouldCallActionMethod) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCallActionMethod', array('controllerName' => get_class($this), 'actionMethodName' => $this->actionMethodName, 'preparedArguments' => $preparedArguments));
$this->emitBeforeCallActionMethodSignal($preparedArguments);
$actionResult = call_user_func_array(array($this, $this->actionMethodName), $preparedArguments);
} else {
$actionResult = call_user_func(array($this, $this->errorMethodName));
......@@ -332,7 +332,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
if ($this->argumentsMappingResults->hasErrors()) {
$actionResult = call_user_func(array($this, $this->errorMethodName));
} else {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCallActionMethod', array('controllerName' => get_class($this), 'actionMethodName' => $this->actionMethodName, 'preparedArguments' => $preparedArguments));
$this->emitBeforeCallActionMethodSignal($preparedArguments);
$actionResult = call_user_func_array(array($this, $this->actionMethodName), $preparedArguments);
}
}
......@@ -345,6 +345,15 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
}
}
/**
* Emits a signal before the current action is called
*
* @param array $preparedArguments
*/
protected function emitBeforeCallActionMethodSignal(array $preparedArguments) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCallActionMethod', array('controllerName' => get_class($this), 'actionMethodName' => $this->actionMethodName, 'preparedArguments' => $preparedArguments));
}
/**
* Prepares a view for the current action and stores it in $this->view.
* By default, this method tries to locate a view with a name matching
......
......@@ -84,6 +84,16 @@ class Dispatcher implements \TYPO3\CMS\Core\SingletonInterface {
} catch (\TYPO3\CMS\Extbase\Mvc\Exception\StopActionException $ignoredException) {
}
}
$this->emitAfterRequestDispatchSignal($request, $response);
}
/**
* Emits a signal after a request was dispatched
*
* @param RequestInterface $request
* @param ResponseInterface $response
*/
protected function emitAfterRequestDispatchSignal(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRequestDispatch', array('request' => $request, 'response' => $response));
}
......
......@@ -185,13 +185,35 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
* @api
*/
public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
$signalResult = $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeGettingObjectData', array($query));
list($query) = $signalResult;
$query = $this->emitBeforeGettingObjectDataSignal($query);
$result = $this->storageBackend->getObjectDataByQuery($query);
list($query, $result) = $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterGettingObjectData', array($query, $result));
$result = $this->emitafterGettingObjectDataSignal($query, $result);
return $result;
}
/**
* Emits a signal before object data is fetched
*
* @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
* @return \TYPO3\CMS\Extbase\Persistence\QueryInterface Modified query
*/
protected function emitBeforeGettingObjectDataSignal(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query) {
$signalArguments = $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeGettingObjectData', array($query));
return $signalArguments[0];
}
/**
* Emits a signal after object data is fetched
*
* @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
* @param array $result
* @return array Modified result
*/
protected function emitAfterGettingObjectDataSignal(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query, array $result) {
$signalArguments = $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterGettingObjectData', array($query, $result));
return $signalArguments[1];
}
/**
* Returns the (internal) identifier for the object, if it is known to the
* backend. Otherwise NULL is returned.
......@@ -641,7 +663,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
$uid = $this->storageBackend->addRow($dataMap->getTableName(), $row);
$object->_setProperty('uid', (int)$uid);
if ((int)$uid >= 1) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterInsertObject', array('object' => $object));
$this->emitAfterInsertObjectSignal($object);
}
$frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
if ($frameworkConfiguration['persistence']['updateReferenceIndex'] === '1') {
......@@ -650,6 +672,15 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
$this->session->registerObject($object, $uid);
}
/**
* Emits a signal after an object was added to the storage
*
* @param DomainObjectInterface $object
*/
protected function emitAfterInsertObjectSignal(DomainObjectInterface $object) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterInsertObject', array('object' => $object));
}
/**
* Tests, if the given Value Object already exists in the storage backend and if so, it returns the uid.
*
......@@ -840,7 +871,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
}
$res = $this->storageBackend->updateRow($dataMap->getTableName(), $row);
if ($res === TRUE) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterUpdateObject', array('object' => $object));
$this->emitAfterUpdateObjectSignal($object);
}
$frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
if ($frameworkConfiguration['persistence']['updateReferenceIndex'] === '1') {
......@@ -849,6 +880,15 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
return $res;
}
/**
* Emits a signal after an object was updated in storage
*
* @param DomainObjectInterface $object
*/
protected function emitAfterUpdateObjectSignal(DomainObjectInterface $object) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterUpdateObject', array('object' => $object));
}
/**
* Adds common databse fields to a row
*
......@@ -922,7 +962,7 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
$res = $this->storageBackend->removeRow($tableName, array('uid' => $object->getUid()));
}
if ($res === TRUE) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRemoveObject', array('object' => $object));
$this->emitAfterRemoveObjectSignal($object);
}
$this->removeRelatedObjects($object);
$frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
......@@ -931,6 +971,15 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
}
}
/**
* Emits a signal after an object was removed from storage
*
* @param DomainObjectInterface $object
*/
protected function emitAfterRemoveObjectSignal(DomainObjectInterface $object) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterRemoveObject', array('object' => $object));
}
/**
* Remove related objects
*
......
......@@ -57,7 +57,7 @@ class ExtensionCommandController extends CommandController {
* @return void
*/
public function installCommand($extensionKey) {
$this->emitPackagesMayHaveChanged();
$this->emitPackagesMayHaveChangedSignal();
/** @var $service \TYPO3\CMS\Extensionmanager\Utility\InstallUtility */
$service = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility');
......@@ -82,7 +82,7 @@ class ExtensionCommandController extends CommandController {
/**
* Emits packages may have changed signal
*/
protected function emitPackagesMayHaveChanged() {
protected function emitPackagesMayHaveChangedSignal() {
$this->signalSlotDispatcher->dispatch('PackageManagement', 'packagesMayHaveChanged');
}
}
......@@ -96,7 +96,7 @@ class ConfigurationController extends AbstractController {
$configurationUtility->convertValuedToNestedConfiguration($newConfiguration),
$extensionKey
);
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionConfigurationWrite', array($newConfiguration, $this));
$this->emitAfterExtensionConfigurationWriteSignal($newConfiguration);
/** @var Extension $extension */
$extension = $this->extensionRepository->findOneByCurrentVersionByExtensionKey($extensionKey);
// Different handling for distribution installation
......@@ -109,4 +109,13 @@ class ConfigurationController extends AbstractController {
}
}
/**
* Emits a signal after the configuration file was written
*
* @param array $newConfiguration
*/
protected function emitAfterExtensionConfigurationWriteSignal(array $newConfiguration) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionConfigurationWrite', array($newConfiguration, $this));
}
}
......@@ -260,12 +260,12 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
*/
protected function installDependencies(array $installQueue) {
if (!empty($installQueue)) {
$this->emitWillInstallExtensions($installQueue);
$this->emitWillInstallExtensionsSignal($installQueue);
}
$resolvedDependencies = array();
foreach ($installQueue as $extensionKey => $extensionDetails) {
$this->installUtility->install($extensionDetails);
$this->emitHasInstalledExtension($extensionDetails);
$this->emitHasInstalledExtensionSignal($extensionDetails);
if (!is_array($resolvedDependencies['installed'])) {
$resolvedDependencies['installed'] = array();
}
......@@ -327,14 +327,14 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
/**
* @param array $installQueue
*/
protected function emitWillInstallExtensions(array $installQueue) {
protected function emitWillInstallExtensionsSignal(array $installQueue) {
$this->getSignalSlotDispatcher()->dispatch(__CLASS__, 'willInstallExtensions', array($installQueue));
}
/**
* @param string $extensionKey
*/
protected function emitHasInstalledExtension($extensionKey) {
protected function emitHasInstalledExtensionSignal($extensionKey) {
$this->getSignalSlotDispatcher()->dispatch(__CLASS__, 'hasInstalledExtensions', array($extensionKey));
}
......
......@@ -464,7 +464,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
try {
$importResult = $importExportUtility->importT3DFile(PATH_site . $importFileToUse, 0);
$this->registry->set('extensionDataImport', $extensionSiteRelPath . 'Initialisation/dataImported', 1);
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionT3DImport', array($importFileToUse, $importResult, $this));
$this->emitAfterExtensionT3DImportSignal($importFileToUse, $importResult);
} catch (\ErrorException $e) {
/** @var \TYPO3\CMS\Core\Log\Logger $logger */
$logger = $this->objectManager->get('TYPO3\\CMS\\Core\\Log\\LogManager')->getLogger(__CLASS__);
......@@ -473,6 +473,16 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
}
}
/**
* Emits a signal after an t3d file was imported
*
* @param string $importFileToUse
* @param array $importResult
*/
protected function emitAfterExtensionT3DImportSignal($importFileToUse, array $importResult) {
$this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionT3DImport', array($importFileToUse, $importResult, $this));
}
/**
* Imports a static tables SQL File (ext_tables_static+adt)
* Execution state is saved in the this->registry, so it only happens once
......@@ -489,10 +499,19 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
$this->importStaticSql($extTablesStaticSqlContent);
}
$this->registry->set('extensionDataImport', $extTablesStaticSqlRelFile