aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template/compile.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-12-20 22:51:38 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-12-20 22:51:38 +0100
commite34b8ed094affdaedbf457406c98b29c125e5d8b (patch)
tree7cc51ba4ead71cb48a76747770edf622f8fe85f9 /phpBB/includes/template/compile.php
parent70a409d4b5411bf9e50a70d1cf3855b686304bbe (diff)
parentd11829567603e6ac37170b919efc4659b2be20cb (diff)
downloadforums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar.gz
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar.bz2
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.tar.xz
forums-e34b8ed094affdaedbf457406c98b29c125e5d8b.zip
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/softdelete-1-permission-rebase
* 'develop' of https://github.com/phpbb/phpbb3: (544 commits) [feature/events] Fix improperly named event in documentation [feature/events] Fix alphabetization of events [feature/events] Put events in alphabetical order [feature/events] Make EVENTS.md lowercase [ticket/11285] Use more granularity in dependency checks in compress test [ticket/10880] The m_approve permisson no longer implies f_noapprove. [ticket/10803] Show failure message until user dismisses it [ticket/10954] Add missing semi-colon [ticket/10954] Make sure to mark subforums unread and add small fixes [feature/events] Use ` to escape HTML tags in markdown [feature/events] Remove HTML tags from markdown so they don't get parsed [ticket/10954] Miscellaneous coding fixes [feature/events] Remove extraneous space [feature/events] Add markdown template event documentation file [feature/events] forumlist_body_last_post_title_after -> _prepend (subsilver2) [feature/events] Fix overall_footer_end -> overall_footer_after (subsilver2) [feature/events] Fix typo in event name [ticket/10763] Use self when calling get_extension() in filespec class [feature/events] Fix more subsilver2 events [feature/events] Fix some subsilver2 events ... Conflicts: phpBB/install/database_update.php phpBB/posting.php
Diffstat (limited to 'phpBB/includes/template/compile.php')
-rw-r--r--phpBB/includes/template/compile.php23
1 files changed, 16 insertions, 7 deletions
diff --git a/phpBB/includes/template/compile.php b/phpBB/includes/template/compile.php
index 82b301c1a2..fcdaf7abda 100644
--- a/phpBB/includes/template/compile.php
+++ b/phpBB/includes/template/compile.php
@@ -35,16 +35,23 @@ class phpbb_template_compile
/**
* Constructor.
*
- * @param bool @allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
+ * @param bool $allow_php Whether PHP code will be allowed in templates (inline PHP code, PHP tag and INCLUDEPHP tag)
+ * @param array $style_names Name of style to which the template being compiled belongs and parents in style tree order
* @param phpbb_style_resource_locator $locator Resource locator
* @param string $phpbb_root_path Path to phpBB root directory
+ * @param phpbb_extension_manager $extension_manager Extension manager to use for finding template fragments in extensions; if null, template events will not be invoked
+ * @param phpbb_user $user Current user
*/
- public function __construct($allow_php, $locator, $phpbb_root_path)
+ public function __construct($allow_php, $style_names, $locator, $phpbb_root_path, $extension_manager = null, $user = null)
{
$this->filter_params = array(
'allow_php' => $allow_php,
+ 'style_names' => $style_names,
'locator' => $locator,
- 'phpbb_root_path' => $phpbb_root_path
+ 'phpbb_root_path' => $phpbb_root_path,
+ 'extension_manager' => $extension_manager,
+ 'user' => $user,
+ 'template_compile' => $this,
);
}
@@ -58,6 +65,9 @@ class phpbb_template_compile
*/
public function compile_file_to_file($source_file, $compiled_file)
{
+ $lock = new phpbb_lock_flock($compiled_file);
+ $lock->acquire();
+
$source_handle = @fopen($source_file, 'rb');
$destination_handle = @fopen($compiled_file, 'wb');
@@ -66,16 +76,15 @@ class phpbb_template_compile
return false;
}
- @flock($destination_handle, LOCK_EX);
-
$this->compile_stream_to_stream($source_handle, $destination_handle);
@fclose($source_handle);
- @flock($destination_handle, LOCK_UN);
@fclose($destination_handle);
phpbb_chmod($compiled_file, CHMOD_READ | CHMOD_WRITE);
+ $lock->release();
+
clearstatcache();
return true;
@@ -118,7 +127,7 @@ class phpbb_template_compile
*
* @param resource $source_stream Source stream
* @param resource $dest_stream Destination stream
- * @return void
+ * @return null
*/
private function compile_stream_to_stream($source_stream, $dest_stream)
{