Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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;

Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 2 additions & 3 deletions src/BlindedConfigurationOptionsHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down