Empty cache

@param Smarty_Internal_Template $_template template object
@param integer                  $exp_time  expiration time (number of seconds, not timestamp)
@return integer number of cache files deleted
331450
public function clearAll(Smarty $smarty, $exp_time = null)
        {
            return $this->clear($smarty, null, null, null, $exp_time);
        }
1347740
public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null)
    {
        /** @var Smarty_Internal_Template $_smarty_tpl
         * used in included file
         */
        $_smarty_tpl = $_template;

        return @include $_template->cached->filepath;
    }
1329983
public function compileTemplate(Smarty_Internal_Template $template)
    {
        if (empty($template->properties['nocache_hash'])) {
            $template->properties['nocache_hash'] = $this->nocache_hash;
        } else {
            $this->nocache_hash = $template->properties['nocache_hash'];
        }
        // flag for nochache sections
        $this->nocache = false;
        $this->tag_nocache = false;
        // save template object in compiler class
        $this->template = $template;
        // reset has noche code flag
        $this->template->has_nocache_code = false;
        $this->smarty->_current_file = $saved_filepath = $this->template->source->filepath;
        // template header code
        $template_header = '';
        if (!$this->suppressHeader) {
            $template_header .= "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n";
            $template_header .= "         compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
        }

        do {
            // flag for aborting current and start recompile
            $this->abort_and_recompile = false;
            // get template source
            $_content = $template->source->content;
            // run prefilter if required
            if (isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) {
                $template->source->content = $_content = Smarty_Internal_Filter_Handler::runFilter('pre', $_content, $template);
            }
            // on empty template just return header
            if ($_content == '') {
                if ($this->suppressTemplatePropertyHeader) {
                    $code = '';
                } else {
                    $code = $template_header . $template->createTemplateCodeFrame();
                }
                return $code;
            }
            // call compiler
            $_compiled_code = $this->doCompile($_content);
        } while ($this->abort_and_recompile);
        $this->template->source->filepath = $saved_filepath;
        // free memory
        unset($this->parser->root_buffer, $this->parser->current_buffer, $this->parser, $this->lex, $this->template);
        self::$_tag_objects = array();
        // return compiled code to template object
        $merged_code = '';
        if (!$this->suppressMergedTemplates) {
            foreach ($this->merged_templates as $code) {
                $merged_code .= $code;
            }
        }
        if ($this->suppressTemplatePropertyHeader) {
            $code = $_compiled_code . $merged_code;
        } else {
            $code = $template_header . $template->createTemplateCodeFrame($_compiled_code) . $merged_code;
        }
        // run postfilter if required
        if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) {
            $code = Smarty_Internal_Filter_Handler::runFilter('post', $code, $template);
        }
        return $code;
    }
715581
public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter)
    {
        if ($_template->source->handler->uncompiled) {
            ob_start();
            $_template->source->render($_template);
        } else {
            ob_start();
            if (!isset($_template->compiled)) {
                $_template->loadCompiled();
            }
            $_template->compiled->render($_template);
        }
        if ($_template->smarty->debugging) {
            $_template->smarty->_debug->start_cache($_template);
        }
        $this->removeNoCacheHash($cached, $_template, $no_output_filter);
        $compile_check = $_template->smarty->compile_check;
        $_template->smarty->compile_check = false;
        if (isset($_template->parent) && $_template->parent->_objType == 2) {
            $_template->compiled->unifunc = $_template->parent->compiled->unifunc;
        }
        if (!$_template->cached->processed) {
            $_template->cached->process($_template, true);
        }
        $_template->smarty->compile_check = $compile_check;
        $cached->getRenderedTemplateCode($_template);
        if ($_template->smarty->debugging) {
            $_template->smarty->_debug->end_cache($_template);
        }
    }
976012
function SmartTemplate ( $template_filename = '' )
		{
			global $_CONFIG;

			if (!empty($_CONFIG['smarttemplate_compiled']))
			{
				$this->temp_dir  =  $_CONFIG['smarttemplate_compiled'];
			}
			if (!empty($_CONFIG['smarttemplate_cache']))
			{
				$this->cache_dir  =  $_CONFIG['smarttemplate_cache'];
			}
			if (is_numeric($_CONFIG['cache_lifetime']))
			{
				$this->cache_lifetime  =  $_CONFIG['cache_lifetime'];
			}
			if (!empty($_CONFIG['template_dir'])  &&  is_file($_CONFIG['template_dir'] . '/' . $template_filename))
			{
				$this->template_dir  =  $_CONFIG['template_dir'];
			}
			$this->tpl_file  =  $template_filename;
		}
1271316
public function destroy(TemplateRequest $request, $template)
    {
        $template = $request->template;
        $path = theme_path('views').$template;

        // Block and notify if file does not exist.
        if (! \File::exists($path)) {
            return $this->makeRedirect(false, 'admin.templates.index', sprintf(
                __('msg.not_exists'), $template
            ));
        }

        // Block if file not delete.
        if (! \File::delete($path)) {
            return $this->makeRedirect(false, 'admin.templates.index', sprintf(
                __('msg.not_deleted'), $template
            ));
        }
        
        return $this->makeRedirect(true, 'admin.templates.index', sprintf(
            __('msg.deleted'), $template
        ));
    }
238026
static function cachedTree( $key, $uri, $res, $templatePath, &$extraParameters )
    {
        $templateCache =& eZTemplateTreeCache::cacheTable();
        $key = eZTemplateTreeCache::internalKey( $key );
        $root = null;
        if ( isset( $templateCache[$key] ) )
        {
            $root =& $templateCache[$key]['root'];
            eZDebugSetting::writeDebug( 'eztemplate-tree-cache', "Cache hit for uri '$uri' with key '$key'", 'eZTemplateTreeCache::cachedTree' );
        }
        else
            eZDebugSetting::writeDebug( 'eztemplate-tree-cache', "Cache miss for uri '$uri' with key '$key'", 'eZTemplateTreeCache::cachedTree' );

        return $root;
    }
397053
private function findTemplate($template)
    {
        $logicalName = (string) $template;

        if (isset($this->cache[$logicalName])) {
            return $this->cache[$logicalName];
        }

        $template = $this->templateNameParser->parse($template);
        $file = $this->templateLocator->locate($template);

        return $this->cache[$logicalName] = $file;
    }
177655
static function storeCache( $key, $templateFilepath )
    {
        if ( !eZTemplateTreeCache::isCacheEnabled() )
            return false;
        $templateCache =& eZTemplateTreeCache::cacheTable();
        $key = eZTemplateTreeCache::internalKey( $key );
        if ( !isset( $templateCache[$key] ) )
        {
            eZDebug::writeDebug( "Template cache for key '$key' does not exist, cannot store cache", __METHOD__ );
            return;
        }
        $cacheFileName = eZTemplateTreeCache::treeCacheFilename( $key, $templateFilepath );

        $cache =& $templateCache[$key];

        $php = new eZPHPCreator( eZTemplateTreeCache::cacheDirectory(), $cacheFileName );
        $php->addVariable( 'eZTemplateTreeCacheCodeDate', eZTemplateTreeCache::CODE_DATE );
        $php->addSpace();
        $php->addVariable( 'TemplateInfo', $cache['info'] );
        $php->addSpace();
        $php->addVariable( 'TemplateRoot', $cache['root'] );
        $php->store( true );
    }
1295293
static function hasCompiledTemplate( $key, $timestamp, &$resourceData )
    {
        if ( !eZTemplateCompiler::isCompilationEnabled() )
            return false;
        if ( eZTemplateCompiler::alwaysGenerate() )
            return false;

        $cacheFileName = eZTemplateCompiler::compilationFilename( $key, $resourceData );

        $php = new eZPHPCreator( eZTemplateCompiler::compilationDirectory(), $cacheFileName, eZTemplateCompiler::TemplatePrefix() );
        $canRestore = $php->canRestore( $timestamp );
        $uri = false;
        if ( $canRestore )
            eZDebugSetting::writeDebug( 'eztemplate-compile', "Cache hit for uri '$uri' with key '$key'", 'eZTemplateCompiler::hasCompiledTemplate' );
        else
            eZDebugSetting::writeDebug( 'eztemplate-compile', "Cache miss for uri '$uri' with key '$key'", 'eZTemplateCompiler::hasCompiledTemplate' );
        return $canRestore;
    }
667834
public function clearAll(Smarty $smarty, $exp_time = null)
    {
        return Smarty_Internal_Extension_Clear::clear($smarty, null, null, null, $exp_time);
    }
1020592
def delete_template(template_disk)
      Log.debug "deleting template #{template_disk}"
      template = File.join(@templates_dir, File.basename(template_disk))
      template_flat = File.join(@templates_dir, File.basename(template_disk, ".vmdk") + "-flat.vmdk")
      Net::SSH.start(@address, @user, :password => @password) do |ssh|
        if (ssh.exec! "ls #{template} 2>/dev/null").nil?
          Log.error "Template #{template_disk} does not exist"
          raise "Template does not exist"
        end
        ssh.exec!("rm -f #{template} && rm -f #{template_flat} 2>&1")
      end
    end
204700
public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
    {
        $compiled->filepath = false;
        $compiled->timestamp = false;
        $compiled->exists = false;
    }
913650
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
    {
        $source->filepath = $source->type . ':' . $source->name;
        $source->uid = sha1($source->type . ':' . $source->name);

        $mtime = $this->fetchTimestamp($source->name);
        if ($mtime !== null) {
            $source->timestamp = $mtime;
        } else {
            $this->fetch($source->name, $content, $timestamp);
            $source->timestamp = isset($timestamp) ? $timestamp : false;
            if (isset($content)) {
                $source->content = $content;
            }
        }
        $source->exists = !!$source->timestamp;
    }
18471
public function removeNoCacheHash(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template,
                                      $no_output_filter)
    {
        $content = ob_get_clean();
        unset($cached->hashes[$_template->compiled->nocache_hash]);
        if (!empty($cached->hashes)) {
            $hash_array = array();
            foreach ($cached->hashes as $hash => $foo) {
                $hash_array[] = "/{$hash}/";
            }
            $content = preg_replace($hash_array, $_template->compiled->nocache_hash, $content);
        }
        $_template->cached->has_nocache_code = false;
        // get text between non-cached items
        $cache_split =
            preg_split("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
                       $content);
        // get non-cached items
        preg_match_all("!/\*%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*\/(.+?)/\*/%%SmartyNocache:{$_template->compiled->nocache_hash}%%\*/!s",
                       $content, $cache_parts);
        $content = '';
        // loop over items, stitch back together
        foreach ($cache_split as $curr_idx => $curr_split) {
            // escape PHP tags in template content
            $content .= preg_replace('/(<%|%>|<\?php|<\?|\?>|<script\s+language\s*=\s*[\"\']?\s*php\s*[\"\']?\s*>)/',
                                     "<?php echo '\$1'; ?>\n", $curr_split);
            if (isset($cache_parts[0][$curr_idx])) {
                $_template->cached->has_nocache_code = true;
                $content .= $cache_parts[1][$curr_idx];
            }
        }
        if (!$no_output_filter && !$_template->compiled->has_nocache_code &&
            (isset($_template->smarty->autoload_filters['output']) ||
                isset($_template->smarty->registered_filters['output']))
        ) {
            $content = $_template->smarty->ext->_filterHandler->runFilter('output', $content, $_template);
        }
        // write cache file content
        $this->writeCachedContent($cached, $_template, $content);
    }
888767
public function getCachedContent(Smarty_Internal_Template $_template)
    {
        if ($_template->cached->handler->process($_template)) {
            ob_start();
            $_template->properties['unifunc']($_template);

            return ob_get_clean();
        }

        return null;
    }
1112200
public function read(Smarty_Internal_Template $_template)
    {
        if (!$_template->source->handler->recompiled) {
            return $this->handler->readCachedContent($_template);
        }
        return false;
    }