https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106596

Revision: 106596
Author:   aaron
Date:     2011-12-18 20:19:41 +0000 (Sun, 18 Dec 2011)
Log Message:
-----------
* Removed canMove() from FSFileBackend, left from r106585.
* Made multiwrite doOperations() respect 'nonLocking'.
* Added/fixed more doc comments.
* Moved FileBackend::move() down a bit.

Modified Paths:
--------------
    branches/FileBackend/phase3/includes/filerepo/backend/FSFileBackend.php
    branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php
    
branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php
    branches/FileBackend/phase3/includes/filerepo/backend/FileOp.php
    
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/DBLockManager.php
    
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/FSLockManager.php
    
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LSLockManager.php
    
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LockManager.php
    
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php
    branches/FileBackend/phase3/includes/filerepo/file/File.php

Modified: 
branches/FileBackend/phase3/includes/filerepo/backend/FSFileBackend.php
===================================================================
--- branches/FileBackend/phase3/includes/filerepo/backend/FSFileBackend.php     
2011-12-18 20:18:45 UTC (rev 106595)
+++ branches/FileBackend/phase3/includes/filerepo/backend/FSFileBackend.php     
2011-12-18 20:19:41 UTC (rev 106596)
@@ -2,6 +2,7 @@
 /**
  * @file
  * @ingroup FileBackend
+ * @author Aaron Schulz
  */
 
 /**
@@ -126,10 +127,6 @@
                return $status;
        }
 
-       function canMove( array $params ) {
-               return true;
-       }
-
        function move( array $params ) {
                $status = Status::newGood();
 

Modified: branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php
===================================================================
--- branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php       
2011-12-18 20:18:45 UTC (rev 106595)
+++ branches/FileBackend/phase3/includes/filerepo/backend/FileBackend.php       
2011-12-18 20:19:41 UTC (rev 106596)
@@ -2,6 +2,7 @@
 /**
  * @file
  * @ingroup FileBackend
+ * @author Aaron Schulz
  */
 
 /**
@@ -21,6 +22,7 @@
  * As a corollary, external dependencies should be kept to a minimum.
  * 
  * @ingroup FileBackend
+ * @since 1.19
  */
 abstract class FileBackendBase {
        protected $name; // unique backend name
@@ -111,8 +113,7 @@
         *         'op'                  => 'concatenate',
         *         'srcs'                => <ordered array of storage paths>,
         *         'dst'                 => <storage path>,
-        *         'overwriteDest'       => <boolean>,
-        *         'overwriteSame'       => <boolean>
+        *         'overwriteDest'       => <boolean>
         *     )
         * g) Do nothing (no-op)
         *     array(
@@ -352,6 +353,7 @@
  * This class defines the methods as abstract that subclasses must implement.
  *
  * @ingroup FileBackend
+ * @since 1.19
  */
 abstract class FileBackend extends FileBackendBase {
        /**
@@ -381,6 +383,17 @@
        abstract public function copy( array $params );
 
        /**
+        * Delete a file at the storage path.
+        * Do not call this function from places outside FileBackend and FileOp.
+        * $params include:
+        *     src : source storage path
+        * 
+        * @param $params Array
+        * @return Status
+        */
+       abstract public function delete( array $params );
+
+       /**
         * Move a file from one storage path to another in the backend.
         * Do not call this function from places outside FileBackend and FileOp.
         * $params include:
@@ -403,17 +416,6 @@
        }
 
        /**
-        * Delete a file at the storage path.
-        * Do not call this function from places outside FileBackend and FileOp.
-        * $params include:
-        *     src : source storage path
-        * 
-        * @param $params Array
-        * @return Status
-        */
-       abstract public function delete( array $params );
-
-       /**
         * Combines files from several storage paths into a new file in the 
backend.
         * Do not call this function from places outside FileBackend and FileOp.
         * $params include:
@@ -548,7 +550,7 @@
                // Build up a list of FileOps...
                $performOps = $this->getOperations( $ops );
 
-               if ( !isset( $opts['nonLocking'] ) || !$opts['nonLocking'] ) {
+               if ( empty( $opts['nonLocking'] ) ) {
                        // Build up a list of files to lock...
                        $filesLockEx = $filesLockSh = array();
                        foreach ( $performOps as $index => $fileOp ) {

Modified: 
branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php
===================================================================
--- 
branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php 
    2011-12-18 20:18:45 UTC (rev 106595)
+++ 
branches/FileBackend/phase3/includes/filerepo/backend/FileBackendMultiWrite.php 
    2011-12-18 20:19:41 UTC (rev 106596)
@@ -2,6 +2,7 @@
 /**
  * @file
  * @ingroup FileBackend
+ * @author Aaron Schulz
  */
 
 /**
@@ -71,7 +72,7 @@
                foreach ( $this->fileBackends as $index => $backend ) {
                        $backendOps = $this->substOpPaths( $ops, $backend );
                        $performOps = array_merge( $performOps, 
$backend->getOperations( $backendOps ) );
-                       if ( $index == 0 ) {
+                       if ( $index == 0 && empty( $opts['nonLocking'] ) ) {
                                // Set "files to lock" from the first batch so 
we don't try to set all
                                // locks two or three times over (depending on 
the number of backends).
                                // A lock on one storage path is a lock on all 
the backends.

Modified: branches/FileBackend/phase3/includes/filerepo/backend/FileOp.php
===================================================================
--- branches/FileBackend/phase3/includes/filerepo/backend/FileOp.php    
2011-12-18 20:18:45 UTC (rev 106595)
+++ branches/FileBackend/phase3/includes/filerepo/backend/FileOp.php    
2011-12-18 20:19:41 UTC (rev 106596)
@@ -2,6 +2,7 @@
 /**
  * @file
  * @ingroup FileBackend
+ * @author Aaron Schulz
  */
 
 /**
@@ -12,6 +13,7 @@
  * potentially many FileOp classes in large arrays in memory.
  * 
  * @ingroup FileBackend
+ * @since 1.19
  */
 abstract class FileOp {
        /** $var Array */

Modified: 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/DBLockManager.php
===================================================================
--- 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/DBLockManager.php
 2011-12-18 20:18:45 UTC (rev 106595)
+++ 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/DBLockManager.php
 2011-12-18 20:19:41 UTC (rev 106596)
@@ -12,6 +12,8 @@
  * A majority of peer DBs must agree for a lock to be acquired.
  *
  * Caching is used to avoid hitting servers that are down.
+ *
+ * @ingroup LockManager
  */
 class DBLockManager extends LockManager {
        /** @var Array Map of DB names to server config */
@@ -374,6 +376,8 @@
 /**
  * MySQL version of DBLockManager that supports shared locks.
  * All locks are non-blocking, which avoids deadlocks.
+ *
+ * @ingroup LockManager
  */
 class MySqlLockManager extends DBLockManager {
        /** @var Array Mapping of lock types to the type actually used */

Modified: 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/FSLockManager.php
===================================================================
--- 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/FSLockManager.php
 2011-12-18 20:18:45 UTC (rev 106595)
+++ 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/FSLockManager.php
 2011-12-18 20:19:41 UTC (rev 106596)
@@ -8,6 +8,8 @@
  * Do not use this with 'lockDir' set to an NFS mount unless the
  * NFS client is at least version 2.6.12. Otherwise, the BSD flock()
  * locks will be ignored; see http://nfs.sourceforge.net/#section_d.
+ *
+ * @ingroup LockManager
  */
 class FSLockManager extends LockManager {
        /** @var Array Mapping of lock types to the type actually used */

Modified: 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LSLockManager.php
===================================================================
--- 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LSLockManager.php
 2011-12-18 20:18:45 UTC (rev 106595)
+++ 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LSLockManager.php
 2011-12-18 20:19:41 UTC (rev 106596)
@@ -9,6 +9,8 @@
  * to one bucket. Each bucket maps to one or several peer servers, each
  * running LockServerDaemon.php, listening on a designated TCP port.
  * A majority of peers must agree for a lock to be acquired.
+ *
+ * @ingroup LockManager
  */
 class LSLockManager extends LockManager {
        /** @var Array Mapping of lock types to the type actually used */

Modified: 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LockManager.php
===================================================================
--- 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LockManager.php
   2011-12-18 20:18:45 UTC (rev 106595)
+++ 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LockManager.php
   2011-12-18 20:19:41 UTC (rev 106596)
@@ -1,5 +1,11 @@
 <?php
 /**
+ * @file
+ * @ingroup LockManager
+ * @author Aaron Schulz
+ */
+
+/**
  * Class for handling resource locking.
  * Locks on resource keys can either be shared or exclusive.
  * 
@@ -9,8 +15,9 @@
  * Locks should either be non-blocking or have low wait timeouts.
  * 
  * Subclasses should avoid throwing exceptions at all costs.
- * 
- * @ingroup FileBackend
+ *
+ * @ingroup LockManager
+ * @since 1.19
  */
 abstract class LockManager {
        /* Lock types; stronger locks have higher values */
@@ -78,6 +85,9 @@
 /**
  * LockManager helper class to handle scoped locks, which
  * release when an object is destroyed or goes out of scope.
+ *
+ * @ingroup LockManager
+ * @since 1.19
  */
 class ScopedLock {
        /** @var LockManager */

Modified: 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php
===================================================================
--- 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php
      2011-12-18 20:18:45 UTC (rev 106595)
+++ 
branches/FileBackend/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php
      2011-12-18 20:19:41 UTC (rev 106596)
@@ -2,7 +2,7 @@
 /**
  * Class to handle file lock manager registration
  * 
- * @ingroup FileBackend
+ * @ingroup LockManager
  */
 class LockManagerGroup {
        protected static $instance = null;
@@ -57,7 +57,7 @@
                if ( !isset( $this->managers[$name] ) ) {
                        throw new MWException( "No lock manager defined with 
the name `$name`." );
                }
-               // Lazy-load the actual backend instance
+               // Lazy-load the actual lock manager instance
                if ( !isset( $this->managers[$name]['instance'] ) ) {
                        $class = $this->managers[$name]['class'];
                        $config = $this->managers[$name]['config'];

Modified: branches/FileBackend/phase3/includes/filerepo/file/File.php
===================================================================
--- branches/FileBackend/phase3/includes/filerepo/file/File.php 2011-12-18 
20:18:45 UTC (rev 106595)
+++ branches/FileBackend/phase3/includes/filerepo/file/File.php 2011-12-18 
20:19:41 UTC (rev 106596)
@@ -1150,7 +1150,7 @@
         */
        function getThumbUrl( $suffix = false ) {
                $this->assertRepoDefined();
-               $path = $this->repo->getZoneUrl('thumb') . '/' . 
$this->getUrlRel();
+               $path = $this->repo->getZoneUrl( 'thumb' ) . '/' . 
$this->getUrlRel();
                if ( $suffix !== false ) {
                        $path .= '/' . rawurlencode( $suffix );
                }


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to