MDL-10870 A few more fixes to the file.php page's navigation
[moodle-pu.git] / lib / smarty / core / core.write_compiled_resource.php
blobc701448cd157d6e53d9d4b5c6d60d7fad957b3c9
1 <?php
2 /**
3 * Smarty plugin
4 * @package Smarty
5 * @subpackage plugins
6 */
8 /**
9 * write the compiled resource
11 * @param string $compile_path
12 * @param string $compiled_content
13 * @param integer $resource_timestamp
14 * @return true
16 function smarty_core_write_compiled_resource($params, &$smarty)
18 if(!@is_writable($smarty->compile_dir)) {
19 // compile_dir not writable, see if it exists
20 if(!@is_dir($smarty->compile_dir)) {
21 $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR);
22 return false;
24 $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR);
25 return false;
28 $_params = array('filename' => $params['compile_path'], 'timestamp'=>$params['resource_timestamp'], 'contents' => $params['compiled_content'], 'create_dirs' => true);
29 require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.write_file.php');
30 smarty_core_write_file($_params, $smarty);
31 return true;
34 /* vim: set expandtab: */