actions/FlushCache.php
protected function flushCache(Module $current = null)
    {
        $message = '';
        if ($current === null) {
            $current = Yii::$app;
        }
        $modules = $current->getModules();
        foreach ($modules as $moduleName => $module) {
            if (is_array($module)) {
                $module = $current->getModule($moduleName, true);
            }
            if ($module instanceof Module) {
                $message .= $this->flushCache($module);
            }
        }
        $components = $current->getComponents();
        foreach ($components as $componentName => $component) {
            if (is_array($component) && $componentName != 'user') {
                $component = $current->get($componentName);
            }
            if ($component instanceof Cache) {
                $message .= $component->flush() ?
                    '<p>' . Yii::t(
                        'wocenter/app', '{currentModuleName}: {componentName} is flushed.', [
                            'currentModuleName' => $current->className(),
                            'componentName' => $component->className(),
                        ]
                    ) . '</p>' :
                    '';
            }
        }
        
        return $message;
    }
protected function flushCache(Module $current = null)
    {
        $message = '';
        if ($current === null) {
            $current = Yii::$app;
        }
        $modules = $current->getModules();
        foreach ($modules as $moduleName => $module) {
            if (is_array($module)) {
                $module = $current->getModule($moduleName, true);
            }
            if ($module instanceof Module) {
                $message .= $this->flushCache($module);
            }
        }
        $components = $current->getComponents();
        foreach ($components as $componentName => $component) {
            if (is_array($component) && $componentName != 'user') {
                $component = $current->get($componentName);
            }
            if ($component instanceof Cache) {
                $message .= $component->flush() ?
                    '<p>' . Yii::t(
                        'wocenter/app', '{currentModuleName}: {componentName} is flushed.', [
                            'currentModuleName' => $current->className(),
                            'componentName' => $component->className(),
                        ]
                    ) . '</p>' :
                    '';
            }
        }
        
        return $message;
    }
protected function flushCache ( Module $ current = null ) { $ message = '' ; if ( $ current === null ) { $ current = Yii :: $ app ; } $ modules = $ current -> getModules ( ) ; foreach ( $ modules as $ moduleName => $ module ) { if ( is_array ( $ module ) ) { $ module = $ current -> getModule ( $ moduleName , true ) ; } if ( $ module instanceof Module ) { $ message .= $ this -> flushCache ( $ module ) ; } } $ components = $ current -> getComponents ( ) ; foreach ( $ components as $ componentName => $ component ) { if ( is_array ( $ component ) && $ componentName != 'user' ) { $ component = $ current -> get ( $ componentName ) ; } if ( $ component instanceof Cache ) { $ message .= $ component -> flush ( ) ? '<p>' . Yii :: t ( 'wocenter/app' , '{currentModuleName}: {componentName} is flushed.' , [ 'currentModuleName' => $ current -> className ( ) , 'componentName' => $ component -> className ( ) , ] ) . '</p>' : '' ; } } return $ message ; }
Recursive flush all app cache

@param null|Module $current Current Module

@return string execute message
Recursive flush all app cache