mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- bugfix/improvement of compileAlltemplates() follow symlinks in template folder (PHP >= 5.3.1) https://github.com/smarty-php/smarty/issues/224
clear internal cache and expension handler for each template to avoid possible conflicts https://github.com/smarty-php/smarty/issues/231
This commit is contained in:
@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.30-dev/71';
|
const SMARTY_VERSION = '3.1.30-dev/72';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
|
@@ -17,16 +17,17 @@ class Smarty_Internal_Method_CompileAllConfig extends Smarty_Internal_Method_Com
|
|||||||
*
|
*
|
||||||
* @api Smarty::compileAllConfig()
|
* @api Smarty::compileAllConfig()
|
||||||
*
|
*
|
||||||
* @param \Smarty $smarty
|
* @param \Smarty $dummy smarty object of calling instance
|
||||||
|
* @param \Smarty $smarty passed smarty object
|
||||||
* @param string $extension file extension
|
* @param string $extension file extension
|
||||||
* @param bool $force_compile force all to recompile
|
* @param bool $force_compile force all to recompile
|
||||||
* @param int $time_limit
|
* @param int $time_limit
|
||||||
* @param int $max_errors
|
* @param int $max_errors
|
||||||
*
|
*
|
||||||
* @return integer number of template files recompiled
|
* @return int number of template files recompiled
|
||||||
*/
|
*/
|
||||||
public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0,
|
public function compileAllConfig(Smarty $dummy, Smarty $smarty, $extension = '.conf', $force_compile = false,
|
||||||
$max_errors = null)
|
$time_limit = 0, $max_errors = null)
|
||||||
{
|
{
|
||||||
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
|
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,8 @@ class Smarty_Internal_Method_CompileAllTemplates
|
|||||||
*
|
*
|
||||||
* @api Smarty::compileAllTemplates()
|
* @api Smarty::compileAllTemplates()
|
||||||
*
|
*
|
||||||
* @param \Smarty $smarty
|
* @param \Smarty $dummy smarty object of calling instance
|
||||||
|
* @param \Smarty $smarty passed smarty object
|
||||||
* @param string $extension file extension
|
* @param string $extension file extension
|
||||||
* @param bool $force_compile force all to recompile
|
* @param bool $force_compile force all to recompile
|
||||||
* @param int $time_limit
|
* @param int $time_limit
|
||||||
@@ -31,7 +32,7 @@ class Smarty_Internal_Method_CompileAllTemplates
|
|||||||
*
|
*
|
||||||
* @return integer number of template files recompiled
|
* @return integer number of template files recompiled
|
||||||
*/
|
*/
|
||||||
public function compileAllTemplates(Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0,
|
public function compileAllTemplates(Smarty $dummy, Smarty $smarty, $extension = '.tpl', $force_compile = false, $time_limit = 0,
|
||||||
$max_errors = null)
|
$max_errors = null)
|
||||||
{
|
{
|
||||||
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
|
return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors);
|
||||||
@@ -61,7 +62,7 @@ class Smarty_Internal_Method_CompileAllTemplates
|
|||||||
$sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
|
$sourceDir = $isConfig ? $smarty->getConfigDir() : $smarty->getTemplateDir();
|
||||||
// loop over array of source directories
|
// loop over array of source directories
|
||||||
foreach ($sourceDir as $_dir) {
|
foreach ($sourceDir as $_dir) {
|
||||||
$_dir_1 = new RecursiveDirectoryIterator($_dir);
|
$_dir_1 = new RecursiveDirectoryIterator($_dir, defined('FilesystemIterator::FOLLOW_SYMLINKS') ? FilesystemIterator::FOLLOW_SYMLINKS : 0);
|
||||||
$_dir_2 = new RecursiveIteratorIterator($_dir_1);
|
$_dir_2 = new RecursiveIteratorIterator($_dir_1);
|
||||||
foreach ($_dir_2 as $_fileinfo) {
|
foreach ($_dir_2 as $_fileinfo) {
|
||||||
$_file = $_fileinfo->getFilename();
|
$_file = $_fileinfo->getFilename();
|
||||||
@@ -78,6 +79,10 @@ class Smarty_Internal_Method_CompileAllTemplates
|
|||||||
flush();
|
flush();
|
||||||
$_start_time = microtime(true);
|
$_start_time = microtime(true);
|
||||||
$_smarty = clone $smarty;
|
$_smarty = clone $smarty;
|
||||||
|
//
|
||||||
|
$_smarty->_cache = array();
|
||||||
|
$_smarty->ext = new Smarty_Internal_Extension_Handler();
|
||||||
|
$_smarty->ext->objType = $_smarty->_objType;
|
||||||
$_smarty->force_compile = $force_compile;
|
$_smarty->force_compile = $force_compile;
|
||||||
try {
|
try {
|
||||||
/* @var Smarty_Internal_Template $_tpl */
|
/* @var Smarty_Internal_Template $_tpl */
|
||||||
|
Reference in New Issue
Block a user