mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge branch 'ticket/bantu/10046' into develop-olympus
* ticket/bantu/10046: [ticket/10046] Do not link bots to cron.php. [ticket/10046] No longer change $phpbb_root_path to an absolute path for cron. [ticket/10046] Call flush() in cron.php [ticket/10046] Remove calls to register_shutdown_function() in cron.php
This commit is contained in:
commit
bc42cbd94b
3 changed files with 13 additions and 90 deletions
|
@ -118,11 +118,6 @@ else
|
||||||
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
|
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined('IN_CRON'))
|
|
||||||
{
|
|
||||||
$phpbb_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists($phpbb_root_path . 'config.' . $phpEx))
|
if (file_exists($phpbb_root_path . 'config.' . $phpEx))
|
||||||
{
|
{
|
||||||
require($phpbb_root_path . 'config.' . $phpEx);
|
require($phpbb_root_path . 'config.' . $phpEx);
|
||||||
|
|
|
@ -21,7 +21,6 @@ $user->session_begin(false);
|
||||||
$auth->acl($user->data);
|
$auth->acl($user->data);
|
||||||
|
|
||||||
$cron_type = request_var('cron_type', '');
|
$cron_type = request_var('cron_type', '');
|
||||||
$use_shutdown_function = (@function_exists('register_shutdown_function')) ? true : false;
|
|
||||||
|
|
||||||
// Output transparent gif
|
// Output transparent gif
|
||||||
header('Cache-Control: no-cache');
|
header('Cache-Control: no-cache');
|
||||||
|
@ -30,10 +29,9 @@ header('Content-length: 43');
|
||||||
|
|
||||||
echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
|
echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
|
||||||
|
|
||||||
// test without flush ;)
|
// Flush here to prevent browser from showing the page as loading while running cron.
|
||||||
// flush();
|
flush();
|
||||||
|
|
||||||
//
|
|
||||||
if (!isset($config['cron_lock']))
|
if (!isset($config['cron_lock']))
|
||||||
{
|
{
|
||||||
set_config('cron_lock', '0', true);
|
set_config('cron_lock', '0', true);
|
||||||
|
@ -79,23 +77,10 @@ switch ($cron_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A user reported using the mail() function while using shutdown does not work. We do not want to risk that.
|
|
||||||
if ($use_shutdown_function && !$config['smtp_delivery'])
|
|
||||||
{
|
|
||||||
$use_shutdown_function = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
||||||
$queue = new queue();
|
$queue = new queue();
|
||||||
|
|
||||||
if ($use_shutdown_function)
|
$queue->process();
|
||||||
{
|
|
||||||
register_shutdown_function(array(&$queue, 'process'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$queue->process();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -106,14 +91,7 @@ switch ($cron_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($use_shutdown_function)
|
$cache->tidy();
|
||||||
{
|
|
||||||
register_shutdown_function(array(&$cache, 'tidy'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$cache->tidy();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -138,14 +116,7 @@ switch ($cron_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($use_shutdown_function)
|
$search->tidy();
|
||||||
{
|
|
||||||
register_shutdown_function(array(&$search, 'tidy'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$search->tidy();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -158,14 +129,7 @@ switch ($cron_type)
|
||||||
|
|
||||||
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||||
|
|
||||||
if ($use_shutdown_function)
|
tidy_warnings();
|
||||||
{
|
|
||||||
register_shutdown_function('tidy_warnings');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tidy_warnings();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -178,14 +142,7 @@ switch ($cron_type)
|
||||||
|
|
||||||
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||||
|
|
||||||
if ($use_shutdown_function)
|
tidy_database();
|
||||||
{
|
|
||||||
register_shutdown_function('tidy_database');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tidy_database();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -196,14 +153,7 @@ switch ($cron_type)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($use_shutdown_function)
|
$user->session_gc();
|
||||||
{
|
|
||||||
register_shutdown_function(array(&$user, 'session_gc'));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$user->session_gc();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -230,26 +180,12 @@ switch ($cron_type)
|
||||||
|
|
||||||
if ($row['prune_days'])
|
if ($row['prune_days'])
|
||||||
{
|
{
|
||||||
if ($use_shutdown_function)
|
auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']);
|
||||||
{
|
|
||||||
register_shutdown_function('auto_prune', $row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto_prune($row['forum_id'], 'posted', $row['forum_flags'], $row['prune_days'], $row['prune_freq']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['prune_viewed'])
|
if ($row['prune_viewed'])
|
||||||
{
|
{
|
||||||
if ($use_shutdown_function)
|
auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
|
||||||
{
|
|
||||||
register_shutdown_function('auto_prune', $row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto_prune($row['forum_id'], 'viewed', $row['forum_flags'], $row['prune_viewed'], $row['prune_freq']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,16 +193,8 @@ switch ($cron_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unloading cache and closing db after having done the dirty work.
|
// Unloading cache and closing db after having done the dirty work.
|
||||||
if ($use_shutdown_function)
|
unlock_cron();
|
||||||
{
|
garbage_collection();
|
||||||
register_shutdown_function('unlock_cron');
|
|
||||||
register_shutdown_function('garbage_collection');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unlock_cron();
|
|
||||||
garbage_collection();
|
|
||||||
}
|
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|
|
@ -4611,7 +4611,7 @@ function page_footer($run_cron = true)
|
||||||
|
|
||||||
// Call cron-type script
|
// Call cron-type script
|
||||||
$call_cron = false;
|
$call_cron = false;
|
||||||
if (!defined('IN_CRON') && $run_cron && !$config['board_disable'])
|
if (!defined('IN_CRON') && $run_cron && !$config['board_disable'] && !$user->data['is_bot'])
|
||||||
{
|
{
|
||||||
$call_cron = true;
|
$call_cron = true;
|
||||||
$time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time();
|
$time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time();
|
||||||
|
|
Loading…
Add table
Reference in a new issue