diff --git a/libs/plugins/core.write_cache_file.php b/libs/plugins/core.write_cache_file.php index 9c37bf13..a99555e6 100644 --- a/libs/plugins/core.write_cache_file.php +++ b/libs/plugins/core.write_cache_file.php @@ -20,6 +20,17 @@ 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 $this->_cache_info['timestamp'] = time(); if ($this->cache_lifetime > -1){ diff --git a/libs/plugins/core.write_compiled_template.php b/libs/plugins/core.write_compiled_template.php index b599af20..e5d983ff 100644 --- a/libs/plugins/core.write_compiled_template.php +++ b/libs/plugins/core.write_compiled_template.php @@ -15,8 +15,18 @@ */ 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); - $this->_execute_core_function('write_file', $_params); + $this->_execute_core_function('write_file', $_params); touch($params['compile_path'], $params['template_timestamp']); return true; }