(bug 36776) Changing User::getNewtalk to use $wgDisableAnonTalk.
[lhc/web/wiklou.git] / includes / filerepo / backend / lockmanager / LockManagerGroup.php
index b830855..8c8c940 100644 (file)
 
 /**
  * Class to handle file lock manager registration
- * 
+ *
  * @ingroup LockManager
  * @author Aaron Schulz
  * @since 1.19
  */
 class LockManagerGroup {
-
        /**
         * @var LockManagerGroup
         */
@@ -61,7 +60,7 @@ class LockManagerGroup {
 
        /**
         * Register lock managers from the global variables
-        * 
+        *
         * @return void
         */
        protected function initFromGlobals() {
@@ -115,4 +114,30 @@ class LockManagerGroup {
                }
                return $this->managers[$name]['instance'];
        }
+
+       /**
+        * Get the default lock manager configured for the site.
+        * Returns NullLockManager if no lock manager could be found.
+        *
+        * @return LockManager
+        */
+       public function getDefault() {
+               return isset( $this->managers['default'] )
+                       ? $this->get( 'default' )
+                       : new NullLockManager( array() );
+       }
+
+       /**
+        * Get the default lock manager configured for the site
+        * or at least some other effective configured lock manager.
+        * Throws an exception if no lock manager could be found.
+        *
+        * @return LockManager
+        * @throws MWException
+        */
+       public function getAny() {
+               return isset( $this->managers['default'] )
+                       ? $this->get( 'default' )
+                       : $this->get( 'fsLockManager' );
+       }
 }