Backend\Modules\Pages\Engine\Model::buildCache PHP Method

buildCache() public static method

Build the cache
public static buildCache ( string $language = null )
$language string The language to build the cache for, if not passed we use the working language.
    public static function buildCache($language = null)
    {
        // redefine
        $language = $language === null ? BL::getWorkingLanguage() : (string) $language;
        $cacheBuilder = static::getCacheBuilder();
        $cacheBuilder->buildCache($language);
        // trigger an event
        BackendModel::triggerEvent('Pages', 'after_recreated_cache');
    }

Usage Example

Example #1
0
 /**
  * @param KernelInterface $kernel
  */
 public function __construct(KernelInterface $kernel)
 {
     parent::__construct($kernel);
     // store for later use throughout the application
     $this->getContainer()->set('navigation', $this);
     $this->URL = $this->getContainer()->get('url');
     // check if navigation cache file exists
     if (!is_file(self::getCacheDirectory() . 'navigation.php')) {
         $this->buildCache();
     }
     // check if editor_link_list_LANGUAGE.js cache file exists
     if (!is_file(FRONTEND_CACHE_PATH . '/Navigation/editor_link_list_' . BackendLanguage::getWorkingLanguage() . '.js')) {
         BackendPagesModel::buildCache(BackendLanguage::getWorkingLanguage());
     }
     $navigation = array();
     // require navigation-file
     require self::getCacheDirectory() . 'navigation.php';
     // load it
     $this->navigation = (array) $navigation;
     $this->navigation = $this->addActiveStateToNavigation($this->navigation);
     // cleanup navigation (not needed for god user)
     if (!Authentication::getUser()->isGod()) {
         $this->navigation = $this->cleanup($this->navigation);
     }
 }
All Usage Examples Of Backend\Modules\Pages\Engine\Model::buildCache