Contao\Automator::purgeScriptCache PHP Method

purgeScriptCache() public method

Purge the script cache
public purgeScriptCache ( )
    public function purgeScriptCache()
    {
        // assets/js and assets/css
        foreach (array('assets/js', 'assets/css') as $dir) {
            // Purge the folder
            $objFolder = new \Folder($dir);
            $objFolder->purge();
        }
        // Recreate the internal style sheets
        $this->import('StyleSheets');
        $this->StyleSheets->updateStyleSheets();
        // Also empty the page cache so there are no links to deleted scripts
        $this->purgePageCache();
        // Add a log entry
        $this->log('Purged the script cache', __METHOD__, TL_CRON);
    }

Usage Example

 /**
  * Overwrite for Automator::purgeScriptCache()
  * Makes sure the forum layout is regenerated
  *
  */
 public function purgeScriptCache()
 {
     $automator = new Automator();
     $automator->purgeScriptCache();
     System::getContainer()->get('phpbb_bridge.connector')->generateForumLayoutFiles();
     $this->log('Purged the phpbb forum cache', __METHOD__, TL_CRON);
 }