$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' );
}
}
$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
}
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...
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;