From: Kunal Mehta Date: Tue, 10 Dec 2013 22:13:53 +0000 (-0800) Subject: Add "nocreate" and "createonly" options to edit.php X-Git-Tag: 1.31.0-rc.0~17681^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_aide%28?a=commitdiff_plain;h=b208af522858cb0983533d678a7c99c05e07bbfb;p=lhc%2Fweb%2Fwiklou.git Add "nocreate" and "createonly" options to edit.php Change-Id: I2101360a934b8b9a92094c44429e3e2314c7fba3 --- diff --git a/maintenance/edit.php b/maintenance/edit.php index 6e696513b8..6bdb15d90b 100644 --- a/maintenance/edit.php +++ b/maintenance/edit.php @@ -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