Update formatting of externalstore classes
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Fri, 22 Nov 2013 20:28:20 +0000 (21:28 +0100)
committerHashar <hashar@free.fr>
Tue, 26 Nov 2013 13:16:02 +0000 (13:16 +0000)
Change-Id: Ie31c370ba497eedc7458973b704132cf4725cf1f

includes/externalstore/ExternalStore.php
includes/externalstore/ExternalStoreDB.php
includes/externalstore/ExternalStoreMedium.php
includes/externalstore/ExternalStoreMwstore.php

index 462b0b9..9e9d976 100644 (file)
@@ -59,6 +59,7 @@ class ExternalStore {
                }
 
                $class = 'ExternalStore' . ucfirst( $proto );
+
                // Any custom modules should be added to $wgAutoLoadClasses for on-demand loading
                return class_exists( $class ) ? new $class( $params ) : false;
        }
@@ -120,6 +121,7 @@ class ExternalStore {
                                $retval[$url] = false;
                        }
                }
+
                return $retval;
        }
 
index 46a8937..8c2147a 100644 (file)
@@ -42,6 +42,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                if ( $itemID !== false && $ret !== false ) {
                        return $ret->getItem( $itemID );
                }
+
                return $ret;
        }
 
@@ -66,6 +67,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                $ret = array();
                foreach ( $batched as $cluster => $batchByCluster ) {
                        $res = $this->batchFetchBlobs( $cluster, $batchByCluster );
+                       /** @var HistoryBlob $blob */
                        foreach ( $res as $id => $blob ) {
                                foreach ( $batchByCluster[$id] as $itemID ) {
                                        $url = $inverseUrlMap[$cluster][$id][$itemID];
@@ -77,6 +79,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                                }
                        }
                }
+
                return $ret;
        }
 
@@ -96,6 +99,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                if ( $dbw->getFlag( DBO_TRX ) ) {
                        $dbw->commit( __METHOD__ );
                }
+
                return "DB://$cluster/$id";
        }
 
@@ -142,6 +146,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
        function &getMaster( $cluster ) {
                $wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false;
                $lb =& $this->getLoadBalancer( $cluster );
+
                return $lb->getConnection( DB_MASTER, array(), $wiki );
        }
 
@@ -156,6 +161,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                if ( is_null( $table ) ) {
                        $table = 'blobs';
                }
+
                return $table;
        }
 
@@ -182,6 +188,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                if ( isset( $externalBlobCache[$cacheID] ) ) {
                        wfDebugLog( 'ExternalStoreDB-cache',
                                "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
+
                        return $externalBlobCache[$cacheID];
                }
 
@@ -209,6 +216,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                }
 
                $externalBlobCache = array( $cacheID => &$ret );
+
                return $ret;
        }
 
@@ -217,7 +225,8 @@ class ExternalStoreDB extends ExternalStoreMedium {
         *
         * @param string $cluster A cluster name valid for use with LBFactory
         * @param array $ids A map from the blob_id's to look for to the requested itemIDs in the blobs
-        * @return array A map from the blob_id's requested to their content.  Unlocated ids are not represented
+        * @return array A map from the blob_id's requested to their content.
+        *   Unlocated ids are not represented
         */
        function batchFetchBlobs( $cluster, array $ids ) {
                $dbr = $this->getSlave( $cluster );
@@ -248,6 +257,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
                                " master on '$cluster' failed locating items: " .
                                implode( ',', array_keys( $ids ) ) . "\n" );
                }
+
                return $ret;
        }
 
@@ -274,6 +284,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
 
        protected function parseURL( $url ) {
                $path = explode( '/', $url );
+
                return array(
                        $path[2], // cluster
                        $path[3], // id
index 6ab1f8c..a526df6 100644 (file)
@@ -64,6 +64,7 @@ abstract class ExternalStoreMedium {
                                $retval[$url] = $data;
                        }
                }
+
                return $retval;
        }
 
index 1721007..f329b73 100644 (file)
@@ -43,6 +43,7 @@ class ExternalStoreMwstore extends ExternalStoreMedium {
                        // backends should at least have "read-after-create" consistency.
                        return $be->getFileContents( array( 'src' => $url ) );
                }
+
                return false;
        }
 
@@ -66,6 +67,7 @@ class ExternalStoreMwstore extends ExternalStoreMedium {
                        $be = FileBackendGroup::singleton()->get( $backendName );
                        $blobs = $blobs + $be->getFileContentsMulti( array( 'srcs' => $paths ) );
                }
+
                return $blobs;
        }
 
@@ -90,6 +92,7 @@ class ExternalStoreMwstore extends ExternalStoreMedium {
                                return $url;
                        }
                }
+
                return false;
        }
 }