mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- optimization replace hhvm extension by inline code
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
===== 3.1.30-dev ===== (xx.xx.xx)
|
||||
25.12.2015
|
||||
- compile {block} tag code and its processing into classes
|
||||
- optimization replace hhvm extension by inline code
|
||||
|
||||
24.12.2015
|
||||
- new feature Compiler does now observe the template_dir setting and will create separate compiled files if required
|
||||
|
@@ -98,7 +98,8 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
|
||||
$_smarty_tpl = $_template;
|
||||
$_template->cached->valid = false;
|
||||
if ($update && defined('HHVM_VERSION')) {
|
||||
return $_template->smarty->ext->_hhvm->includeHhvm($_template, $_template->cached->filepath);
|
||||
eval("?>" . file_get_contents($_template->cached->filepath));
|
||||
return true;
|
||||
} else {
|
||||
return @include $_template->cached->filepath;
|
||||
}
|
||||
|
@@ -14,7 +14,6 @@
|
||||
* @property Smarty_Internal_Runtime_TplFunction $_tplFunction
|
||||
* @property Smarty_Internal_Runtime_Var $_var
|
||||
* @property Smarty_Internal_Runtime_Foreach $_foreach
|
||||
* @property Smarty_Internal_Runtime_Hhvm $_hhvm
|
||||
* @property Smarty_Internal_Runtime_WriteFile $_writeFile
|
||||
* @property Smarty_Internal_Runtime_CodeFrame $_codeFrame
|
||||
* @property Smarty_Internal_Runtime_FilterHandler $_filterHandler
|
||||
|
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Runtime Extension Hhvm
|
||||
*
|
||||
* include patch for modified compiled or cached templates
|
||||
* HHVM does not check if file was modified when including same file multiple times
|
||||
*
|
||||
* @package Smarty
|
||||
* @subpackage PluginsInternal
|
||||
* @author Uwe Tews
|
||||
*/
|
||||
class Smarty_Internal_Runtime_Hhvm
|
||||
{
|
||||
/**
|
||||
* @param \Smarty_Internal_Template $_template
|
||||
* @param string $file file name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
static function includeHhvm(Smarty_Internal_Template $_template, $file)
|
||||
{
|
||||
$_smarty_tpl = $_template;
|
||||
$tmp_file = $file . preg_replace('![^\w]+!', '_', uniqid(rand(), true)) . '.php';
|
||||
file_put_contents($tmp_file, file_get_contents($file));
|
||||
$result = @include $tmp_file;
|
||||
@unlink($tmp_file);
|
||||
return $result;
|
||||
}
|
||||
}
|
@@ -475,7 +475,6 @@ class Smarty_Internal_TestInstall
|
||||
'smarty_internal_runtime_filterhandler.php' => true,
|
||||
'smarty_internal_runtime_foreach.php' => true,
|
||||
'smarty_internal_runtime_getincludepath.php' => true,
|
||||
'smarty_internal_runtime_hhvm.php' => true,
|
||||
'smarty_internal_runtime_inheritance.php' => true,
|
||||
'smarty_internal_runtime_tplfunction.php' => true,
|
||||
'smarty_internal_runtime_updatecache.php' => true,
|
||||
|
@@ -169,7 +169,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
||||
}
|
||||
$_smarty_tpl = $_template;
|
||||
if (defined('HHVM_VERSION')) {
|
||||
$_template->smarty->ext->_hhvm->includeHhvm($_template, $_template->compiled->filepath);
|
||||
eval("?>" . file_get_contents($_template->compiled->filepath));
|
||||
} else {
|
||||
include($_template->compiled->filepath);
|
||||
}
|
||||
|
Reference in New Issue
Block a user