View Issue Details

IDProjectCategoryView StatusLast Update
0006931OXID eShop (all versions)4.08. Cachepublic2019-09-25 09:38
Reportermichael_keiluweit 
PriorityhighSeveritymajorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version6.1.1 
Target VersionFixed in Version 
Summary0006931: EE: Article::onChange calls ContentCache::reset twice.
DescriptionThe method \OxidEsales\EshopEnterprise\Application\Model\Article::onChange calls \OxidEsales\EshopEnterprise\Application\Model\Article::_resetCache which has a logic to control the cache wether it should be flushed completely or only particular.
After the call of _resetCache is an additional flushing of the cache, which is too much as it makes the work before completely unnecessary.

We have to possible cases in _resetCache:
1. The cache was flushed completely, then the second flush is overhead.
2. The cache was flushed particularly, then the second flush flushes too much.

Furthermore the method _resetCache checks if the call was made in the frontend and if the cache is active. The other call of the flushing doesn't check the context.
That means:
1. Either the second call is overhead and has to be removed
2. Or there is a missing check if the call was made in the context of the backend like: If the call came from the frontend check if the cache only have to flush particular or check if the call comes from the backend and if so, flush the cache in every case completely.
Additional InformationThe Method \OxidEsales\EshopEnterprise\Application\Model\Article::onChange
// cache control ..
$this->_resetCache($articleId);  

[...]

if ($config->getConfigParam('blUseContentCaching')) {
    $genericCache = oxNew(\OxidEsales\Eshop\Core\Cache\DynamicContent\ContentCache::class);
    $genericCache->reset();
}


If you would add the cache logic from _resetCache to onChange:

// cache control ..

// < instead of calling the method _resetCache>
if (!$this->isAdmin() && $config->getConfigParam('blUseContentCaching')) {
    $contentCache = oxNew(\OxidEsales\Eshop\Core\Cache\DynamicContent\ContentCache::class);
    
    if ($database->getOne($query)) {
        $contentCache->reset();
        return;
    }
    [...]
    $contentCache->resetOn($resetOn);
// </ instead of calling the method _resetCache>

[...]

if ($config->getConfigParam('blUseContentCaching')) {
    $genericCache = oxNew(\OxidEsales\Eshop\Core\Cache\DynamicContent\ContentCache::class);
    $genericCache->reset();
}


As you see, the logic from _resetCache is completely unnecessary as at the end of onChange the cache is flushed every time completely.
Because of that, I think, there is a missing check if the method was called in the context of the administration area.
TagsCache, EE
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
MySQL VersionNot defined

Activities

There are no notes attached to this issue.