aboutsummaryrefslogtreecommitdiffstats
path: root/includes/filebackend/lockmanager
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2013-03-05 11:03:20 -0800
committerAaron Schulz <aschulz@wikimedia.org>2013-03-05 13:33:51 -0800
commit98dc0349b25714b75dc631b1e63724e926bae7d2 (patch)
tree4f12ef88eef20f45dc9df9047c804e4edaa50c4b /includes/filebackend/lockmanager
parent636d0de4b8ca0747b50e99de6e24e5f1038cf8c6 (diff)
downloadmediawikicore-98dc0349b25714b75dc631b1e63724e926bae7d2.tar.gz
mediawikicore-98dc0349b25714b75dc631b1e63724e926bae7d2.zip
[LockManager] Added ScopedLock::release function.
* Added more lock unit tests. Change-Id: Ic359307cf26cfb621ae8d2db867801735a375dde
Diffstat (limited to 'includes/filebackend/lockmanager')
-rw-r--r--includes/filebackend/lockmanager/ScopedLock.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/includes/filebackend/lockmanager/ScopedLock.php b/includes/filebackend/lockmanager/ScopedLock.php
index 5a80bee8b329..790a5c64a729 100644
--- a/includes/filebackend/lockmanager/ScopedLock.php
+++ b/includes/filebackend/lockmanager/ScopedLock.php
@@ -78,6 +78,19 @@ class ScopedLock {
return null;
}
+ /**
+ * Release a scoped lock and set any errors in the attatched Status object.
+ * This is useful for early release of locks before function scope is destroyed.
+ * This is the same as setting the lock object to null.
+ *
+ * @param ScopedLock $lock
+ * @return void
+ * @since 1.21
+ */
+ public static function release( ScopedLock &$lock = null ) {
+ $lock = null;
+ }
+
function __destruct() {
$wasOk = $this->status->isOK();
$this->status->merge( $this->manager->unlock( $this->paths, $this->type ) );