1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00

[ticket/10103] Use flock lock class in messenger.

PHPBB3-10103
This commit is contained in:
Oleg Pudeyev 2012-12-04 02:00:27 -05:00
parent f08c28c77a
commit 4010f4085a

View File

@ -658,13 +658,14 @@ class queue
{ {
global $db, $config, $phpEx, $phpbb_root_path, $user; global $db, $config, $phpEx, $phpbb_root_path, $user;
$lock_fp = $this->lock(); $lock = new phpbb_lock_flock($this->cache_file);
$lock->acquire();
set_config('last_queue_run', time(), true); set_config('last_queue_run', time(), true);
if (!file_exists($this->cache_file) || filemtime($this->cache_file) > time() - $config['queue_interval']) if (!file_exists($this->cache_file) || filemtime($this->cache_file) > time() - $config['queue_interval'])
{ {
$this->unlock($lock_fp); $lock->release();
return; return;
} }
@ -731,7 +732,7 @@ class queue
break; break;
default: default:
$this->unlock($lock_fp); $lock->release();
return; return;
} }
@ -807,7 +808,7 @@ class queue
} }
} }
$this->unlock($lock_fp); $lock->release();
} }
/** /**
@ -820,7 +821,8 @@ class queue
return; return;
} }
$lock_fp = $this->lock(); $lock = new phpbb_lock_flock($this->cache_file);
$lock->acquire();
if (file_exists($this->cache_file)) if (file_exists($this->cache_file))
{ {
@ -847,7 +849,7 @@ class queue
phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE);
} }
$this->unlock($lock_fp); $lock->release();
} }
} }