X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fedit.php;h=6bdb15d90b587ecabbd1c3d84dfcef81e5064f78;hb=b6668a042787fe59be414603e973c491bdf3b04a;hp=6e696513b8fcdb55312f1880cb79508ac255b54b;hpb=76dc1986514cc2da47a0d3872bac8cdcb4ef80e5;p=lhc%2Fweb%2Fwiklou.git 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