Changeset 705272
- Timestamp:
- 04/29/2013 08:23:38 AM (13 years ago)
- File:
-
- 1 edited
-
lips/branches/dev-0.8.10/templating.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lips/branches/dev-0.8.10/templating.php
r563270 r705272 55 55 $this->enableSecurity(new LinkedInProfileSync_Security_Policy($modifiers = array('in_array'))); 56 56 $this->setCaching(Smarty::CACHING_OFF); 57 $this->setCompile Dir(dirname(__FILE__) . "/template/compiled/");57 $this->setCompiledTemplatesDirectory(); 58 58 $this->clearCompiledTemplate(); 59 59 $this->lips_error_reporting = $smarty_reporting; … … 61 61 foreach ($variables as $key => $value) 62 62 $this->assign($key, $value); 63 } 64 65 66 /** 67 * Creates a temporary directory for the compiled templates. The 68 * directory is created in the systems' temp directory, and is 69 * produced using a static string and, optionally, a number. The 70 * directory is created when it doesn't already exist 71 * 72 */ 73 protected function setCompiledTemplatesDirectory() { 74 $i = 0; 75 $compile_dir_candidate = $compile_dir = sys_get_temp_dir() . '/wp_lips_compiled_tpl'; 76 $has_dir = false; 77 78 do { 79 // Here's where the trouble starts' 80 if (file_exists($compile_dir_candidate)) { 81 $has_dir = is_dir($compile_dir_candidate); 82 if (! $has_dir) { 83 $i++; 84 // Add the suffix and try again 85 $compile_dir_candidate = $compile_dir . '_' . $i; 86 } 87 } 88 else { 89 // Create directory recursively 90 @mkdir($compile_dir_candidate, 0755, true); 91 // This keeps the loop running when the process cannot write 92 // to the temporary directory 93 $has_dir = is_dir($compile_dir_candidate); 94 } 95 } while (! $has_dir); 96 97 // Set the compile directory to this newly created (or selected) directory 98 $this->setCompileDir($compile_dir_candidate); 63 99 } 64 100 … … 107 143 } 108 144 145 // Template caching and compiling should be disabled, so there's 146 // no need to save a compiled version 109 147 $this->clearCompiledTemplate(); 110 148
Note: See TracChangeset
for help on using the changeset viewer.