Commit graph

134 commits

Author SHA1 Message Date
Catrope
b1e0daa428 Make errors from ArticleSave hooks propagate to the interface
Aborting a save from the ArticleSave hook and putting an error in
$status didn't actually propagate the error message to the user, but
instead displayed the edit conflict page (!). Fix this so that if we get
an unrecognized error from ArticleSave, we treat it as an extension
error and render it rather than going into conflict mode.

Similarly, make the API attempt to render the error through
dieUsageMsg() like it already does for AS_END

Change-Id: Iccf78480240d0c7ed321438c8190472805957099
2012-05-10 12:10:25 -07:00
Alexandre Emsenhuber
18cc220038 Don't make two database requests to load the same object, again.
I know there's no second parameter to WikiPage::newFromID(), but this will change soon.

This follows-up I098dd36619fff3610be6894037220d3472b809d5.

Change-Id: Ic28b7e05db51e55a5f49fed70c042ba11e4d97fe
2012-05-04 22:10:36 +02:00
umherirrender
e0ded894d9 (bug 30488) API now allows listing of backlinks/embeddedin/imageusage
per pageid

Move the possibles errors set by ApiBase::getTitleOrPageId to
ApiBase::getTitleOrPageIdErrorMessages and remove it from used modules

Change-Id: If037e04665d2524c1f2476bc7996d9573753a4b8
2012-05-02 01:35:04 +01:00
umherirrender
abd979818a add hints to description of action=edit
add a hint to appendtext about section=new. I have seen, that people
build up the new header by itself and concat that with the section text.
It is easy to use section=new.

Feel free to change my english, if you think, that is not good worded.

Change-Id: I0642d496441c8fd375e8cb5dc383124b9ac25235
2012-04-28 20:59:01 +02:00
Reedy
b9e6daa3aa Simplify and refactor out api code for getting title or page id
Change-Id: I098dd36619fff3610be6894037220d3472b809d5
2012-04-27 15:58:04 +01:00
Alex Monk
de9354fd3a (bug 30410) Remove deprecated $wgFilterCallback. The 'filtered' API error was also removed, along with EditPage::AS_FILTERING.
Change-Id: Ic0b7b2f22ab61c9d760d280e5ab4e24af1160b7a
2012-04-24 22:08:41 +01:00
Alex Monk
c6e693cb98 (bug 32497) API now allows changing of protection level using pageid
Change-Id: I01802dde2fba9510cbdf23522ddac59f36a93960
2012-04-07 21:00:55 +01:00
Platonides
f8f9a052af Remove BOM and parser error in parent commit 77b72c24fc
Change-Id: Ic23362656f45f151b9d2cefac16f832af664e18b
2012-04-07 19:55:49 +02:00
Max Semenik
77b72c24fc (bug 32492) API now allows editing using pageid
Change-Id: I9fdbda962777e11a51e4200d44f225c6d01292e9
2012-04-06 16:40:08 +01:00
Sam Reed
b28e168645 Rather than using an error code of unknownerror, use the error code returned by EditPage if it's a string, and it has length, else just return the usual "unknownerror" 2012-01-13 23:14:28 +00:00
Sam Reed
6115b93df8 Re-instate most of the revisions for bug 33147 "API examples should explain what they do"
Using this to sync up my working copies

Should have the little niggles tidied up though
2011-12-27 16:22:35 +00:00
Brion Vibber
02bb594ac7 Revert r106521: creates lots of long, unwrappable lines in help output 2011-12-20 21:26:57 +00:00
Ryan Kaldari
7e903243c6 $reqArr is an ambiguous variable name - req can mean required or request. Changing to an unambiguous name 2011-12-20 04:22:06 +00:00
Ryan Kaldari
ac64223568 adding sectiontitle/wgSectionTitle as a new parameter for page editing (so that it can be set separately from the edit summary). For right now, this is just for API use, and thus isnt used in the form. As soon as 1.19 is out the door, we should change the form to use this as well. The current implementation is designed to be completely backward-compatible and non-disruptive 2011-12-20 04:15:21 +00:00
Sam Reed
b0818acd86 More example conversions/additions
Ping r106439
2011-12-17 19:10:33 +00:00
Sam Reed
53000baecf Oh noes, moar http:// -> https:// 2011-11-28 15:43:11 +00:00
Sam Reed
cd2d20fe8f Fix hook copy paste fail
Move rest of captcha params out of api/ApiEditPage.php
2011-11-23 20:37:13 +00:00
Sam Reed
93fd7aceb8 * (bug 32609) API: Move captchaid/captchaword of action=edit from core to Captcha extension(s)
Left setting of wpCaptchaId and wpCaptchaWord in core. Can't think of a sane way to check and set them via an extension (subclass and override, or a hook). Annoyingly APIEditBeforeSave doesn't pass the params array
2011-11-23 19:09:57 +00:00
Alexandre Emsenhuber
ee8bbf0be8 * Use the fact that WikiPage::getLatest() is updated when editing the page since r103383
* Moved override of $wgTitle and creation of EditPage object to the place they will be used
2011-11-17 10:33:20 +00:00
John Du Hart
2e7d867478 Removed the 'eclipse helper' bit on top of every API module
It's a parctice that dates back to 2006 when the API was first written, and frankly isn't covered by the coding conventions. Same thing with the docblocks, they're all copypasted with some bits changed and don't even make sense if you look at them in the genereated code docs.
I don't feel that any of us depend on this anymore (get a better IDE), so in the inerest of consistancy it's time we said goodbye to it.
2011-11-16 00:17:26 +00:00
Alexandre Emsenhuber
df4b6e4c3a Per Aaron, fix for r89405: introduced DerivativeRequest to allow to override the request parameters, but not headers, cookies and session. Updated ApiEditPage (for the bug) and ApiLogin (for future use) 2011-11-03 19:14:46 +00:00
John Du Hart
40f19e6def Adding context to the API
This will probably break something somewhere so when it does please yell at me on IRC and I'll fix it.
2011-10-26 23:27:01 +00:00
John Du Hart
d07e1d1a06 API get functions should be public 2011-08-26 22:56:31 +00:00
Roan Kattouw
5090af900c (bug 29246) Edit API occasionally throws "unknown error 231". Per comment #1 on the bug and a comment in ApiEditPage, I refactored internalAttemptSave() to return a status object. However, there are so many idiosyncracies wrt how EditPage handles various errors that I decided to put the AS_* error code in $status->value (thanks Chad for that tip) and use that to decide what to do (not part of Chad's tip). The resulting code is still a mess but at least Status objects from doEdit() are propagated now, and it'll be a little bit easier to migrate internalAttemptSave() to a proper Status-based architecture in the future. Or maybe we should just throw away EditPage and start with a blank screen, that sounds appealing to me :) 2011-08-26 16:26:17 +00:00
Sam Reed
a5628f5734 Based on diff to wikia, set more functions consistently public rather than protected 2011-08-17 22:24:21 +00:00
Mark A. Hershberger
48a8fd37ea tabs are tabs, not spaces 2011-07-28 19:13:58 +00:00
Sam Reed
6e84e9ccd9 Followup r92396, add help urls for most of the core (non query) modules 2011-07-17 16:38:24 +00:00
Sam Reed
7206e3cafe * (bug 29278) server error 500 when attempting to add text to a page via redirect (redirect points to the page and page is edited)
Needs 1.17 and 1.18 backporting, so release notes will go in 1.17
2011-06-20 22:32:08 +00:00
Sam Reed
834129ac75 Revert r90488, rename variable from r90487 2011-06-20 22:18:11 +00:00
Sam Reed
09e63f9f53 Followup r90487, kill $result=null in middle 2011-06-20 22:16:22 +00:00
Sam Reed
446d10c8d2 Define a local variable for $result 2011-06-20 22:13:45 +00:00
Sam Reed
bdf84cb20e Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits, so hopefully reviewable in CR...
2011-06-17 16:03:52 +00:00
Sam Reed
dbecd0b5f3 Related to bug 29278, and from the comments in bug 14210, mention the edit token should be sent last/after the text parameter 2011-06-17 14:55:03 +00:00
Sam Reed
58ccb663e1 Followup r89515, fix double spacing in API Error message
Add both customcssprotected and customjsprotected to the possible errors output for editpage
2011-06-05 18:34:26 +00:00
Antoine Musso
6a8e32e986 Single messages can be passed as strings to Api::dieUsageMsg()
Since r88045
2011-05-19 17:51:16 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Alexandre Emsenhuber
4d6fa1e22f Article::updateArticle() doesn't exist anymore 2011-05-13 08:43:42 +00:00
Sam Reed
fa64025161 More parameter documentation 2011-02-19 00:30:18 +00:00
Alexandre Emsenhuber
1fb56df473 Added "context title" to replace $wgTitle, current behavior unchanges, but added a comment that this might change in the future to completely remove $wgTitle usage in EditPage
Also removed null check on showEditForm() since $wgTitle is set on ApiEditPage.php, so it won't catch anything
2011-02-10 17:08:37 +00:00
Sam Reed
1f05665cf3 Styleli[zs]e the API up to date (Been a while since) 2010-12-30 17:06:09 +00:00
Sam Reed
6309c920dd Delete all the "API for MediaWiki 1.8+" comments
Add since to ApiQueryQueryPage
2010-12-22 20:52:06 +00:00
Bryan Tong Minh
b98f2a5a71 (bug 25174) Add equal sign to boolean parameters in examples, so that the examples work immediately when posted 2010-11-23 22:05:27 +00:00
OverlordQ
f2df835d56 Revert r69337 (Removal of minordefault preference) 2010-11-01 18:58:24 +00:00
Roan Kattouw
d1c9916e9c Revert r70703 and followup r70715: broke &redirect for API edit with a fatal error 2010-10-23 17:48:08 +00:00
Sam Reed
42b5c265c0 * (bug 25248) API: paraminfo errors with certain modules
Added a needsToken() function, rather than calling getTokenSalt, which can throw silly errors due to dependencies on parameters
2010-10-01 20:12:50 +00:00
Platonides
50e2405a03 Refactor to avoid defining globals inside switches. 2010-08-12 14:25:07 +00:00
Tim Starling
cc9f81ed94 * Revert r66878, completely misses the point of factoring out doEdit() in the first place, which was to separate the UI layer from the backend layer, to support callers with alternate UIs or no UIs.
* Reverted followup 66880.
* Reverted dependent changes r67752, r68606, r68608, r68609. The point of deprecating insertArticle()/updateArticle() was to allow the UI code to be moved to EditPage. If you move that exact EditPage-specific functionality back into Article::doEdit(), and call it from all sorts of non-EditPage places, then we'll hit the same sorts of bugs we had before r14834.
2010-08-09 08:33:42 +00:00
Jack Phoenix
366a66ecf9 follow-up to r70703: converted spaces to tabs and trimmed trailing spaces 2010-08-08 16:45:14 +00:00
X!
04e6adbbd9 Followup to r70658: Code styling, use ApiPageSet to fix redirects. 2010-08-08 15:03:30 +00:00
X!
9f025aeb1d (bug 24330) Add &redirect parameter to ?action=edit 2010-08-08 01:14:48 +00:00