diff --git a/lib/behat/classes/util.php b/lib/behat/classes/util.php index 8237f6013ce..1b15f106ab8 100644 --- a/lib/behat/classes/util.php +++ b/lib/behat/classes/util.php @@ -435,6 +435,9 @@ class behat_util extends testing_util { // Inform data generator. self::get_data_generator()->reset(); + // Reset the task manager. + \core\task\manager::reset_state(); + // Initialise $CFG with default values. This is needed for behat cli process, so we don't have modified // $CFG values from the old run. @see set_config. self::remove_added_config(); diff --git a/lib/classes/task/manager.php b/lib/classes/task/manager.php index 4b56f81438f..d839eedac75 100644 --- a/lib/classes/task/manager.php +++ b/lib/classes/task/manager.php @@ -63,17 +63,26 @@ class manager { /** * @var array A cached queue of adhoc tasks */ - public static $miniqueue; + protected static array $miniqueue = []; /** * @var int The last recorded number of unique adhoc tasks. */ - public static $numtasks; + protected static int $numtasks = 0; /** - * @var string Used to determine if the adhoc task queue is distributing or filling capacity. + * @var null|int Used to determine if the adhoc task queue is distributing or filling capacity. */ - public static $mode; + protected static ?int $mode = null; + + /** + * Reset the state of the task manager. + */ + public static function reset_state(): void { + self::$miniqueue = []; + self::$numtasks = 0; + self::$mode = null; + } /** * Given a component name, will load the list of tasks in the db/tasks.php file for that component. diff --git a/lib/upgrade.txt b/lib/upgrade.txt index c3d5fccdd1d..abbbf7d2aec 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -57,6 +57,10 @@ information provided here is intended especially for developers. is applied. * The Horde library has been removed from core. It was only used by the tool_messageinbound. Now tool_messageinbound uses the new RoundCube library. +* Visibility of internal properties of the \core\task\manager have been changed from public to protected. These should not have been accessible. + - $miniqueue + - $numtasks + - $mode === 4.3 ===