diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml new file mode 100644 index 0000000..5719c9e --- /dev/null +++ b/Configuration/Services.yaml @@ -0,0 +1,15 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + # Registered explicitly instead of via the #[AsEventListener] attribute: + # TYPO3\CMS\Core\Attribute\AsEventListener only exists since TYPO3 v13, and the + # Symfony attribute of the same name is not autoconfigured by TYPO3 at all. + # The service tag works identically on TYPO3 v12, v13 and v14. + B13\DistributedLocks\BlindedConfigurationOptionsHook: + tags: + - name: event.listener + identifier: 'distributed-locks/blinded-configuration-options' + event: TYPO3\CMS\Lowlevel\Event\ModifyBlindedConfigurationOptionsEvent diff --git a/README.md b/README.md index bfe3f6d..1ef1e8e 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,15 @@ This extension provides a Redis Locking mechanism to store the locks in a (share ## Requirements -This extension is available for TYPO3 v8+ LTS, and requires the PHP package `php-redis` as well as a Redis server. +This extension supports TYPO3 v12.4, v13.4 and v14.3. It requires PHP 8.1+, the PHP extension +`php-redis`, and a Redis server. ## Installation Install this extension via composer `composer require b13/distributed-locks` or extensions.typo3.org / Extension Manager, and activate it in the Extension Manager. -Now add the following lines to your LocalConfiguration / AdditionalConfiguration to activate Redis Locking. +Now add the following lines to `config/system/additional.php` to activate Redis Locking. $GLOBALS['TYPO3_CONF_VARS']['SYS']['locking']['redis'] = [ 'hostname' => '127.0.0.1', @@ -40,7 +41,7 @@ Other options: ## Disabling it in certain contextes If you have different `TYPO3_CONTEXT` or environments and you want to switch off the complete redis -strategy (i.e. in your staging machine), you can set this in your LocalConfiguration / AdditionalConfiguration: +strategy (i.e. in your staging machine), you can set this in `config/system/additional.php`: $GLOBALS['TYPO3_CONF_VARS']['SYS']['locking']['redis']['disabled'] = true; diff --git a/composer.json b/composer.json index 8b4b46f..aebf5b3 100644 --- a/composer.json +++ b/composer.json @@ -5,10 +5,13 @@ "keywords": ["TYPO3 CMS", "Redis", "Locking", "NFS"], "license": "GPL-2.0-or-later", "require": { - "php": "^8.0", + "php": "^8.1", "ext-redis": "*", "typo3/cms-core": "^12.4 || ^13.4 || ^14.3" }, + "suggest": { + "typo3/cms-lowlevel": "Blinds the configured redis password in the backend \"Configuration\" module" + }, "extra": { "typo3/cms": { "extension-key": "distributed_locks", diff --git a/src/BlindedConfigurationOptionsHook.php b/src/BlindedConfigurationOptionsHook.php index 1733de3..a3ae1e1 100644 --- a/src/BlindedConfigurationOptionsHook.php +++ b/src/BlindedConfigurationOptionsHook.php @@ -12,15 +12,14 @@ * of the License, or any later version. */ -use Symfony\Component\EventDispatcher\Attribute\AsEventListener; use TYPO3\CMS\Lowlevel\Event\ModifyBlindedConfigurationOptionsEvent; /** - * Hook for $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][\TYPO3\CMS\Lowlevel\Controller\ConfigurationController::class]['modifyBlindedConfigurationOptions'] + * Blinds the redis password in the backend "Configuration" module. + * Registered as a PSR-14 event listener in Configuration/Services.yaml. */ class BlindedConfigurationOptionsHook { - #[AsEventListener] public function __invoke(ModifyBlindedConfigurationOptionsEvent $event): void { $event->setBlindedConfigurationOptions(