1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-03 15:27:42 +02:00

[feature/system-cron] Abstract the database locking mechanism out of cron.

Added a number of tests for the locking mechanism which can now lock
arbitrary config variables.

PHPBB3-9596
This commit is contained in:
Nils Adermann
2011-01-07 20:58:28 +01:00
committed by Oleg Pudeyev
parent 6e5e4721d8
commit 3a3a8bb96d
5 changed files with 243 additions and 109 deletions

View File

@@ -33,9 +33,9 @@ function output_image()
// flush();
}
function do_cron($run_tasks)
function do_cron($cron_lock, $run_tasks)
{
global $cron_lock, $config;
global $config;
foreach ($run_tasks as $task)
{
@@ -73,7 +73,7 @@ else
output_image();
}
$cron_lock = new phpbb_cron_lock();
$cron_lock = new phpbb_lock_db('cron_lock', $config, $db);
if ($cron_lock->lock())
{
if ($config['use_system_cron'])
@@ -103,11 +103,11 @@ if ($cron_lock->lock())
}
if ($use_shutdown_function)
{
register_shutdown_function('do_cron', $run_tasks);
register_shutdown_function('do_cron', $cron_lock, $run_tasks);
}
else
{
do_cron($run_tasks);
do_cron($cron_lock, $run_tasks);
}
}
else