diff --git a/phpBB/includes/cron/cron_manager.php b/phpBB/includes/cron/cron_manager.php index 84b9c9783c..a99f1369de 100644 --- a/phpBB/includes/cron/cron_manager.php +++ b/phpBB/includes/cron/cron_manager.php @@ -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; diff --git a/phpBB/includes/cron/cron_task_base.php b/phpBB/includes/cron/cron_task_base.php index bdd96ec8f5..a75e27ac13 100644 --- a/phpBB/includes/cron/cron_task_base.php +++ b/phpBB/includes/cron/cron_task_base.php @@ -16,7 +16,10 @@ if (!defined('IN_PHPBB')) exit; } -include_once($phpbb_root_path . 'includes/cron/cron_task.' . $phpEx); +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 diff --git a/phpBB/includes/cron/cron_task_wrapper.php b/phpBB/includes/cron/cron_task_wrapper.php index 0e63000846..00b330464e 100644 --- a/phpBB/includes/cron/cron_task_wrapper.php +++ b/phpBB/includes/cron/cron_task_wrapper.php @@ -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. diff --git a/phpBB/includes/cron/tasks/core/prune_all_forums.php b/phpBB/includes/cron/tasks/core/prune_all_forums.php index 23d8a05d92..ebd09cbade 100644 --- a/phpBB/includes/cron/tasks/core/prune_all_forums.php +++ b/phpBB/includes/cron/tasks/core/prune_all_forums.php @@ -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. diff --git a/phpBB/includes/cron/tasks/core/prune_forum.php b/phpBB/includes/cron/tasks/core/prune_forum.php index 93023ce38d..bfc8beb2de 100644 --- a/phpBB/includes/cron/tasks/core/prune_forum.php +++ b/phpBB/includes/cron/tasks/core/prune_forum.php @@ -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']) { diff --git a/phpBB/includes/cron/tasks/core/queue.php b/phpBB/includes/cron/tasks/core/queue.php index 37a9d1aceb..5b6b69c269 100644 --- a/phpBB/includes/cron/tasks/core/queue.php +++ b/phpBB/includes/cron/tasks/core/queue.php @@ -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(); } diff --git a/phpBB/includes/cron/tasks/core/tidy_cache.php b/phpBB/includes/cron/tasks/core/tidy_cache.php index 5be27c3a42..72843ba680 100644 --- a/phpBB/includes/cron/tasks/core/tidy_cache.php +++ b/phpBB/includes/cron/tasks/core/tidy_cache.php @@ -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. diff --git a/phpBB/includes/cron/tasks/core/tidy_database.php b/phpBB/includes/cron/tasks/core/tidy_database.php index 715ab2250e..f2de216c3a 100644 --- a/phpBB/includes/cron/tasks/core/tidy_database.php +++ b/phpBB/includes/cron/tasks/core/tidy_database.php @@ -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(); } diff --git a/phpBB/includes/cron/tasks/core/tidy_search.php b/phpBB/includes/cron/tasks/core/tidy_search.php index 42120cdf17..42a46142b1 100644 --- a/phpBB/includes/cron/tasks/core/tidy_search.php +++ b/phpBB/includes/cron/tasks/core/tidy_search.php @@ -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; diff --git a/phpBB/includes/cron/tasks/core/tidy_sessions.php b/phpBB/includes/cron/tasks/core/tidy_sessions.php index cf02058c62..ecf0be3978 100644 --- a/phpBB/includes/cron/tasks/core/tidy_sessions.php +++ b/phpBB/includes/cron/tasks/core/tidy_sessions.php @@ -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. diff --git a/phpBB/includes/cron/tasks/core/tidy_warnings.php b/phpBB/includes/cron/tasks/core/tidy_warnings.php index 20a4bcbc60..4d70f3dc3d 100644 --- a/phpBB/includes/cron/tasks/core/tidy_warnings.php +++ b/phpBB/includes/cron/tasks/core/tidy_warnings.php @@ -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(); }