mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/16314] Improve handling of page_footer output for controllers
Moved the common template output to controller helper and added garbage_collection handling to kernel_terminate_subscriber. PHPBB3-16314
This commit is contained in:
@@ -4403,8 +4403,7 @@ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \php
|
||||
*/
|
||||
function page_footer($run_cron = true, $display_template = true, $exit_handler = true)
|
||||
{
|
||||
global $db, $config, $template, $user, $auth, $cache, $phpEx;
|
||||
global $request, $phpbb_dispatcher, $phpbb_admin_path;
|
||||
global $phpbb_dispatcher, $phpbb_container, $template;
|
||||
|
||||
// A listener can set this variable to `true` when it overrides this function
|
||||
$page_footer_override = false;
|
||||
@@ -4426,55 +4425,10 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler =
|
||||
return;
|
||||
}
|
||||
|
||||
phpbb_check_and_display_sql_report($request, $auth, $db);
|
||||
/** @var \phpbb\controller\helper $controller_helper */
|
||||
$controller_helper = $phpbb_container->get('controller.helper');
|
||||
|
||||
$template->assign_vars(array(
|
||||
'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher),
|
||||
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
|
||||
'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited'),
|
||||
|
||||
'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id) : '')
|
||||
);
|
||||
|
||||
// Call cron-type script
|
||||
$call_cron = false;
|
||||
if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'] && !$cache->get('_cron.lock_check'))
|
||||
{
|
||||
$call_cron = true;
|
||||
$time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time();
|
||||
|
||||
// Any old lock present?
|
||||
if (!empty($config['cron_lock']))
|
||||
{
|
||||
$cron_time = explode(' ', $config['cron_lock']);
|
||||
|
||||
// If 1 hour lock is present we do not call cron.php
|
||||
if ($cron_time[0] + 3600 >= $time_now)
|
||||
{
|
||||
$call_cron = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call cron job?
|
||||
if ($call_cron)
|
||||
{
|
||||
global $phpbb_container;
|
||||
|
||||
/* @var $cron \phpbb\cron\manager */
|
||||
$cron = $phpbb_container->get('cron.manager');
|
||||
$task = $cron->find_one_ready_task();
|
||||
|
||||
if ($task)
|
||||
{
|
||||
$url = $task->get_url();
|
||||
$template->assign_var('RUN_CRON_TASK', '<img src="' . $url . '" width="1" height="1" alt="cron" />');
|
||||
}
|
||||
else
|
||||
{
|
||||
$cache->put('_cron.lock_check', true, 60);
|
||||
}
|
||||
}
|
||||
$controller_helper->display_footer($run_cron);
|
||||
|
||||
/**
|
||||
* Execute code and/or modify output before displaying the template.
|
||||
|
Reference in New Issue
Block a user