revolution icon indicating copy to clipboard operation
revolution copied to clipboard

Revo 3: the action /manager/?a=system/refresh_site does not work properly

Open krava77 opened this issue 2 years ago • 0 comments

Feature request

Summary

The action /manager/?a=system/refresh_site does not work properly

Why is it needed?

for example frontendManager component does not clear the cache

Suggested solution(s)

A clear and concise description of what you want to happen. Need to rename file /manager/controllers/default/system/refresh_site.php to /manager/controllers/default/system/refresh_site.class.php and change the code to:

use MODX\Revolution\modManagerController;

class SystemRefreshSiteManagerController extends modManagerController {

    public function process(array $scriptProperties = []) {

        /* invoke OnBeforeCacheUpdate event */
        $this->modx->invokeEvent('OnBeforeCacheUpdate');

        $results= [];
        $this->modx->cacheManager->refresh([], $results);

        /* invoke OnSiteRefresh event */
        $this->modx->invokeEvent('OnSiteRefresh');

        $num_rows_pub = isset($results['publishing']['published']) ? $results['publishing']['published'] : 0;
        $num_rows_unpub = isset($results['publishing']['unpublished']) ? $results['publishing']['unpublished'] : 0;
        $this->modx->smarty->assign('published',$this->modx->lexicon('refresh_published', ['num' => $num_rows_pub]));
        $this->modx->smarty->assign('unpublished',$this->modx->lexicon('refresh_unpublished', ['num' => $num_rows_unpub]));

        $this->modx->smarty->assign('results', $results);

        $this->checkFormCustomizationRules();
        return $this->modx->smarty->fetch('system/refresh_site.tpl');
    }

    public function checkPermissions()
    {
        return $this->modx->hasPermission('empty_cache');
    }

    public function getPageTitle()
    {
        return $this->modx->lexicon('empty_cache');
    }

    public function loadCustomCssJs()
    {
 		return;
    }

    public function getTemplateFile()
    {
        return;
    }
}

krava77 avatar Oct 14 '22 11:10 krava77