Commit graph

320 commits

Author SHA1 Message Date
Sam Reed
ddc7efbedf stylize api up to date 2010-08-05 07:02:09 +00:00
Sam Reed
c85b04919e Revert r70489 2010-08-05 06:58:11 +00:00
Sam Reed
0345d5e08f Move if ( is_array( $value ) && !$dupes ) { up to else block after the first !is_array. If it's not not an array, it's an array, and therefore, we can just filter dupes if requested 2010-08-05 06:08:23 +00:00
Sam Reed
c95f4a05ad Followup r70480, per Nikerabbits comment, there '''is''' something to do 2010-08-05 06:02:57 +00:00
Sam Reed
0ccf248381 -rakkaus/#mediawiki-i18n- [04-Aug-2010 22:02:04] PHP Notice: Undefined variable: required in /www/w/includes/api/ApiBase.php on line 749 2010-08-04 22:02:57 +00:00
Sam Reed
edf926dfe2 Followup r70479
If string is required, but it's value === '', that's missing!
2010-08-04 21:21:35 +00:00
Sam Reed
b70c52dd8e Further followup to r70460/r70461 and r70477
Move code into getParameterFromSettings, most of the flesh is there anyway (it checks isset( $value ) ), so we can use the else to check if it's required

A followup could be to whinge if '' is returned for a string
2010-08-04 21:19:53 +00:00
Sam Reed
dd889d04c4 Followup r70460/r70461
use self consistently

Fold in duplicate loop

missingparam can be done during attempt to set ParamCache, we might aswell give up and not finish populating the param cache if we're gonna die from a missing param
2010-08-04 20:27:56 +00:00
Sam Reed
f77fff0ffb Followup r70461 if PARAM_REQUIRED is set, use for missing param in getPossibleErrors in ApiBase
All but ApiQueryBacklinks
2010-08-04 19:20:15 +00:00
X!
8b466d3d0d Followup to r70460: Committed wrong version of ApiBase.php, convert all core API modules to PARAM_REQUIRED syntax 2010-08-04 14:15:33 +00:00
X!
20d042a99e * PARAM_REQUIRED parameter flag added. If this flag is set, and the end user does not set
the parameter, the API will automatically throw an error.
2010-08-04 13:35:08 +00:00
Bryan Tong Minh
0e61296f98 (bug 24564) Fix fatal errors when using list=deletedrevs, prop=revisions or one of the backlinks generators with limit=max. 2010-07-28 11:30:14 +00:00
Tim Starling
6afbc6762c Reintroduced the extractRequestParams() memoization as in r69782, but respecting $parseLimit. Fixes bug 24564 (fatal error due to duplicate calls to addValue()). 2010-07-28 04:12:36 +00:00
Tim Starling
287c9ea4f5 Partial revert of r69782: reverted the cache feature, it does not correctly respect $parseLimit. 2010-07-26 06:20:29 +00:00
Platonides
5833c105d0 Move getValidNamespaces() to Namespace.php 2010-07-25 22:29:05 +00:00
Roan Kattouw
075c8d1624 Followup to r69776: cache result of extractRequestParams() because it gets called 2 or 3 times per module per request now. Also touch up documentation here and there 2010-07-23 10:15:29 +00:00
Sam Reed
5387b8a806 Stylize API up to date
Fix spaces from r69755

Minor update to RELEASE-NOTES per r69753
2010-07-23 07:33:40 +00:00
Tim Starling
b2dc451c82 Rewrote r69339 etc. to clean up API cache header handling.
* Introduced a "cache mode" concept to simplify the header generation code, and to avoid odd results when conflicting cache header requests are received from submodules, or at least to formalise the handling of such cases.
* Made the cache mode private by default, so that code written in ignorance of caching tends to be safe. If different query modules are used in a single request, private caching is preferred over public caching.
* Removed the "must-revalidate" option from all CC headers, this is really specific to page views with a hacked squid in front, I don't think it's applicable here.
* Made the watchlist module private. This is really the definition of private data. There's nothing in the HTTP spec that says the URL for a CC:public request is private and can't be leaked. CC:private provides protection against unknown proxy behaviour.
* In ApiQueryAllmessages: avoid calling $wgLang->getCode() to check if it's necessary to make a new $wgLang when lang= is specified, since this is the only thing that unstubs $wgUser.
* Removed "FIXME: should this check $user instead of $wgUser?" Answer is no.
2010-07-23 07:17:56 +00:00
Sam Reed
8f1d2cb199 Big blitz on unused variables (a lot of $db = $this->getDb() ) 2010-07-22 22:13:21 +00:00
Sam Reed
fd2744694a Add braces 2010-07-22 06:44:23 +00:00
Roan Kattouw
70824ccccc API: Make output containing private or user-specific data uncacheable for logged-in users by setting Vary: Cookie or Cache-Control: private, whichever is appropriate. Fixes instances in core and WMF-deployed extensions only. Without this change, the output of requests like ?action=query&list=recentchanges&rcprop=patrolled&smaxage=3600 would be cached in Squid and viewable for anyone using the same URL, even if they don't have patrol rights. Other, more serious exploits are also possible. Also avoid using $wgUser in one place, kill some unused global $wgUser; instances and tweak a comment. 2010-07-14 19:00:54 +00:00
Sam Reed
f5c639fd10 Stylize API
Add a few braces
2010-07-06 13:15:59 +00:00
Sam Reed
3fe7b6912b * (bug 24136) unknownerror when adding new section without summary, but forceditsummary
Handle AS_SUMMARY_NEEDED in ApiEditPage

Fixup some braces
2010-06-27 19:22:46 +00:00
Sam Reed
928ff2b273 Resolve fixme of r66539
Move getWatchlistUser to ApiBase
2010-06-22 12:10:26 +00:00
Derk-Jan Hartman
921619b119 Correct the address of the FSF in some of the GPL headers
59 Temple Place -> 51 Franklin Street
2010-06-21 13:13:32 +00:00
Roan Kattouw
fe66ef26cd (bug 24016) API: Handle parameters specified in simple string syntax ( 'paramname' => 'defaultval' ) correctly when outputting help. Patch by Brad Jorsch. 2010-06-18 09:30:38 +00:00
Sam Reed
6b5a27c0e8 Followup to r66232 do same for limit text, and module rights 2010-05-11 22:34:41 +00:00
Sam Reed
0769301e87 Stylize Api upto date 2010-04-17 20:58:04 +00:00
Mark A. Hershberger
9c7a7e57f0 * New UploadFromUrlJob class to handle Upload-by-Copy
* Define variable for ApiUserrights.php that wasn't defined before.
* Add convertVerifyErrorToStatus and getVerificationErrorCode to
  UploadBase to translate error consts since UploadFromUrl will
  need a message to display to end-users.
* refactor mime-checking out of UploadBase::verifyFile into
  UploadBase::verifyMimeType
* Make UploadBase::verifyFile always return arrays for errors
* Use HttpFunctions instead of custom curl handler for async downloading
* TODO: Need a way to feed errors back to the requestor
* TODO: Need to add watchlist param handling and warnings checks.
2010-04-17 02:43:13 +00:00
Bryan Tong Minh
6c6c2f698c Followup to r64962: Fixed watchlist parameter in API. User options watchdeletions and watchmoves can now by overridden. Unwatching while editting is now possible. 2010-04-14 12:17:39 +00:00
Mark A. Hershberger
e90d1ecd97 * EOL ws clean on ApiBase.php
* Use an actual value for ApiUpload.php
* Commit some code I must've missed for r64852
2010-04-14 04:57:27 +00:00
Sam Reed
d840fbbc95 Revert r64955
Again partial fix to bug 23167

Bugfix watch on creation (edit and upload), in current form, setting unwatch, or nochange would follow watchcreation, which wasn't requested
2010-04-12 10:44:45 +00:00
Alexandre Emsenhuber
15dd2a1c40 Fix param names mismatch in code/doc from r64852 and r64397 2010-04-11 19:10:15 +00:00
Mark A. Hershberger
6c267f1434 * Clean up some duplicated code in r64291
Would've like to refactor the $wgUser->*Watch — but I'm not sure if the hooks that come along with $articleObj->*Watch are ok.
2010-04-10 06:11:02 +00:00
Sam Reed
2a557115f0 Fixup to r64197 per http://www.mediawiki.org/wiki/Special:Code/MediaWiki/64197#c6451
Pass $fromTitle rather than $titleObj (which is undefined)
2010-04-07 08:56:43 +00:00
Mark A. Hershberger
c1e369912f followup r64465 — make happy-melon happy 2010-04-01 11:25:56 +00:00
Mark A. Hershberger
c1afe8e84e follow up r64454 — change comment style 2010-04-01 00:35:14 +00:00
Mark A. Hershberger
9c26ed06af Get rid of E_STRICT message 2010-03-31 19:50:46 +00:00
Mark A. Hershberger
234f54a88e * Set $titleObj to null by default on getWatchlistValue since it often isn't needed & check that it is set when it is needed. (follow up r64197).
* Refactoring ApiUpload & UploadBase to make it easier to extend & read.
* Use a class constant for the upload session key instead of a hard-coded-across-several-files value.
* Add UploadBase::appendToUploadFile() method to enable protocols that do incremental upload.
2010-03-30 19:10:10 +00:00
Sam Reed
ba575d7a9e Switch if ordering as per Roans comment for r64291 2010-03-28 19:23:17 +00:00
Sam Reed
789cc18185 Followup r64197
Return null in getWatchlistValue if no change

Fixup unneccessary watch/unwatch calls

Remove useless unwatch from ApiUpload
2010-03-28 15:08:45 +00:00
Roan Kattouw
7ef2b44907 Fix coding style, whitespace in r64267 2010-03-27 21:34:07 +00:00
Sam Reed
346554a2f3 Followup to r64197
Remove the mutually exclusive else checks

Fix undefined on getWatchlistValue in ApiBase
2010-03-27 17:51:56 +00:00
Happy-melon
d6fe6de7a8 Followup to r64228 - apply restrictions in API. 2010-03-26 23:02:10 +00:00
Sam Reed
88df448d36 Fix bug 22944 in a much better fashion (using watchlist parameter)
Deprecate old watch/unwatch parameters

Move generic watchlist stuff to ApiBase/getWatchlistValue (maybe needs renaming better?)

Tweak some braces in ApiEditPage
2010-03-25 22:15:08 +00:00
Bryan Tong Minh
dd349d7b3a Merge r63621 and r63636 from REL1_16:
* Rollback chunked uploading support for 1.16
* 	Pass $sessionKey as parameter to UploadFromStash::initialize.
2010-03-12 18:26:12 +00:00
Roan Kattouw
d0045bcd78 API: Don't unstub $wgContLang in ApiBase::getValidNamespaces() 2010-02-26 18:24:58 +00:00
X!
0543d7bdce Whoops, committed wrong version 2010-02-24 17:06:19 +00:00
X!
fe72f84205 PARAM_TYPE 'user' now works for multi-values 2010-02-24 17:04:21 +00:00
Mark A. Hershberger
c871b75a3e follow up r62231, r61779, r62175
* Fix up messages
* For new FileRepo::append(), use flags to determine whether to delete or not
* Add more error checking for appending
* Fix a couple of places in Revision.php and LogPage.php where DB errors were produced when comment was null
* Remove bogus checking for !$comment, etc on the DONE phase of chunked uploading
* Don't pretend to return a value when raising an exception
* Add more tests for chunked uploads
* Verify that Status::getErrorsArray() (at least where it is used in ApiUpload::execute()) returns an array that we can pass to dieUsageMessage()
* Ensure that checkWarnings(), etc work only on the complete file
2010-02-22 02:15:30 +00:00
Jack Phoenix
4228459b24 ApiBase.php: coding style cleanup, added more braces, trimmed trailing spaces, changed copyright symbol to the proper one 2010-02-20 19:39:51 +00:00
Sam Reed
878c7da630 Followup to r62557 as per Roans comment 2010-02-16 21:59:16 +00:00
Sam Reed
eb9aa1686c Followup to r62557
Add array( 'sessionfailure' ) to getPossibleErrors for token using modules (missed adding when removing from individual modules!)
2010-02-16 01:27:19 +00:00
Sam Reed
0e8b0b41ac Refactor requiresToken to getTokenSalt - Returns salt if exists, null if no salt, else false if no token required
Move sessionfailure (token validation checking) up a couple of levels

Part of bug 21991

Followup to r62482 and r62504
2010-02-15 23:53:43 +00:00
Roan Kattouw
3a953c8e30 API performance fixes: avoid unstubbing $wgContLang and $wgUser 2010-02-15 20:50:21 +00:00
Mark A. Hershberger
26a4587d80 follow up r62353 Make ApiBase::requireOnlyOneParameter() accept parameters that are set, but false. This means that you can pass in more than one parameter, as long as it is the same as the default (false). Have to do it this way since we'd like to default boolean parameters to false in getAllowedParams() but by the time requireOnlyOneParameter() is called, the defaults are set, so we can't tell the difference between passing in a parameter set to the default and just getting the defaults. 2010-02-15 07:06:49 +00:00
Sam Reed
80f9448690 Start of "Bug 21991 - Move common query parameter (uc, rc) validation, token requiringness/checking to ApiBase/Similar"
Move token requringness check to the ApiMain

Adding an exception if we're using "gettoken" (block/unblock)

Remove array( 'missingparam', 'token' ), from the getPossibleErrors of modules that set requireToken method to true
2010-02-14 22:20:27 +00:00
Sam Reed
fcdb5b846c Move ( 'code' => 'show', 'info' => 'Incorrect parameter - mutually exclusive values may not be supplied' ) to messageMap 2010-02-14 15:16:09 +00:00
Mark A. Hershberger
8b36a2b969 various eol whitespace now instead of when someone needs to do CR 2010-02-12 06:44:16 +00:00
Sam Reed
bd7da13869 Simplification as per Bryan on r62339 comment 2010-02-11 23:09:38 +00:00
Sam Reed
c1af4821bf Cater for some more errors in ApiBase.php 2010-02-11 22:28:30 +00:00
Sam Reed
20206755ee $this->mModuleName to $this->getModuleName() 2010-02-11 22:18:16 +00:00
Sam Reed
8eb8e2e0d4 Update code documentation with Bryans help for r62282 and r62331 2010-02-11 22:06:45 +00:00
Sam Reed
72df21ef49 Followup to bryans comment for r62328
Rename possibleErrors to getPossibleErrors
2010-02-11 21:53:57 +00:00
Sam Reed
fe722d85a5 Move mustBePosted error into messageMap
Switch call to dieUsage to dieUsageMsg
2010-02-11 21:51:15 +00:00
Sam Reed
aa973b9eb7 More of bug 18771 - List possible errors in action=paraminfo
Followup to comments of r62282
2010-02-11 21:34:35 +00:00
Sam Reed
ee60482546 Start implementation of bug 18771 - List possible errors in action=paraminfo
Base has empty array() returning method, ApiBlock has implementation of possibleErrors from code above (possibly not complete)

Can be finished incrementally, so serves as a review point for Roan
2010-02-11 01:13:45 +00:00
Mark A. Hershberger
15fec3ab7f * Fix up ApiTest a bit, cookie handling works
* Start upload chunks testing
* found some problems with messages
2010-02-09 08:37:38 +00:00
Sam Reed
b15f2c8c46 Normalise comment usage (# --> //) 2010-01-23 22:52:40 +00:00
Sam Reed
47c24175d3 Add/remove whitelines to increase readability in API code files 2010-01-23 22:26:40 +00:00
Roan Kattouw
51107443dc API: Fix bug where deprecated boolean parameters would always trigger the deprecated warning. 2010-01-23 17:48:02 +00:00
Mark A. Hershberger
b15cccb688 ws only cleanup 2010-01-22 03:14:52 +00:00
Aryeh Gregor
3758769f0d stylize.php on API code
"I wouldn't object to stylizing the API code to bring it in line with
the rest of MW on principle, but I'm not gonna bother myself." --Roan
<http://www.mediawiki.org/wiki/Special:Code/MediaWiki/60657#c5108>

If you're seeing this commit in blames, tell your blame tool to ignore
whitespace, e.g., git blame -w or svn blame -x -w.
2010-01-11 15:55:52 +00:00
Tim Starling
bd8fffe24d Reverted r58646 as per my comments on bug 20554. 2009-12-01 01:55:04 +00:00
Roan Kattouw
1b89cd274a API: (bug 20554) Expose average slave lag (avglag) as well as maxlag. Patch by Sam Reed. 2009-11-06 14:38:55 +00:00
Raimond Spekking
a0d01f9cae Follow-up r58237: fixing PHP Notice: Undefined variable: deprecated in /var/www/w/includes/api/ApiBase.php on line 633 2009-10-28 05:20:17 +00:00
Chad Horohoe
c660ee428f (bug 21106) tag deprecated parameter in action=paraminfo. Add new PARAM_DEPRECATED const for automagically tagging deprecated parameters. Keeps action=help and action=paraminfo up to date 2009-10-28 00:56:07 +00:00
Alex Z
216e60d01e (bug 18019) Warn users when moving a file to a name in use on a shared repo.
Allow only users with the 'reupload-shared' right to complete the move.
2009-10-24 04:36:11 +00:00
Siebrand Mazeland
f854edfe87 New permission 'sendemail' added. Default right for all registered users. Can for example be used to prevent new accounts from sending spam.
* hide some user settings if user is not allowed to send e-mail, but can receive e-mail
* update API 'cannot send e-mail' message
* FIXME: gives 'mailnologin'/'mailnologintext' as error. Error handling should be made more fine grained
2009-09-26 23:11:45 +00:00
Roan Kattouw
e3ab8ed99a API: BREAKING CHANGE: (bug 20426) Instead of throwing an error when a limit is set too high/low, throw a warning and continue with the limit set to the maximum/minimum 2009-08-28 16:37:48 +00:00
Bryan Tong Minh
05a916153f * Cleanup ApiUpload
* UploadBase::verifyUpload now always returns a status array
* Disabled async upload by url because wfShellBackgroundExec is broken
2009-08-26 19:38:38 +00:00
Roan Kattouw
9e881e1b2e Elaborate docs added in r53753 per CR comment 2009-07-26 18:24:47 +00:00
Roan Kattouw
4353f7b321 Followup to r53702: document $extradata parameter 2009-07-25 18:29:13 +00:00
Aryeh Gregor
da31137022 Better documentation for dieUsage()
If I got it wrong, please improve.
2009-07-23 23:50:04 +00:00
Michael Dale
369402239c other part of the r53342 commit 2009-07-15 23:15:51 +00:00
Michael Dale
aefc40d749 here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge 1st attempt.
Here is a short overview of changes and associated default configuration variables (most everything is off by default) also see ~soon to be updated~: http://www.mediawiki.org/wiki/Media_Projects_Overview

= Upload Improvements =
==Upload API ==
* Based on the early work of Bryan Tong and others it adds the upload option to the api.
* We rewrite Special:Upload page to include use the new refactoring
* Added in token checks in both the SpecialUpload.php page so avoids DOS / xss copy-by-url JavaScript based cross site POST file submissions

== Copy by URL==
$wgAllowCopyUploads = false;
* http class rewrite includes a new http background download see: includes/HttpFunctions.php

* spins off a php process that calls: maintenance/http_session_download.php
* pushes updates to the session and gives the user a progress bar on http copy uploads from other server progress (using js2 upload interface) (if not using the js2 upload interface it does the request in-place but the download is limited to the php ini timeout time)

== Firefogg ==
* Firefogg enables resumable upload by chunks
* progress indicators and conditional invokation (js2 system)
* and of-course client side transcoding.

= Script Server =
$wgEnableScriptLoader = false;
* off by default if $wgEnableScriptLoader is turned on script files are grouped, gziped, cached etc.
for more info see: http://www.mediawiki.org/wiki/Extension:ScriptLoader

* Includes some early skin js include fixes (skin/script system still lots of love)
* Includes a "javascript class autoloader" this is packaged into mwEmbed so that the mwEmbed library can work in stand alone mode (while retaining localization and script serving) (one such application is the make page for firefogg.org : http://www.firefogg.org/make/index.html  )
* The file that contains the autojavascript loading classes is: js2/php/jsAutoloadLocalClasses.php
* One can use this auto class loading dependency system with extensions and add-ons but I need to better document that.

= js2 system  / mwEmbed=
$wgEnableJS2system = false

* includes initial rewrite towards more jquery based javascript code
* especially for the Special:Upload page.
* Also the edit page include support for the "add-media-wizard"
* includes dependency loader for javascript that optionally takes advantage of the script-loader
* remote embedding of javascript interfaces (like embedding video, or commons media searching)

* $wgDebugJavaScript = false; .. .this variable lets you always get "always fresh javascript". When used with the script-loader it does not minify the script-loader output.

= mwEmbed =
* Will commit a separate patch to oggHandler that conditionally outputs  <video tag> to use the new javascript video player.
** mv_embed player includes: play-head, volume control, remote embedding, oggz-chop support across plugins.
* add-media-wizard adds easy inserts of media to pages (with import)

== jQuery==
* we include a base install of jQuery, jQuery ui and some plugins.
* all the javascript classes are in the scriptloader so its easy to load any set of jquery ui components that you may need using the script-server. You get a callback so you can then execute js with dependencies loaded.

== other stuff ==
there is a bit more code in js2 that pertains to sequence editing, timed text display and basic image editing. We include a base import of pixastic-lib & pixastic-editor... will work with the pixastic developer to try and ensure upstream compatibility on our usage of the library for in-browser photo and sequence manipulation.
2009-07-14 23:52:14 +00:00
Bryan Tong Minh
31d9947618 (bug 18533) Add readonly reason to readonly exception 2009-07-12 12:38:03 +00:00
Roan Kattouw
91271d809e API: (bug 18731) Show correct SVN links for extension modules in api.php?version . Guesswork to get the path assumes extensions are in a directory called extensions/extensionname , which should be a valid assumption on sane installs. 2009-05-09 12:52:38 +00:00
Chad Horohoe
c5ae50df41 Don't explicitly check for false. Most modules without params return an empty array rather than false, in which case we still don't want to output this. 2009-05-07 20:02:20 +00:00
Roan Kattouw
e484ef763d API: Fix regression from r32224 with caused bug 18597 (internal error for empty generator= parameter) 2009-04-27 14:21:16 +00:00
Roan Kattouw
1083d741dc Followup to r49013: forgot to commit ApiBase.php 2009-03-29 16:40:31 +00:00
Roan Kattouw
5e7acff52b API: Add nosuchuser message to ApiBase::$messageMap 2009-03-26 13:01:53 +00:00
Alexandre Emsenhuber
c53e76ad34 Changed ereg(i)_replace to preg_replace, the former is throwing E_DEPRECATED since PHP 5.3 2009-03-18 19:25:29 +00:00
Alexandre Emsenhuber
9dd9379eb4 Per anomie's report on IRC: $wgMaxArticleSize is in kilobytes, not bytes 2009-03-07 17:37:29 +00:00
Roan Kattouw
21fd7af97e * API: (bug 17774) API pretends action=query doesn't exist for users without read rights
* Instead of hiding read-restricted modules, throw an error when a user without read rights tries to use them
* Do the same for write modules when $wgEnableWriteAPI is false
* Indicate whether a module needs read or write rights in action=help and action=paraminfo
* BREAKING CHANGE: action=purge now requires write rights and, for anonymous users, a POST request
2009-03-06 13:49:44 +00:00
Roan Kattouw
5349ea2dd8 * API: (bug 13209) Add rvdiffto parameter to prop=revisions
* Add $wgAPIMaxUncachedDiffs (default 1) which controls how many non-cached diffs will be served per request
* Tweak DifferenceEngine.php a bit to make cache status accessible, and remove a useless 'parseinline' which broke diff generation in the API
2009-02-28 13:25:21 +00:00
Roan Kattouw
a4b89293d6 API: (bug 17703) Fix regression from r47039 causing error code and error text to be switched for some errors. r47039 was backported to the 1.14 branch, will backport this one too. 2009-02-27 14:28:12 +00:00
Roan Kattouw
fdb926bca4 * API: Add documentation to important API classes
* Move page_is_redirect up in ApiPageSet::getPageTableFields()
2009-02-11 19:25:25 +00:00
Roan Kattouw
81bf8d0a3a * API: (bug 17357) Add subpage moving to the API
* Added Title::moveSubpages() as a backend function
** Didn't update SpecialMovepage to use this; left to braver souls
* Fix handling of errors on talk page move (will backport)
2009-02-09 14:16:51 +00:00
Roan Kattouw
2df33ff098 * API: BREAKING CHANGE: (bug 11430) Return fewer results than the limit in some cases to prevent running out of memory
* This means queries could possibly return fewer results than the limit and still set a query-continue
* Add iicontinue, rvcontinue, cicontinue, incontinue, amfrom to faciliate query-continue for these modules
* Implemented by blocking additions to the ApiResult object if they would make it too large
** Important things like query-continue values and warnings are exempt from this check
** RSS feeds and exported XML are also exempted (size-checking them would be too messy)
** Result size is checked against $wgAPIMaxResultSize, which defaults to 8 MB

For those who really care, per-file details follow:

ApiResult.php:
* Introduced ApiResult::$mSize which keeps track of the result size.
* Introduced ApiResult::size() which calculates an array's size
  (which is the sum of the strlen()s of its elements).
* ApiResult::addValue() now checks that the result size stays below
  $wgAPIMaxResultSize. If the item won't fit, it won't be added and addValue()
  will return false. Callers should check the return value and set a
  query-continue if it's false.
* Closed the back door that is ApiResult::getData(): callers can't manipulate
  the data array directly anymore so they can't bypass the result size limit.
* Added ApiResult::setIndexedTagName_internal() which will call
  setIndexedTagName() on an array already in the result. This is needed for the
  'new' order of adding results, which means addValue()ing one result at a time
  until you hit the limit or run out, then calling this function to set the tag
  name.
* Added ApiResult::disableSizeCheck() and enableSizeCheck() which disable and
  enable size checking in addValue(). This is used for stuff like query-continue
  elements and warnings which shouldn't count towards the result size.
* Added ApiResult::unsetValue() which removes an element from the result and
  decreases $mSize.

ApiBase.php:
* Like ApiResult::getData(), ApiBase::getResultData() no longer returns a
  reference.
* Use ApiResult::disableSizeCheck() in ApiBase::setWarning()

ApiQueryBase.php:
* Added ApiQueryBase::addPageSubItem(), which adds page subitems one item
  at a time.
* addPageSubItem() and addPageSubItems() now return whether the subitem
  fit in the result.
* Use ApiResult::disableSizeCheck() in setContinueEnumParameter()

ApiMain.php:
* Use ApiResult::disableSizeCheck() in ApiMain::substituteResultWithError()
* Use getParameter() rather than $mRequest to obtain requestid

DefaultSettings.php:
* Added $wgAPIMaxResultSize, with a default value of 8 MB

ApiQuery*.php:
* Added results one at a time, and set a query-continue if the result is full.

ApiQueryLangLinks.php and friends:
* Migrated from addPageSubItems() to addPageSubItem(). This eliminates the
  need for $lastId.

ApiQueryAllLinks.php, ApiQueryWatchlist.php, ApiQueryAllimages.php, ApiQuerySearch.php:
* Renamed $data to something more appropriate ($pageids, $ids or $titles)

ApiQuerySiteinfo.php:
* Abuse siprop as a query-continue parameter and set it to all props that
  couldn't be processed.

ApiQueryRandom.php:
* Doesn't do continuations, because the result is supposed to be random.
* Be smart enough to not run the second query if the results of the first
  didn't fit.

ApiQueryImageInfo.php, ApiQueryRevisions.php, ApiQueryCategoryInfo.php, ApiQueryInfo.php:
* Added continue parameter which basically skips the first so many items

ApiQueryBacklinks.php:
* Throw the result in a big array first and addValue() that one element at a time if necessary
** This is necessary because the results aren't retrieved in order
* Introduced $this->pageMap to map namespace and title to page ID
* Rewritten extractRowInfo() and extractRedirRowInfo() a little
* Declared all private member variables explicitly

ApiQueryDeletedrevs.php:
* Use a pagemap just like in Backlinks
* Introduce fake page IDs and keep track of them so we know where to add what
** This doesn't change the output format, because the fake page IDs start at 0 and are consecutive

ApiQueryAllmessages.php:
* Add amfrom to facilitate query-continue

ApiQueryUsers.php:
* Rewrite: put the getOtherUsersInfo() code in execute()
2009-02-05 14:30:59 +00:00
Roan Kattouw
bb3980dd8d * API: (bug 17007) Add action=import
* Add intoken=import to prop=info
* Store message key and arguments in WikiErrorMsg
2009-02-04 20:11:27 +00:00
Roan Kattouw
8e361227a2 Revert r46512 (Add "check" parameter to action=email) and its followups r46515 and r46517. This functionality is already present in list=users (as usprop=emailable), where it belongs 2009-01-31 13:20:36 +00:00
Roan Kattouw
7babbd2fc5 Add the 'movenotallowedfile' message to the API message map. Turns out that's all I needed to do to support file moving through the API :D 2009-01-29 23:01:13 +00:00
X!
a9b78e1db9 Add "check" parameter to action=email 2009-01-29 01:25:17 +00:00
Roan Kattouw
6449867508 * API: (bug 15949) Add undo functionality to action=edit
* Move undo text generation from EditPage::getContent() to Article::getUndoText()
* Add some more examples for action=edit
* ApiEditPage.php: don't mix !is_null() and isset(), be consistent
2009-01-26 13:51:03 +00:00
Roan Kattouw
cd910c6544 API: Fix profiling errors caused by calling wfProfileClose() from dieUsage() 2009-01-23 20:23:34 +00:00
Alex Z
ff00dda0d0 Make API action=delete respect $wgDeleteRevisionsLimit 2009-01-20 23:37:39 +00:00
Roan Kattouw
781597bdce API: Fix weird ==/=== bug in API help: a possible value of zero is interpreted as "can be empty". 2008-12-21 00:21:01 +00:00
Roan Kattouw
8504bf43e2 API: Crusade against extract(). Left one extract() call alone in ApiQueryBacklinks.php because I don't have a better alternative for it. 2008-12-17 16:34:01 +00:00
Roan Kattouw
ec6060e5c9 API: Fix r42813, committed some stuff that shouldn't be committed just yet 2008-10-30 17:24:40 +00:00
Roan Kattouw
095803abf5 API: Tweak r42794 (add docs for ApiBase class constants) a little 2008-10-30 14:51:57 +00:00
Chad Horohoe
072649ebe8 Add some docs on these class constants 2008-10-30 00:39:21 +00:00
Tim Starling
f48c6070df Removed all instances of empty() where error suppression was not intended. Replaced with conversion to boolean, count() or empty string check as appropriate. Fixes a number of bugs due to incorrect conversion to boolean: suppressed edit summaries containing '0', ignored titles called '0', searches for '0' ignored, etc. 2008-10-25 14:04:43 +00:00
Roan Kattouw
6ad1e45cd9 API: * BREAKING CHANGE: (bug 16074) Providing prop=revisions&rvprop=content with too many titles or revisions (typically through a generator) no longer causes an error, but a warning
* Added ApiBase::truncateArray() and used it in ApiBase::parseMultiValue()
2008-10-24 13:05:44 +00:00
Roan Kattouw
3ff1f89e0c * (bug 15845) API: Added pageid/fromid parameter to action=delete/move, making manipulation of legacy pages with invalid titles possible
* Fix an E_STRICT while I'm at it
2008-10-07 14:57:59 +00:00
Roan Kattouw
212720fa28 API: * (bug 15785) Allow for different expiry times for different protections, like the UI does
* BREAKING CHANGE: Alter action=protect output to display multiple expiry times
* BREAKING CHANGE: Error messages invalidexpiry and pastexpiry now state the expiry they're about
* Add ApiBase::PARAM_ALLOW_DUPLICATES and honor it in ApiBase::getParameterFromSettings()
2008-10-04 14:58:13 +00:00
Alex Z
1f5da24b79 *Don't let the API action=protect set actions that aren't in $wgRestrictionTypes or levels not in $wgRestrictionLevels
*Pass an array to Article::updateRestrictions for the expiry. Though it should allow for separate expiry times, like the normal UI.
2008-09-18 21:30:51 +00:00
Thomas Bleher
4e9dacf069 Escape $1 in message (was PHP syntax error) 2008-09-14 14:24:54 +00:00
Roan Kattouw
76635483de (bug 15359) Add APIGetAllowedParams and APIGetParamDescription hooks 2008-09-07 19:04:51 +00:00
Roan Kattouw
b624df0d43 (bug 15466) Added action=purge to the API. Modified patch by ^demon 2008-09-04 21:53:43 +00:00
Roan Kattouw
bd3bf5d2a7 * Split patrol code
** Backend code moved to RecentChange::reallyMarkPatrolled() and doMarkPatrolled()
** Adapted Article::markpatrolled()
* (bug 15466) Added action=patrol to the API. Modified patch by Soxred93
* Added rctoken=patrol to list=recentchanges
* Detect duplicate warnings in ApiBase::setWarning()
2008-09-04 15:17:51 +00:00
Bryan Tong Minh
a66bffaedf Fix for my previous commit: Filter out null values 2008-08-29 21:49:36 +00:00
Bryan Tong Minh
145775132b Add a function to require one and only one parameter of a list. 2008-08-29 21:09:18 +00:00
Roan Kattouw
f35031994a Fix fatal error caused by missing comma 2008-08-27 16:40:29 +00:00
Bryan Tong Minh
a9fd7beaef * Fixup validation methods in UserEmailForm a bit so that they don't return arrays when it's not necessary.
* Add email errors to the API's message map
2008-08-27 13:36:39 +00:00
Roan Kattouw
34a22d81f5 API: Improvements to action=emailuser:
* Add two messages from ApiEmailUser to ApiBase::$messageMap
* Add email tokens to prop=info
2008-08-26 21:34:47 +00:00
Roan Kattouw
1d3b95ab8d API: Throwing a more specific error message when the client tries to create empty new sections, which isn't allowed. Unknown error: ``228'' isn't very user-friendly. 2008-08-26 20:40:44 +00:00
Roan Kattouw
5331e82bd5 API:
* (bug 15048) Added limit field for multivalue parameters to action=paraminfo output.
* When the limit on multivalue parameters is exceeded, a warning is issued
2008-08-05 16:32:28 +00:00
Chad Horohoe
dc91b3b12d Badaccess-group1/2 no longer exist. 2008-08-05 14:44:00 +00:00
Roan Kattouw
042a034033 API: Add nocreate parameter to action=edit 2008-06-15 20:37:28 +00:00
Roan Kattouw
8b86f3bc01 (bug 14459) Added prependtext and appendtext parameters to action=edit 2008-06-12 13:05:07 +00:00
Roan Kattouw
cf5484e56f API: Added optional md5 parameter to action=edit. If set, the edit will only be committed if the MD5 hash of the text parameter equals the md5 parameter. 2008-05-28 09:22:40 +00:00
Roan Kattouw
d478350295 * Refactor Title::isValidMoveOperation() and Title::moveTo() to return an array of arrays like Title::getUserPermissionsErrors() does; other functions used by the write API have undergone similar refactoring earlier
* Handle these return values in MovePageForm::doSubmit() and ApiMove::execute()
* Remove separate AbortMove hook calls from MovePageForm and ApiMove; these were used to capture the hook error, but the new return type handles that. Also, it resulted in two calls to that hook for each move
* Remove comment about SpecialMovepageAfterMove hook from ApiMove::execute(): we don't need it, there's the TitleMoveComplete hook for that. SpecialMovepageAfterMove is a UI hook that doesn't belong in the API
* Add imagenocrossnamespace and imagetypemismatch errors to ApiBase::$messageMap
2008-05-27 14:42:51 +00:00
Roan Kattouw
000f346c1b Handle multiple warnings correctly in ApiBase::setWarning(). Calling this function twice from the same module used to throw a fatal error. 2008-05-20 19:43:50 +00:00
Roan Kattouw
119ca6e2ed API: Unrecognized values for multivalue parameters now don't cause the API to abort with an error anymore, but just throw a warning and are ignored. This is useful for ??prop parameters, but also applies to other multivalue parameters such as list, meta and prop. Single values still throw an error like they used to. 2008-05-20 19:31:45 +00:00
Alexandre Emsenhuber
087a9f70c5 WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>

Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage

One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
Victor Vasiliev
8f98402e51 * (bug 13965) Hardcoded 51 limit on titles is too limiting 2008-05-06 05:12:47 +00:00
Aaron Schulz
b76e7e0db0 Put some upper limit here 2008-05-03 04:17:03 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Bryan Tong Minh
06d1b8087d (bug 11673) Return error 'unknown_action' in specified format 2008-04-05 19:32:21 +00:00
Roan Kattouw
07c2553b86 API: Forgot a whole bunch of messages specific to ApiEditPage 2008-03-30 18:59:27 +00:00
Roan Kattouw
b15f80ba74 Remove stray backslash 2008-03-28 16:17:04 +00:00
Roan Kattouw
6090218f2a API: Rename dontcreate to createonly, which actually makes sense 2008-03-25 21:12:01 +00:00
Roan Kattouw
e0a6679e8c Fixing E_NOTICE 2008-03-25 21:01:30 +00:00
Roan Kattouw
6afa8f9d63 API: Adding dontcreate parameter to action=edit 2008-03-25 20:41:55 +00:00
Roan Kattouw
53b7bdb63f API: Added help text message that specifies whether a module is POST-only 2008-03-25 15:47:23 +00:00
Alexandre Emsenhuber
2ed1bedb94 * Fixed call to deprecated functions
* Remove unused global declaration of $wgArticle in SkinTemplate::buildNavUrls()
2008-03-24 15:04:55 +00:00
Aaron Schulz
7389d07057 $value should come in as a string (if it doesn't, trim() will cast it to one anyway). Once trimmed, a truly empty list should be "" not "0". This fixes the massive namespace param breakage. 2008-03-21 06:28:02 +00:00
Victor Vasiliev
3cb5a4f858 Handle empty sets correctly 2008-03-20 16:28:38 +00:00
Roan Kattouw
69653bd247 API: Fixing limit=max output; previous implementation threw fatal errors under certain conditions and didn't accomodate for some modules having different limits in some cases. 2008-02-25 14:12:55 +00:00