mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
add discrete error checking pertaining to $cache_dir
and $compile_dir, their existance and writability
This commit is contained in:
@@ -20,6 +20,17 @@
|
|||||||
|
|
||||||
function smarty_core_write_cache_file($params, &$this)
|
function smarty_core_write_cache_file($params, &$this)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!@is_writable($this->cache_dir)) {
|
||||||
|
// cache_dir not writable, see if it exists
|
||||||
|
if(!@is_dir($this->cache_dir)) {
|
||||||
|
$this->trigger_error('the $cache_dir \'' . $this->cache_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->trigger_error('unable to write to $cache_dir \'' . realpath($this->cache_dir) . '\'. Be sure $cache_dir is writable by the web server user.', E_USER_ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// put timestamp in cache header
|
// put timestamp in cache header
|
||||||
$this->_cache_info['timestamp'] = time();
|
$this->_cache_info['timestamp'] = time();
|
||||||
if ($this->cache_lifetime > -1){
|
if ($this->cache_lifetime > -1){
|
||||||
|
@@ -15,6 +15,16 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_core_write_compiled_template($params, &$this)
|
function smarty_core_write_compiled_template($params, &$this)
|
||||||
{
|
{
|
||||||
|
if(!@is_writable($this->compile_dir)) {
|
||||||
|
// compile_dir not writable, see if it exists
|
||||||
|
if(!@is_dir($this->compile_dir)) {
|
||||||
|
$this->trigger_error('the $compile_dir \'' . $this->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$this->trigger_error('unable to write to $compile_dir \'' . realpath($this->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$_params = array('filename' => $params['compile_path'], 'contents' => $params['template_compiled'], 'create_dirs' => true);
|
$_params = array('filename' => $params['compile_path'], 'contents' => $params['template_compiled'], 'create_dirs' => true);
|
||||||
$this->_execute_core_function('write_file', $_params);
|
$this->_execute_core_function('write_file', $_params);
|
||||||
touch($params['compile_path'], $params['template_timestamp']);
|
touch($params['compile_path'], $params['template_timestamp']);
|
||||||
|
Reference in New Issue
Block a user