* Rename randomInsert() to insertToDefault()
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 24 Sep 2008 20:30:10 +0000 (20:30 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 24 Sep 2008 20:30:10 +0000 (20:30 +0000)
* Use insertToDefault() to insert revisions (talked to brion on this)

includes/ExternalStore.php
includes/Revision.php

index 272bcfc..d095aba 100644 (file)
@@ -75,7 +75,7 @@ class ExternalStore {
         * @param string $data
         * Returns the URL of the stored data item, or false on error
         */
-       public static function randomInsert( $data ) {
+       public static function insertToDefault( $data ) {
                global $wgDefaultExternalStore;
                $tryStores = (array)$wgDefaultExternalStore;
                $error = false;
index b1d293e..c369571 100644 (file)
@@ -762,18 +762,8 @@ class Revision {
 
                # Write to external storage if required
                if ( $wgDefaultExternalStore ) {
-                       if ( is_array( $wgDefaultExternalStore ) ) {
-                               // Distribute storage across multiple clusters
-                               $store = $wgDefaultExternalStore[mt_rand(0, count( $wgDefaultExternalStore ) - 1)];
-                       } else {
-                               $store = $wgDefaultExternalStore;
-                       }
                        // Store and get the URL
-                       $data = ExternalStore::insert( $store, $data );
-                       if ( !$data ) {
-                               # This should only happen in the case of a configuration error, where the external store is not valid
-                               throw new MWException( "Unable to store text to external storage $store" );
-                       }
+                       $data = ExternalStore::insertToDefault( $data );
                        if ( $flags ) {
                                $flags .= ',';
                        }