[TASK] Introduce unique signal registration 13/31013/5
authorNicole Cordes <typo3@cordes.co>
Sat, 21 Jun 2014 17:48:50 +0000 (19:48 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 22 Jun 2014 09:53:17 +0000 (11:53 +0200)
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
21 files changed:
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/LoginController.php
typo3/sysext/core/Classes/Resource/Index/FileIndexRepository.php
typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
typo3/sysext/core/Classes/Resource/ResourceFactory.php
typo3/sysext/core/Classes/Resource/ResourceStorage.php
typo3/sysext/core/Classes/Resource/Service/FileProcessingService.php
typo3/sysext/documentation/Classes/Controller/DocumentController.php
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php
typo3/sysext/extbase/Classes/Mvc/Dispatcher.php
typo3/sysext/extbase/Classes/Persistence/Generic/Backend.php
typo3/sysext/extensionmanager/Classes/Command/ExtensionCommandController.php
typo3/sysext/extensionmanager/Classes/Controller/ConfigurationController.php
typo3/sysext/extensionmanager/Classes/Service/ExtensionManagementService.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/extensionmanager/Classes/Utility/ListUtility.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ProcessAvailableActionsViewHelper.php
typo3/sysext/extensionmanager/Tests/Unit/Service/ExtensionManagementServiceTest.php
typo3/sysext/extensionmanager/Tests/Unit/Utility/ListUtilityTest.php
typo3/sysext/lang/Classes/Command/LanguageCommandController.php
typo3/sysext/lang/Classes/Service/UpdateTranslationService.php

index af52f85..e5483b7 100644 (file)
@@ -384,6 +384,15 @@ class EditDocumentController {
        }
 
        /**
+        * 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.
         *
         * @return void
@@ -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__);
        }
 
        /**
index 1d40d3b..67a7e89 100644 (file)
@@ -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];
        }
 
        /**
index 1715656..738b0c5 100644 (file)
@@ -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));
        }
 }
index 538389b..4ba9086 100644 (file)
@@ -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));
        }
 
index 2191ec0..bf5554d 100644 (file)
@@ -179,13 +179,22 @@ 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.
         *
index 67bcb3f..b07fd97 100644 (file)
@@ -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));
        }
 
index fa6311d..9b7f026 100644 (file)
@@ -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));
        }
 }
index 0a40fb6..d51c565 100644 (file)
@@ -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];
        }
 
        /**
index e3f6578..81e32f2 100644 (file)
@@ -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);
                        }
                }
@@ -346,6 +346,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
         * the current action.
index fd6cd7d..6a04c9c 100644 (file)
@@ -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));
        }
 
index 4838368..1e7c1d9 100644 (file)
@@ -185,14 +185,36 @@ 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') {
@@ -651,6 +673,15 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        }
 
        /**
+        * 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.
         *
         * @param \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject $object The object to be tested
@@ -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') {
@@ -850,6 +881,15 @@ class Backend implements \TYPO3\CMS\Extbase\Persistence\Generic\BackendInterface
        }
 
        /**
+        * 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
         *
         * @param \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object
@@ -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);
@@ -932,6 +972,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
         *
         * @param \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object The object to scanned for related objects
index 6bd450f..fdbd1ad 100644 (file)
@@ -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');
        }
 }
index bca9593..f4d7a50 100644 (file)
@@ -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));
+       }
+
 }
index 0944b88..7fff9d9 100644 (file)
@@ -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));
        }
 
index acde655..5ac5e9f 100644 (file)
@@ -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__);
@@ -474,6 +474,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,11 +499,20 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
                                $this->importStaticSql($extTablesStaticSqlContent);
                        }
                        $this->registry->set('extensionDataImport', $extTablesStaticSqlRelFile, 1);
-                       $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionStaticSqlImport', array($extTablesStaticSqlRelFile, $this));
+                       $this->emitAfterExtensionStaticSqlImportSignal($extTablesStaticSqlRelFile);
                }
        }
 
        /**
+        * Emits a signal after a static sql file was imported
+        *
+        * @param string $extTablesStaticSqlRelFile
+        */
+       protected function emitAfterExtensionStaticSqlImportSignal($extTablesStaticSqlRelFile) {
+               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionStaticSqlImport', array($extTablesStaticSqlRelFile, $this));
+       }
+
+       /**
         * Imports files from Initialisation/Files to fileadmin
         * via lowlevel copy directory method
         *
@@ -514,11 +533,19 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
                                }
                                \TYPO3\CMS\Core\Utility\GeneralUtility::copyDirectory($importRelFolder, $destinationRelPath);
                                $this->registry->set('extensionDataImport', $importRelFolder, 1);
-                               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionFileImport', array($destinationAbsolutePath, $this));
+                               $this->emitAfterExtensionFileImportSignal($destinationAbsolutePath);
                        }
                }
        }
 
+       /**
+        * Emits a signal after extension files were imported
+        *
+        * @param string $destinationAbsolutePath
+        */
+       protected function emitAfterExtensionFileImportSignal($destinationAbsolutePath) {
+               $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionFileImport', array($destinationAbsolutePath, $this));
+       }
 
        /**
         * @return \TYPO3\CMS\Core\Database\DatabaseConnection
index 5a4315c..0ce865e 100644 (file)
@@ -78,7 +78,7 @@ class ListUtility implements \TYPO3\CMS\Core\SingletonInterface {
         * @see getInstExtList()
         */
        public function getAvailableExtensions() {
-               $this->emitPackagesMayHaveChanged();
+               $this->emitPackagesMayHaveChangedSignal();
                $extensions = array();
                foreach ($this->packageManager->getAvailablePackages() as $package) {
                        // Only TYPO3 related packages could be handled by the extension manager
@@ -100,7 +100,7 @@ class ListUtility implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * Emits packages may have changed signal
         */
-       protected function emitPackagesMayHaveChanged() {
+       protected function emitPackagesMayHaveChangedSignal() {
                $this->signalSlotDispatcher->dispatch('PackageManagement', 'packagesMayHaveChanged');
        }
 
index 6589000..d2b0ed4 100644 (file)
@@ -53,16 +53,28 @@ class ProcessAvailableActionsViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Lin
                $html = $this->renderChildren();
                $actions = preg_split('#\\n\\s*#s', trim($html));
 
-               $this->signalSlotDispatcher->dispatch(
+               $actions = $this->emitProcessActionsSignal($extension, $actions);
+
+               return implode(' ', $actions);
+       }
+
+       /**
+        * Emits a signal after the list of actions is processed
+        *
+        * @param string $extension
+        * @param array $actions
+        * @return array Modified action array
+        */
+       protected function emitProcessActionsSignal($extension, array $actions) {
+               $signalArguments = $this->signalSlotDispatcher->dispatch(
                        __CLASS__,
                        static::SIGNAL_ProcessActions,
                        array(
                                'extension' => $extension,
-                               'actions' => &$actions,
+                               'actions' => $actions,
                        )
                );
-
-               return implode(' ', $actions);
+               return $signalArguments[1];
        }
 
 }
index 33eff47..bf0f2ac 100644 (file)
@@ -238,7 +238,7 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
        public function installDependenciesCallsInstall() {
                $managementMock = $this->getAccessibleMock(
                        'TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService',
-                       array('emitWillInstallExtensions', 'emitHasInstalledExtension')
+                       array('emitWillInstallExtensionsSignal', 'emitHasInstalledExtensionSignal')
                );
                $installQueue = array(
                        'foobar' => array(
@@ -246,7 +246,7 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
                                'siteRelPath' => 'path'
                        )
                );
-               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('install','emitWillInstallExtensions'), array(), '', FALSE);
+               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('install','emitWillInstallExtensionsSignal'), array(), '', FALSE);
                $installUtility->expects($this->once())->method('install')->with(array(
                        'key' => 'foobar',
                        'siteRelPath' => 'path'
@@ -261,13 +261,13 @@ class ExtensionManagementServiceTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
         */
        public function installDependenciesReturnsResolvedDependencies() {
                $managementMock = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Service\\ExtensionManagementService', array(
-                       'emitWillInstallExtensions',
-                       'emitHasInstalledExtension'
+                       'emitWillInstallExtensionsSignal',
+                       'emitHasInstalledExtensionSignal'
                ));
                $installQueue = array(
                        'foobar' => 'foobar'
                );
-               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('install','emitWillInstallExtensions'), array(), '', FALSE);
+               $installUtility = $this->getAccessibleMock('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility', array('install','emitWillInstallExtensionsSignal'), array(), '', FALSE);
                $installUtility->expects($this->once())->method('install')->with('foobar');
                $managementMock->_set('installUtility', $installUtility);
                $resolvedDependencies = $managementMock->_call('installDependencies', $installQueue);
index 921151a..2189418 100644 (file)
@@ -40,7 +40,7 @@ class ListUtilityTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @return void
         */
        public function setUp() {
-               $this->subject = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility', array('emitPackagesMayHaveChanged'));
+               $this->subject = $this->getMock('TYPO3\\CMS\\Extensionmanager\\Utility\\ListUtility', array('emitPackagesMayHaveChangedSignal'));
                $packageManagerMock = $this->getMock('TYPO3\\CMS\\Core\\Package\\PackageManager');
                $packageManagerMock
                                ->expects($this->any())
index dcd1afc..78a2d82 100644 (file)
@@ -65,7 +65,7 @@ class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Comman
                        }
                }
                $this->packageManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Package\\PackageManager');
-               $this->emitPackagesMayHaveChanged();
+               $this->emitPackagesMayHaveChangedSignal();
                foreach ($this->packageManager->getAvailablePackages() as $package) {
                        $updateTranslationService->updateTranslation($package->getPackageKey(), $locales);
                }
@@ -74,7 +74,7 @@ class LanguageCommandController extends \TYPO3\CMS\Extbase\Mvc\Controller\Comman
        /**
         * Emits packages may have changed signal
         */
-       protected function emitPackagesMayHaveChanged() {
+       protected function emitPackagesMayHaveChangedSignal() {
                $this->signalSlotDispatcher->dispatch('PackageManagement', 'packagesMayHaveChanged');
        }
 }
index 787b764..e24e195 100644 (file)
@@ -195,16 +195,28 @@ class UpdateTranslationService {
        protected function getMirrorUrl($extensionKey) {
                $mirrorUrl = $this->repositoryHelper->getMirrors()->getMirrorUrl();
 
-               $this->signalSlotDispatcher->dispatch(
+               $mirrorUrl = $this->emitPostProcessMirrorUrlSignal($extensionKey, $mirrorUrl);
+
+               return $mirrorUrl;
+       }
+
+       /**
+        * Emits a signal after the mirror URL of an extension was fetched
+        *
+        * @param string $extensionKey
+        * @param string $mirrorUrl
+        * @return string Modified mirror url
+        */
+       protected function emitPostProcessMirrorUrlSignal($extensionKey, $mirrorUrl) {
+               $signalArguments = $this->signalSlotDispatcher->dispatch(
                        __CLASS__,
                        'postProcessMirrorUrl',
                        array(
                                'extensionKey' => $extensionKey,
-                               'mirrorUrl' => &$mirrorUrl,
+                               'mirrorUrl' => $mirrorUrl,
                        )
                );
-
-               return $mirrorUrl;
+               return $signalArguments[1];
        }
 
 }