Index: branches/5.2.x/core/kernel/nparser/template_cache.php =================================================================== diff -u -N -r14092 -r14095 --- branches/5.2.x/core/kernel/nparser/template_cache.php (.../template_cache.php) (revision 14092) +++ branches/5.2.x/core/kernel/nparser/template_cache.php (.../template_cache.php) (revision 14095) @@ -1,6 +1,6 @@ BasePath = FULL_PATH . THEMES_PATH; $this->_compileToDatabase = defined('SAFE_MODE') && SAFE_MODE; @@ -220,20 +215,22 @@ ); $this->Conn->doInsert($fields_hash, TABLE_PREFIX . 'Cache', 'REPLACE'); + + return ; } - else { - $fp = fopen($filename, 'w'); - if ($this->_compressOutput) { - $compiled_template = $this->_compress($compiled_template); - } + $fp = fopen($filename, 'w'); - if (!fwrite($fp, $compiled_template)) { - trigger_error('Saving compiled template failed', E_USER_ERROR); - } + if ($this->_compressOutput) { + $compiled_template = $this->_compress($compiled_template); + } - fclose($fp); + if ( !fwrite($fp, $compiled_template) ) { + throw new ParserException('Saving compiled template failed'); } + + fclose($fp); + } /** @@ -423,19 +420,22 @@ function CheckDir($dir, $base_path = '') { if (file_exists($dir)) { - return; + return true; } else { // remove $base_path from beggining because it is already created during install - $dir = preg_replace('/^'.preg_quote($base_path.'/', '/').'/', '', $dir, 1); + $dir = preg_replace('/^' . preg_quote($base_path . '/', '/').'/', '', $dir, 1); $segments = explode('/', $dir); $cur_path = $base_path; foreach ($segments as $segment) { // do not add leading / for windows paths (c:\...) - $cur_path .= preg_match('/^[a-zA-Z]{1}:/', $segment) ? $segment : '/'.$segment; - if (!file_exists($cur_path)) { - mkdir($cur_path); + $cur_path .= preg_match('/^[a-zA-Z]{1}:/', $segment) ? $segment : '/' . $segment; + + if ( !file_exists($cur_path) ) { + if ( !mkdir($cur_path) ) { + return false; + } } } }