From 4b71cdcd89a39c530290d2788c396d9ee603e033 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Wed, 1 Apr 2020 16:03:40 +0800 Subject: [PATCH] MDL-67594 core_lock: Deprecate supports_recursion() --- cache/upgrade.txt | 3 +++ lib/classes/lock/db_record_lock_factory.php | 4 ++++ lib/classes/lock/file_lock_factory.php | 4 ++++ lib/classes/lock/installation_lock_factory.php | 3 +++ lib/classes/lock/lock_factory.php | 1 + lib/classes/lock/mysql_lock_factory.php | 3 +++ lib/classes/lock/postgres_lock_factory.php | 4 ++++ 7 files changed, 22 insertions(+) diff --git a/cache/upgrade.txt b/cache/upgrade.txt index 076bd5312de..768f66716ac 100644 --- a/cache/upgrade.txt +++ b/cache/upgrade.txt @@ -1,6 +1,9 @@ This files describes API changes in /cache/stores/* - cache store plugins. Information provided here is intended especially for developers. +=== 4.0 === +* The function supports_recursion() from the lock_factory interface has been deprecated including the related implementations. + === 3.9 === * The record_cache_hit/miss/set methods now take a cache_store instead of a cache_definition object diff --git a/lib/classes/lock/db_record_lock_factory.php b/lib/classes/lock/db_record_lock_factory.php index e430bc56294..11ec1a187a2 100644 --- a/lib/classes/lock/db_record_lock_factory.php +++ b/lib/classes/lock/db_record_lock_factory.php @@ -91,9 +91,13 @@ class db_record_lock_factory implements lock_factory { /** * Multiple locks for the same resource can be held by a single process. + * + * @deprecated since Moodle 4.0. * @return boolean - False - not process specific. */ public function supports_recursion() { + debugging('The function supports_recursion() is deprecated, please do not use it anymore.', + DEBUG_DEVELOPER); return false; } diff --git a/lib/classes/lock/file_lock_factory.php b/lib/classes/lock/file_lock_factory.php index dd20e9bc014..d719cd9112c 100644 --- a/lib/classes/lock/file_lock_factory.php +++ b/lib/classes/lock/file_lock_factory.php @@ -108,9 +108,13 @@ class file_lock_factory implements lock_factory { /** * Multiple locks for the same resource cannot be held from a single process. + * + * @deprecated since Moodle 4.0. * @return boolean - False */ public function supports_recursion() { + debugging('The function supports_recursion() is deprecated, please do not use it anymore.', + DEBUG_DEVELOPER); return false; } diff --git a/lib/classes/lock/installation_lock_factory.php b/lib/classes/lock/installation_lock_factory.php index 5200cab858a..36ebdd951d1 100644 --- a/lib/classes/lock/installation_lock_factory.php +++ b/lib/classes/lock/installation_lock_factory.php @@ -76,9 +76,12 @@ class installation_lock_factory implements lock_factory { /** * Multiple locks for the same resource cannot be held from a single process. * + * @deprecated since Moodle 4.0. * @return boolean - False */ public function supports_recursion() { + debugging('The function supports_recursion() is deprecated, please do not use it anymore.', + DEBUG_DEVELOPER); return false; } diff --git a/lib/classes/lock/lock_factory.php b/lib/classes/lock/lock_factory.php index b03e774c3d0..9d3303e0e2a 100644 --- a/lib/classes/lock/lock_factory.php +++ b/lib/classes/lock/lock_factory.php @@ -63,6 +63,7 @@ interface lock_factory { /** * Supports recursion. * + * @deprecated since Moodle 4.0. * @return boolean - True if attempting to get 2 locks on the same resource will "stack" */ public function supports_recursion(); diff --git a/lib/classes/lock/mysql_lock_factory.php b/lib/classes/lock/mysql_lock_factory.php index 6f059243cee..5efb2927732 100644 --- a/lib/classes/lock/mysql_lock_factory.php +++ b/lib/classes/lock/mysql_lock_factory.php @@ -106,9 +106,12 @@ class mysql_lock_factory implements lock_factory { * Hard coded to false and workaround inconsistent support in different * versions of MySQL / MariaDB. * + * @deprecated since Moodle 4.0. * @return boolean - false */ public function supports_recursion() { + debugging('The function supports_recursion() is deprecated, please do not use it anymore.', + DEBUG_DEVELOPER); return false; } diff --git a/lib/classes/lock/postgres_lock_factory.php b/lib/classes/lock/postgres_lock_factory.php index 0d48eaafd7b..c100acb934c 100644 --- a/lib/classes/lock/postgres_lock_factory.php +++ b/lib/classes/lock/postgres_lock_factory.php @@ -119,9 +119,13 @@ class postgres_lock_factory implements lock_factory { /** * Multiple locks for the same resource can be held by a single process. + * + * @deprecated since Moodle 4.0. * @return boolean - Defer to the DB driver. */ public function supports_recursion() { + debugging('The function supports_recursion() is deprecated, please do not use it anymore.', + DEBUG_DEVELOPER); return true; }