Skip to content

Commit

Permalink
[BUGFIX] Include file added event listener
Browse files Browse the repository at this point in the history
  • Loading branch information
bmack committed Jul 25, 2022
1 parent a304ba3 commit 07f2fbb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Classes/ResourceStorageOperations/Listener/AfterFileAdded.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);
namespace B13\Proxycachemanager\ResourceStorageOperations\Listener;

/*
* This file is part of the b13 TYPO3 extensions family.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Core\Resource\Event\AfterFileAddedEvent;

/**
* Imagine you add a new file but the old name was deleted via FTP, ensure this URL is cached
* add all times
*/
class AfterFileAdded extends AbstractListener
{
public function __invoke(AfterFileAddedEvent $e): void
{
$this->cacheService->flushCachesForFile($e->getFile());
}
}
6 changes: 6 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ services:
- name: event.listener
identifier: 'b13-proxycachemanager-beforeFolderRenamed'
event: TYPO3\CMS\Core\Resource\Event\BeforeFolderRenamedEvent

B13\Proxycachemanager\ResourceStorageOperations\Listener\AfterFileAdded:
tags:
- name: event.listener
identifier: 'b13-proxycachemanager-afterFileAdded'
event: TYPO3\CMS\Core\Resource\Event\AfterFileAddedEvent

0 comments on commit 07f2fbb

Please sign in to comment.