mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[feature/system-cron] Changed include_once to *_exists/include.
PHPBB3-9596
This commit is contained in:
parent
fe72fe9878
commit
ea3b98ab49
11 changed files with 70 additions and 16 deletions
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task_wrapper.' . $phpEx);
|
||||
if (!class_exists('cron_task_wrapper'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task_wrapper.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cron manager class.
|
||||
|
@ -100,8 +103,11 @@ class cron_manager
|
|||
list($mod, $filename) = $task_file;
|
||||
if ($this->is_valid_name($mod) && $this->is_valid_name($filename))
|
||||
{
|
||||
include_once($phpbb_root_path . "includes/cron/$mod/$filename.$phpEx");
|
||||
$class = "cron_task_${mod}_${filename}";
|
||||
if (!class_exists($class))
|
||||
{
|
||||
include($phpbb_root_path . "includes/cron/$mod/$filename.$phpEx");
|
||||
}
|
||||
$object = new $class;
|
||||
$wrapper = new cron_task_wrapper($object);
|
||||
$this->tasks[] = $wrapper;
|
||||
|
|
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
if (!class_exists('cron_task'))
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cron task base class. Provides sensible defaults for cron tasks
|
||||
|
|
|
@ -16,6 +16,12 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
// We use parametrized_cron_task in is_parametrized
|
||||
if (!interface_exists('cron_task'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cron task wrapper class.
|
||||
* Enhances cron tasks with convenience methods that work identically for all tasks.
|
||||
|
|
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
if (!class_exists('cron_task_base'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prune all forums cron task.
|
||||
|
|
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
if (!class_exists('cron_task_base'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prune one forum cron task.
|
||||
|
@ -60,7 +63,10 @@ class cron_task_core_prune_forum extends cron_task_base implements parametrized_
|
|||
public function run()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
if (!function_exists('auto_prune'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
}
|
||||
|
||||
if ($this->forum_data['prune_days'])
|
||||
{
|
||||
|
|
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
if (!class_exists('cron_task_base'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue cron task. Sends email and jabber messages queued by other scripts.
|
||||
|
@ -31,7 +34,10 @@ class cron_task_core_queue extends cron_task_base
|
|||
public function run()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
||||
if (!class_exists('queue'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
||||
}
|
||||
$queue = new queue();
|
||||
$queue->process();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
if (!class_exists('cron_task_base'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy cache cron task.
|
||||
|
|
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
if (!class_exists('cron_task_base'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy database cron task.
|
||||
|
@ -30,7 +33,10 @@ class cron_task_core_tidy_database extends cron_task_base
|
|||
*/
|
||||
public function run()
|
||||
{
|
||||
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
if (!function_exists('tidy_database'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
}
|
||||
tidy_database();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
if (!class_exists('cron_task_base'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy search cron task.
|
||||
|
@ -37,7 +40,10 @@ class cron_task_core_tidy_sessions extends cron_task_base
|
|||
// Select the search method
|
||||
$search_type = basename($config['search_type']);
|
||||
|
||||
include_once("{$phpbb_root_path}includes/search/$search_type.$phpEx");
|
||||
if (!class_exists($search_type))
|
||||
{
|
||||
include("{$phpbb_root_path}includes/search/$search_type.$phpEx");
|
||||
}
|
||||
|
||||
// We do some additional checks in the module to ensure it can actually be utilised
|
||||
$error = false;
|
||||
|
|
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
if (!class_exists('cron_task_base'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy sessions cron task.
|
||||
|
|
|
@ -16,7 +16,10 @@ if (!defined('IN_PHPBB'))
|
|||
exit;
|
||||
}
|
||||
|
||||
include_once($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
if (!class_exists('cron_task_base'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/cron/cron_task_base.' . $phpEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tidy warnings cron task.
|
||||
|
@ -33,7 +36,10 @@ class cron_task_core_tidy_warnings extends cron_task_base
|
|||
public function run()
|
||||
{
|
||||
global $phpbb_root_path, $phpEx;
|
||||
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
if (!function_exists('tidy_warnings'))
|
||||
{
|
||||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
}
|
||||
tidy_warnings();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue