• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

fnagel / t3extblog / 23823603081

31 Mar 2026 11:05PM UTC coverage: 37.437% (-12.6%) from 50.045%
23823603081

push

github

fnagel
[FEATURE] Add YAML lint to composer scripts and CI

Using the new TYPO3 14.2 built in YAML linter.

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.3/Feature-104973-ActivateLintYamlExecutableForTYPO3.html

1256 of 3355 relevant lines covered (37.44%)

3.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.0
/Classes/Service/FlushCacheService.php
1
<?php
2

3
namespace FelixNagel\T3extblog\Service;
4

5
/**
6
 * This file is part of the "t3extblog" Extension for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
use FelixNagel\T3extblog\Utility\FrontendUtility;
12
use TYPO3\CMS\Core\Cache\CacheManager;
13
use TYPO3\CMS\Core\SingletonInterface;
14
use TYPO3\CMS\Core\Utility\GeneralUtility;
15
use TYPO3\CMS\Extbase\Service\CacheService;
16

17
/**
18
 * Handles email sending and templating.
19
 */
20
class FlushCacheService implements SingletonInterface
21
{
22
    protected array $cacheTagsToFlush = [];
23

24
    public function initializeObject()
12✔
25
    {
26
        // Clear cache on shutdown
27
        register_shutdown_function([$this, 'flushFrontendCache']);
12✔
28
    }
29

30
    /**
31
     * Clear all added cache tags. Called on shutdown.
32
     *
33
     * @note This function should be public as it's called by register_shutdown_function()!
34
     */
35
    public function flushFrontendCache()
×
36
    {
37
        static::flushFrontendCacheByTags($this->cacheTagsToFlush);
×
38
    }
39

40
    /**
41
     * Add a cache tag to flush.
42
     */
43
    public function addCacheTagsToFlush(string|array $cacheTagsToFlush)
×
44
    {
45
        if (!is_array($cacheTagsToFlush)) {
×
46
            $cacheTagsToFlush = [$cacheTagsToFlush];
×
47
        }
48

49
        if (count($cacheTagsToFlush) < 1) {
×
50
            return;
×
51
        }
52

53
        $this->cacheTagsToFlush = array_merge($this->cacheTagsToFlush, $cacheTagsToFlush);
×
54
    }
55

56
    /**
57
     * Clear frontend page cache by tags.
58
     */
59
    public static function flushFrontendCacheByTags(array $cacheTagsToFlush)
×
60
    {
61
        if (count($cacheTagsToFlush) < 1) {
×
62
            return;
×
63
        }
64

65
        /** @var $cacheManager CacheManager */
66
        $cacheManager = GeneralUtility::makeInstance(CacheManager::class);
×
67

68
        foreach (array_unique($cacheTagsToFlush) as $cacheTag) {
×
69
            $cacheManager->getCache('pages')->flushByTag($cacheTag);
×
70
        }
71
    }
72

73
    /**
74
     * Clear current frontend page cache.
75
     */
76
    public static function clearPageCache()
7✔
77
    {
78
        $pageUid = FrontendUtility::getPageUid();
7✔
79

80
        /** @var $cacheService CacheService */
81
        $cacheService = GeneralUtility::makeInstance(CacheService::class);
7✔
82
        $cacheService->clearPageCache([$pageUid]);
7✔
83
    }
84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc