Merge "Added --wikidb param to sql.php"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 11 Dec 2013 00:34:40 +0000 (00:34 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 11 Dec 2013 00:34:40 +0000 (00:34 +0000)
maintenance/edit.php
resources/mediawiki/mediawiki.js

index 6e69651..6bdb15d 100644 (file)
@@ -38,6 +38,8 @@ class EditCLI extends Maintenance {
                $this->addOption( 'bot', 'Bot edit', false, false, 'b' );
                $this->addOption( 'autosummary', 'Enable autosummary', false, false, 'a' );
                $this->addOption( 'no-rc', 'Do not show the change in recent changes', false, false, 'r' );
+               $this->addOption( 'nocreate', 'Don\'t create new pages', false, false );
+               $this->addOption( 'createonly', 'Only create new pages', false, false );
                $this->addArg( 'title', 'Title of article to edit' );
        }
 
@@ -67,6 +69,12 @@ class EditCLI extends Maintenance {
                }
                $context->setTitle( $title );
 
+               if ( $this->hasOption( 'nocreate' ) && !$title->exists() ) {
+                       $this->error( "Page does not exist", true );
+               } elseif ( $this->hasOption( 'createonly' ) && $title->exists() ) {
+                       $this->error( "Page already exists", true );
+               }
+
                $page = WikiPage::factory( $title );
 
                # Read the text
index 724ca5e..840a071 100644 (file)
@@ -1269,7 +1269,12 @@ var mw = ( function ( $, undefined ) {
                                                        }
                                                        return true;
                                                } );
-                                               $.globalEval( concatSource.join( ';' ) );
+                                               if ( mw.loader.store.useFunction ) {
+                                                       /* jshint -W054 */
+                                                       new Function( concatSource.join( ';' ) )();
+                                               } else {
+                                                       $.globalEval( concatSource.join( ';' ) );
+                                               }
                                        }
 
                                        // Early exit if there's nothing to load...
@@ -1816,6 +1821,7 @@ var mw = ( function ( $, undefined ) {
                                                        raw = localStorage.getItem( mw.loader.store.getStoreKey() );
                                                        // If we get here, localStorage is available; mark enabled.
                                                        mw.loader.store.enabled = true;
+                                                       mw.loader.store.useFunction = !!Math.floor( Math.random() * 2 );
                                                        data = JSON.parse( raw );
                                                        if ( data && typeof data.items === 'object' && data.vary === mw.loader.store.getVary() ) {
                                                                mw.loader.store.items = data.items;