Issue 102: Potential race condition when compiling templates
This commit is contained in:
parent
90ce6fda4c
commit
1c563f340b
@ -144,9 +144,11 @@ public static function render($c) {$t = $c; ?>'.$this->template_content.'<?php }
|
|||||||
rewind($fp);
|
rewind($fp);
|
||||||
fwrite($fp, $this->template_content, strlen($this->template_content));
|
fwrite($fp, $this->template_content, strlen($this->template_content));
|
||||||
// Lock released, read access is possible
|
// Lock released, read access is possible
|
||||||
flock($fp, LOCK_UN);
|
flock($fp, LOCK_UN);
|
||||||
|
fflush($fp);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
@chmod($this->compiled_template, 0777);
|
@chmod($this->compiled_template, 0777);
|
||||||
|
clearstatcache();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(sprintf(__('Cannot write the compiled template: %s'), $this->compiled_template));
|
throw new Exception(sprintf(__('Cannot write the compiled template: %s'), $this->compiled_template));
|
||||||
|
Loading…
Reference in New Issue
Block a user