Generates the template mapper array.

@param string $cacheDir The cache directory
359718
private function generateTemplateMapper($cacheDir)
    {
        $files = $this->templateUtil->getAllTemplates();

        if (empty($files)) {
            return;
        }

        $this->filesystem->dumpFile(
            $cacheDir.'/contao/config/twig-templates.php',
            sprintf("<?php\n\nreturn %s;\n", var_export($files, true))
        );
    }
966932
public function clear($cacheDir)
    {
        $fs = new Filesystem();
        $proxyCacheDir = $cacheDir.'/kitpages_proxy';
        if ($fs->exists($proxyCacheDir)) {
            die('here');
            $fs->remove($proxyCacheDir);
        }
    }
1099323
public function generateAllCacheTree($cacheDir)
    {
        $this->cacheDir = $cacheDir;

        $tables = $this->database->listTables();

        foreach ($tables as $table) {
            // trigger loadDataContainer TL_HOOK
            System::getContainer()->get('huh.utils.dca')->loadDc($table);
        }
    }
1170122
public function GetGenericTemplate($name, $subdir="")
    {
        if($subdir)
            $subdir = trim($subdir, "\\/") . "/";
        
        return $this->templates_path
            . $subdir
            . "{$name}.php"
        ;
    }
1272235
public function setTemplateDir($dir)
    {
        $tmpDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR;
        if (is_dir($tmpDir) === false) {
            throw new Exception('The template directory: "' . $tmpDir . '" does not exists, create the directory or specify an other location !');
        }
        $this->templateDir[] = $tmpDir;
    }
1147596
public function warmUp($cacheDir)
    {
        if (empty($this->activeTheme)) {
            return;
        }

        $locator = $this->locator->getLocator();

        /** @var TemplateReferenceInterface[] $allTemplates */
        $allTemplates = $this->finder->findAllTemplates();

        $templates = array();
        foreach ($this->activeTheme->getThemes() as $theme) {
            $this->activeTheme->setName($theme);
            foreach ($allTemplates as $template) {
                try {
                    $templates[$template->getLogicalName().'|'.$theme] = $locator->locate($template->getPath());
                } catch (\InvalidArgumentException $e) {
                }
            }
        }

        $this->writeCacheFile($cacheDir.'/templates.php', sprintf('<?php return %s;', var_export($templates, true)));
    }
1049315
public static function get_template_parts( $directory, $exclude_underscore = false ) {
		if ( ! is_dir( $directory ) ) {
			return;
		}

		$files = static::get_include_files( $directory, $exclude_underscore );

		foreach ( $files['files'] as $file ) {
			$file = realpath( $file );
			$template_name = str_replace( [ trailingslashit( realpath( get_template_directory() ) ), '.php' ], '', $file );
			\get_template_part( $template_name );
		}

		foreach ( $files['directories'] as $directory ) {
			static::get_template_parts( $directory, $exclude_underscore );
		}
	}
918176
public static function configureCache($cacheDriver)
    {
        $cache = null;

        switch (strtolower($cacheDriver['type'])) {
            case 'apc':
                $cache = new \Doctrine\Common\Cache\ApcCache();
                break;

            case 'xcache':
                $cache = new \Doctrine\Common\Cache\XcacheCache();
                break;

            case 'memcache':
                $cache = self::configureMemcacheCache($cacheDriver['host'], $cacheDriver['port']);
                break;

            case 'redis':
                $cache = self::configureRedisCache($cacheDriver['host'], $cacheDriver['port']);
                break;

            case 'array':
                $cache = new \Doctrine\Common\Cache\ArrayCache();
                break;
        }

        return $cache;
    }
1015097
protected function verifyDirectoryExistence($base, $cacheDir)
    {
        if (is_dir("$base/$cacheDir")) {
            return;
        }

        $folder_path = explode('/', $cacheDir);
        foreach ($folder_path as $element) {
            $base .= '/' . $element;
            if (!is_dir($base)) {
                mkdir($base, 0755, true);
                chmod($base, 0755);
            }
        }
    }
476639
public function warmUp($cacheDir)
    {
        $iterator = new ResourceFilterIterator(
            new RecursiveResourceIteratorIterator(
                new ResourceCollectionIterator(
                    $this->repo->get('/')->listChildren(),
                    ResourceCollectionIterator::CURRENT_AS_PATH
                ),
                RecursiveResourceIteratorIterator::SELF_FIRST
            ),
            $this->suffix,
            ResourceFilterIterator::FILTER_BY_NAME | ResourceFilterIterator::MATCH_SUFFIX
        );

        foreach ($iterator as $path) {
            try {
                $this->twig->loadTemplate($path);
            } catch (Twig_Error $e) {
                // Problem during compilation, stop
            }
        }
    }
946663
protected function generateMapperFileAbstract($dir)
    {
        $file = $dir . '/' . $this->config->getClassname() . 'MapperAbstract.php';

        if (!is_readable($file) && false === file_put_contents($file, '')) {
            throw new \RuntimeException('Cannot create empty class file: ' . $file);
        }

        $content = '<?php

/**
 * Copyright (c) 2010-' . date('Y') . ' ' . $this->config->getAuthor() . '
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ' . $this->baseNamespace . 'Mapper\\' . $this->config->getNamespace() . '\Abstracts;

use Eureka\Component\Orm\DataMapper\MapperAbstract;
use ' . $this->baseNamespace . 'Data\\' . $this->config->getNamespace() . '\\' . $this->config->getClassname() . ';

/**
 * /!\ AUTO GENERATED FILE. DO NOT EDIT THIS FILE.
 * THIS FILE IS OVERWRITTEN WHEN THE ORM SCRIPT GENERATOR IS RAN.
 * You can add you specific code in child class: ' . $this->config->getClassname() . '
 *
 * @author  ' . $this->config->getAuthor() . '
 * @version ' . $this->config->getVersion() . '
 */
abstract class ' . $this->config->getClassname() . 'MapperAbstract extends MapperAbstract
{
    /**
     * @var string $dataClass Name of class use to instance DataMapper Data class.
     */
    protected $dataClass = \'\\' . $this->baseNamespace . 'Data\\' . $this->config->getNamespace() . '\\' . $this->config->getClassname() . '\';

    /**
     * @var string $databaseConfig Database config name
     */
    protected $databaseConfig = \'' . $this->config->getDbConfig() . '\';

    /**
     * @var array $fields List of fields
     */
    protected $table = \'' . $this->config->getDbTable() . '\';

    /**
     * @var array $fields List of fields
     */
    protected $fields = array(
' . $this->vars['db_fields'] . '
    );

    /**
     * @var array $primaryKeys List of primary keys
     */
    protected $primaryKeys = array(
' . $this->vars['db_primary_keys'] . '
    );

    /**
     * @var array $primaryKeys List of primary keys
     */
    protected $dataNamesMap = array(
' . $this->vars['data_names_map'] . '
    );

    /**
     * @var string $cacheName Name of cache config to use.
     */
    protected $cacheName = \'' . $this->config->getCacheName() . '\';

    /**
     * @var bool $isCacheEnabled
     */
    protected $isCacheEnabled = ' . var_export($this->config->hasCache(), true) . ';

    /**
     * Get first row corresponding of the id.
     *
     * @param  int $id
     * @return ' . $this->config->getClassname() . '
     */
    public function findById($id)
    {
        return parent::findById($id);
    }

    /**
     * Get first row corresponding of the primary keys.
     *
     * @param  array $primaryKeys
     * @return ' . $this->config->getClassname() . '
     */
    public function findByKeys($primaryKeys)
    {
        return parent::findByKeys($primaryKeys);
    }

    /**
     * Select all rows corresponding of where clause.
     *
     * @return ' . $this->config->getClassname() . '[] List of row.
     */
    public function select()
    {
        return parent::select();
    }

    /**
     * Select first rows corresponding to where clause.
     *
     * @return ' . $this->config->getClassname() . '
     */
    public function selectOne()
    {
        return parent::selectOne();
    }

    /**
     * Fetch rows for specified query.
     *
     * @param string $query
     * @return ' . $this->config->getClassname() . '[] Array of model_base object for query.
     */
    public function query($query)
    {
        return parent::query($query);
    }

    /**
     * Create new instance of extended DataAbstract class & return it.
     *
     * @param  \stdClass $row
     * @param  bool      $exists
     * @return ' . $this->config->getClassname() . '
     */
    public function newDataInstance(\stdClass $row = null, $exists = false)
    {
        return parent::newDataInstance($row, $exists);
    }
}
';
        if (false === file_put_contents($file, $content)) {
            throw new \RuntimeException('Unable to write file content! (file: ' . $file . ')');
        }
    }
1334215
public function warmUp($cacheDir)
    {
        if (false === is_dir($this->assetsDir)) {
            return;
        }

        $finder = new Finder();
        $finder->files()->in($this->assetsDir);

        $result = [];

        /** @var SplFileInfo $file */
        foreach ($finder as $file) {
            $cannonicalName = $file->getRelativePathname();

            $result[$cannonicalName] = $this->versioningScheme->getVersion('/' . $cannonicalName);
        }

        $cacheDir = sprintf($cacheDir . '/' . $this->cacheName);
        $this->writeCacheFile($cacheDir, sprintf('<?php return %s;', var_export($result, true)));

    }
949989
public function searchOrigDir(File $cacheDir) {
        foreach ($this->autoDirPathMap as $entry_set) {
            $orig_dir = $entry_set[0];
            $cache_dir = $entry_set[1];
            if ($cacheDir->getAbsolutePath() === $cache_dir->getAbsolutePath()) {
                return $orig_dir;
            }
        }
        return null;
    }
694804
static function cacheDirectory()
    {
        $cacheDirectory =& $GLOBALS['eZTemplateTreeCacheDirectory'];
        if ( !isset( $cacheDirectory ) )
        {
            $cacheDirectory = eZDir::path( array( eZSys::cacheDirectory(), 'template/tree' ) );
        }
        return $cacheDirectory;
    }
1260600
protected function makeCacheableDir()
    {
        if ($this->configure['cache']) {
            $this->makeDirectories(strval($this->configure['cache_dir']), 0775);
            $this->cacheable = true;
        }
    }
600345
public void setDebugCacheDir(File cacheDir) {
        if (sDebug) {
            LogUtils.v(TAG, "setCacheDir() cacheDir=" + cacheDir);
        }
        mCacheDir = cacheDir;
        checkCacheDir(false);
    }
1155014
public function initializeTemplate($directory = null)
	{
		if (empty($directory)) {
			$directory = $this->config->resolvePath('views');
		}

		// Remember what directory was set. We may have to reinitialize the template later and don't want to lose the previous setting.
		$this->views_directory = $directory;

		$this->template = new Template($directory, $this->config);

		// Add our url builder to the template.
		$extension = new \werx\Url\Extensions\Plates(null, null, $this->expose_script_name);
		$this->template->loadExtension($extension);
	}