r36309 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36308‎ | r36309 | r36310 >
Date:20:37, 15 June 2008
Author:catrope
Status:old
Tags:
Comment:
API: Add nocreate parameter to action=edit
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiEditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiBase.php
@@ -650,6 +650,7 @@
651651 'cannotundelete' => array('code' => 'cantundelete', 'info' => "Couldn't undelete: the requested revisions may not exist, or may have been undeleted already"),
652652 'permdenied-undelete' => array('code' => 'permissiondenied', 'info' => "You don't have permission to restore deleted revisions"),
653653 'createonly-exists' => array('code' => 'articleexists', 'info' => "The article you tried to create has been created already"),
 654+ 'nocreate-missing' => array('code' => 'missingtitle', 'info' => "The article you tried to edit doesn't exist"),
654655
655656 // ApiEditPage messages
656657 'noimageredirect-anon' => array('code' => 'noimageredirect-anon', 'info' => "Anonymous users can't create image redirects"),
Index: trunk/phase3/includes/api/ApiEditPage.php
@@ -59,6 +59,8 @@
6060
6161 if($params['createonly'] && $titleObj->exists())
6262 $this->dieUsageMsg(array('createonly-exists'));
 63+ if($params['nocreate'] && !$titleObj->exists())
 64+ $this->dieUsageMsg(array('nocreate-missing'));
6365
6466 // Now let's check whether we're even allowed to do this
6567 $errors = $titleObj->getUserPermissionsErrors('edit', $wgUser);
@@ -245,6 +247,7 @@
246248 'basetimestamp' => null,
247249 'recreate' => false,
248250 'createonly' => false,
 251+ 'nocreate' => false,
249252 'captchaword' => null,
250253 'captchaid' => null,
251254 'watch' => false,
@@ -269,7 +272,8 @@
270273 'Used to detect edit conflicts; leave unset to ignore conflicts.'
271274 ),
272275 'recreate' => 'Override any errors about the article having been deleted in the meantime',
273 - 'createonly' => 'Don\'t create the page if it exists already',
 276+ 'createonly' => 'Don\'t edit the page if it exists already',
 277+ 'nocreate' => 'Throw an error if the page doesn\'t exist',
274278 'watch' => 'Add the page to your watchlist',
275279 'unwatch' => 'Remove the page from your watchlist',
276280 'captchaid' => 'CAPTCHA ID from previous request',
Index: trunk/phase3/RELEASE-NOTES
@@ -447,6 +447,7 @@
448448 * (bug 14459) Added prependtext and appendtext parameters to action=edit
449449 * (bug 14526) Unescaped SQL in list=backlinks
450450 * Added 'hidden' flag to list=allcategories and prop=categoryinfo output
 451+* Added nocreate parameter to action=edit
451452
452453 === Languages updated in 1.13 ===
453454

Status & tagging log