Merge "Revert "Adding sanity check to Title::isRedirect().""
[lhc/web/wiklou.git] / includes / filerepo / backend / lockmanager / LockManager.php
index bb3260e..e41c777 100644 (file)
@@ -1,19 +1,42 @@
 <?php
 /**
+ * @defgroup LockManager Lock management
+ * @ingroup FileBackend
+ */
+
+/**
+ * Resource locking handling.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @file
  * @ingroup LockManager
  * @author Aaron Schulz
  */
 
 /**
- * Class for handling resource locking.
+ * @brief Class for handling resource locking.
+ *
  * Locks on resource keys can either be shared or exclusive.
- * 
+ *
  * Implementations must keep track of what is locked by this proccess
  * in-memory and support nested locking calls (using reference counting).
  * At least LOCK_UW and LOCK_EX must be implemented. LOCK_SH can be a no-op.
  * Locks should either be non-blocking or have low wait timeouts.
- * 
+ *
  * Subclasses should avoid throwing exceptions at all costs.
  *
  * @ingroup LockManager
@@ -50,7 +73,10 @@ abstract class LockManager {
         * @return Status 
         */
        final public function lock( array $paths, $type = self::LOCK_EX ) {
-               return $this->doLock( array_unique( $paths ), $this->lockTypeMap[$type] );
+               wfProfileIn( __METHOD__ );
+               $status = $this->doLock( array_unique( $paths ), $this->lockTypeMap[$type] );
+               wfProfileOut( __METHOD__ );
+               return $status;
        }
 
        /**
@@ -61,7 +87,10 @@ abstract class LockManager {
         * @return Status 
         */
        final public function unlock( array $paths, $type = self::LOCK_EX ) {
-               return $this->doUnlock( array_unique( $paths ), $this->lockTypeMap[$type] );
+               wfProfileIn( __METHOD__ );
+               $status = $this->doUnlock( array_unique( $paths ), $this->lockTypeMap[$type] );
+               wfProfileOut( __METHOD__ );
+               return $status;
        }
 
        /**
@@ -94,6 +123,8 @@ abstract class LockManager {
 }
 
 /**
+ * Self releasing locks
+ *
  * LockManager helper class to handle scoped locks, which
  * release when an object is destroyed or goes out of scope.
  *
@@ -125,8 +156,6 @@ class ScopedLock {
                $this->type = $type;
        }
 
-       protected function __clone() {}
-
        /**
         * Get a ScopedLock object representing a lock on resource paths.
         * Any locks are released once this object goes out of scope.
@@ -164,10 +193,22 @@ class ScopedLock {
  * @since 1.19
  */
 class NullLockManager extends LockManager {
+       /**
+        * @see LockManager::doLock()
+        * @param $paths array
+        * @param $type int
+        * @return Status
+        */
        protected function doLock( array $paths, $type ) {
                return Status::newGood();
        }
 
+       /**
+        * @see LockManager::doUnlock()
+        * @param $paths array
+        * @param $type int
+        * @return Status
+        */
        protected function doUnlock( array $paths, $type ) {
                return Status::newGood();
        }