Merge "Revert "Make line breaks in <blockquote> behave like <div> (bug 6200)." See...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 13 Aug 2013 18:07:30 +0000 (18:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 13 Aug 2013 18:07:30 +0000 (18:07 +0000)
includes/externalstore/ExternalStoreDB.php
includes/externalstore/ExternalStoreMwstore.php
maintenance/runJobs.php

index 8042430..46a8937 100644 (file)
@@ -180,21 +180,27 @@ class ExternalStoreDB extends ExternalStoreMedium {
 
                $cacheID = ( $itemID === false ) ? "$cluster/$id" : "$cluster/$id/";
                if ( isset( $externalBlobCache[$cacheID] ) ) {
-                       wfDebugLog( 'ExternalStoreDB-cache', "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
+                       wfDebugLog( 'ExternalStoreDB-cache',
+                               "ExternalStoreDB::fetchBlob cache hit on $cacheID\n" );
                        return $externalBlobCache[$cacheID];
                }
 
-               wfDebugLog( 'ExternalStoreDB-cache', "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" );
+               wfDebugLog( 'ExternalStoreDB-cache',
+                       "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" );
 
                $dbr =& $this->getSlave( $cluster );
-               $ret = $dbr->selectField( $this->getTable( $dbr ), 'blob_text', array( 'blob_id' => $id ), __METHOD__ );
+               $ret = $dbr->selectField( $this->getTable( $dbr ),
+                       'blob_text', array( 'blob_id' => $id ), __METHOD__ );
                if ( $ret === false ) {
-                       wfDebugLog( 'ExternalStoreDB', "ExternalStoreDB::fetchBlob master fallback on $cacheID\n" );
+                       wfDebugLog( 'ExternalStoreDB',
+                               "ExternalStoreDB::fetchBlob master fallback on $cacheID\n" );
                        // Try the master
                        $dbw =& $this->getMaster( $cluster );
-                       $ret = $dbw->selectField( $this->getTable( $dbw ), 'blob_text', array( 'blob_id' => $id ), __METHOD__ );
+                       $ret = $dbw->selectField( $this->getTable( $dbw ),
+                               'blob_text', array( 'blob_id' => $id ), __METHOD__ );
                        if ( $ret === false ) {
-                               wfDebugLog( 'ExternalStoreDB', "ExternalStoreDB::fetchBlob master failed to find $cacheID\n" );
+                               wfDebugLog( 'ExternalStoreDB',
+                                       "ExternalStoreDB::fetchBlob master failed to find $cacheID\n" );
                        }
                }
                if ( $itemID !== false && $ret !== false ) {
@@ -215,16 +221,22 @@ class ExternalStoreDB extends ExternalStoreMedium {
         */
        function batchFetchBlobs( $cluster, array $ids ) {
                $dbr = $this->getSlave( $cluster );
-               $res = $dbr->select( $this->getTable( $dbr ), array( 'blob_id', 'blob_text' ), array( 'blob_id' => array_keys( $ids ) ), __METHOD__ );
+               $res = $dbr->select( $this->getTable( $dbr ),
+                       array( 'blob_id', 'blob_text' ), array( 'blob_id' => array_keys( $ids ) ), __METHOD__ );
                $ret = array();
                if ( $res !== false ) {
                        $this->mergeBatchResult( $ret, $ids, $res );
                }
                if ( $ids ) {
-                       wfDebugLog( __CLASS__, __METHOD__ . " master fallback on '$cluster' for: " . implode( ',', array_keys( $ids ) ) . "\n" );
+                       wfDebugLog( __CLASS__, __METHOD__ .
+                               " master fallback on '$cluster' for: " .
+                               implode( ',', array_keys( $ids ) ) . "\n" );
                        // Try the master
                        $dbw = $this->getMaster( $cluster );
-                       $res = $dbw->select( $this->getTable( $dbr ), array( 'blob_id', 'blob_text' ), array( 'blob_id' => array_keys( $ids ) ), __METHOD__ );
+                       $res = $dbw->select( $this->getTable( $dbr ),
+                               array( 'blob_id', 'blob_text' ),
+                               array( 'blob_id' => array_keys( $ids ) ),
+                               __METHOD__ );
                        if ( $res === false ) {
                                wfDebugLog( __CLASS__, __METHOD__ . " master failed on '$cluster'\n" );
                        } else {
@@ -232,7 +244,9 @@ class ExternalStoreDB extends ExternalStoreMedium {
                        }
                }
                if ( $ids ) {
-                       wfDebugLog( __CLASS__, __METHOD__ . " master on '$cluster' failed locating items: " . implode( ',', array_keys( $ids ) ) . "\n" );
+                       wfDebugLog( __CLASS__, __METHOD__ .
+                               " master on '$cluster' failed locating items: " .
+                               implode( ',', array_keys( $ids ) ) . "\n" );
                }
                return $ret;
        }
index 0911cca..aa48679 100644 (file)
@@ -46,6 +46,29 @@ class ExternalStoreMwstore extends ExternalStoreMedium {
                return false;
        }
 
+       /**
+        * Fetch data from given external store URLs.
+        * The URL returned is of the form of the form mwstore://backend/container/wiki/id
+        *
+        * @param array $urls An array of external store URLs
+        * @return array A map from url to stored content. Failed results are not represented.
+        */
+       public function batchFetchFromURLs( array $urls ) {
+               $pathsByBackend = array();
+               foreach ( $urls as $url ) {
+                       $be = FileBackendGroup::singleton()->backendFromPath( $url );
+                       if ( $be instanceof FileBackend ) {
+                               $pathsByBackend[$be->getName()][] = $url;
+                       }
+               }
+               $blobs = array();
+               foreach ( $pathsByBackend as $backendName => $paths ) {
+                       $be = FileBackendGroup::get( $backendName );
+                       $blobs = $blobs + $be->getFileContentsMulti( array( 'srcs' => $paths ) );
+               }
+               return $blobs;
+       }
+
        /**
         * @see ExternalStoreMedium::store()
         */
index 9dac031..929c2fd 100644 (file)
@@ -73,7 +73,6 @@ class RunJobs extends Maintenance {
                $startTime = time();
                $type = $this->getOption( 'type', false );
                $wgTitle = Title::newFromText( 'RunJobs.php' );
-               $dbw = wfGetDB( DB_MASTER );
                $jobsRun = 0; // counter
 
                $group = JobQueueGroup::singleton();