Completed
Push — master ( 87a78f...b306f9 )
by André
97:52 queued 72:52
created

DeleteLocationSlot::purgeHttpCache()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
cc 2
eloc 6
nc 3
nop 1
rs 9.4285
1
<?php
2
3
/**
4
 * This file is part of the eZ Publish Kernel package.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 *
9
 * @version //autogentag//
10
 */
11
namespace eZ\Publish\Core\MVC\Symfony\Cache\Http\SignalSlot;
12
13
use eZ\Publish\API\Repository\Exceptions\NotFoundException;
14
use eZ\Publish\Core\SignalSlot\Signal;
15
16
/**
17
 * A slot handling DeleteLocationSignal.
18
 */
19
class DeleteLocationSlot extends PurgeForContentHttpCacheSlot
20
{
21
    protected function supports(Signal $signal)
22
    {
23
        return $signal instanceof Signal\LocationService\DeleteLocationSignal;
24
    }
25
26
    /**
27
     * Purges relevant location cache.
28
     *
29
     * @todo Change to be able to clear relations, siblings, ... cache, even when content is already deleted.
30
     *
31
     * @param \eZ\Publish\Core\SignalSlot\Signal\LocationService\DeleteLocationSignal $signal
32
     *
33
     * @return mixed
34
     */
35
    protected function purgeHttpCache(Signal $signal)
36
    {
37
        try {
38
            $locationIds = $this->extractLocationIds($signal);
39
40
            return $this->httpCacheClearer->purgeForContent($this->extractContentId($signal), $locationIds);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\Core\MVC\Symf...rger::purgeForContent() has been deprecated with message: in 6.5, design flaw on deleted/trashed content, use purge() when content does not exist for now. See EZP-25696 for potential future feature to solve this.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
41
        } catch (NotFoundException $e) {
42
            // if content was deleted as well by this operation then fall back to clear location and parent location cache.
43
            $this->httpCacheClearer->purge($locationIds);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\Core\MVC\Symf...wayCachePurger::purge() has been deprecated with message: as of 6.0, might be removed in a future major version. Use purgeForContent() instead when content exist.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
44
        }
45
    }
46
}
47