aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_messenger.php
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2010-09-09 20:05:11 +0100
committerChris Smith <toonarmy@phpbb.com>2010-10-27 11:31:42 +0100
commit981970024701bd1e740056c595c959afd5a85ba0 (patch)
treec4349d4b0a62094ed77c5332d6cbfc2f57d2b607 /phpBB/includes/functions_messenger.php
parent01ef46a510c067d7699a3495ca533aee5f112ae4 (diff)
downloadforums-981970024701bd1e740056c595c959afd5a85ba0.tar
forums-981970024701bd1e740056c595c959afd5a85ba0.tar.gz
forums-981970024701bd1e740056c595c959afd5a85ba0.tar.bz2
forums-981970024701bd1e740056c595c959afd5a85ba0.tar.xz
forums-981970024701bd1e740056c595c959afd5a85ba0.zip
[ticket/9061] Simplify conditional statements by reworking the logic.
PHPBB3-9061
Diffstat (limited to 'phpBB/includes/functions_messenger.php')
-rw-r--r--phpBB/includes/functions_messenger.php30
1 files changed, 18 insertions, 12 deletions
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index f22a77cf3c..227df95ac5 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -647,25 +647,31 @@ class queue
{
$mode = 'wb';
}
+
$lock_fp = @fopen($this->cache_file . '.lock', $mode);
- // Two processes may attempt to create lock file at the same time.
- // Have the losing process try opening the lock file again for reading
- // on the assumption that the winning process created it
- if (!$lock_fp && $mode == 'wb')
- {
- // Assign to $mode for the check in chmod below
- $mode = 'rb';
- $lock_fp = @fopen($this->cache_file . '.lock', $mode);
- }
- if ($lock_fp && $mode == 'wb')
+
+ if ($mode == 'wb')
{
- // Only need to set mode when the lock file is written
- @chmod($this->cache_file . '.lock', 0666);
+ if (!$lock_fp)
+ {
+ // Two processes may attempt to create lock file at the same time.
+ // Have the losing process try opening the lock file again for reading
+ // on the assumption that the winning process created it
+ $mode = 'rb';
+ $lock_fp = @fopen($this->cache_file . '.lock', $mode);
+ }
+ else
+ {
+ // Only need to set mode when the lock file is written
+ @chmod($this->cache_file . '.lock', 0666);
+ }
}
+
if ($lock_fp)
{
@flock($lock_fp, LOCK_EX);
}
+
return $lock_fp;
}