Commit graph

68 commits

Author SHA1 Message Date
Jack Phoenix
604906deb5 API: coding style cleanup, fix copyright symbol, more braces 2010-02-23 12:30:23 +00:00
Siebrand Mazeland
3b9c69c57a Remove debug logging introduced in r62354 2010-02-12 14:09:42 +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
b15f2c8c46 Normalise comment usage (# --> //) 2010-01-23 22:52:40 +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
Siebrand Mazeland
e8a65f9e25 Update break notation to self enclosed and properly spaced 2009-11-14 20:59:15 +00:00
Roan Kattouw
fba3528881 Partial revert of r56602: remove what is probably accidentally committed debugging code. 2009-09-18 14:38:59 +00:00
Andrew Garrett
4c36759b69 Force changedfilter parameter to integer on Special:AbuseFilter.
Resolves bug 20496
2009-09-18 14:30:05 +00:00
Bryan Tong Minh
efd86ed3aa * Add buffering to ApiFormatBase, which allows buffering the result without needing ob_* functions. This is for async downloads, but I couldn't get it to work yet so this commit does not contain the files that actually use the buffering.
* Hide internalhttpsession parameter from web requests
2009-08-28 21:18:39 +00:00
Roan Kattouw
5811f0e274 API: (bug 16422) Don't show help in format=jsonfm unless specifically requested with action=help 2009-04-28 11:42:14 +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
Roan Kattouw
99c28aae22 API: Fix autolinker bug reported by DannyB on IRC: &gt; was included in the URL 2009-02-27 19:36:34 +00:00
Roan Kattouw
7526c937c7 API: More docs, break long lines in docs 2009-02-13 14:13:03 +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
2e6fb0623e API: (bug 17182) Fix pretty printer so URLs with parentheses in them are autolinked correctly 2009-01-31 13:05:12 +00:00
Tim Starling
4daa2dbb6a Don't use getParameter() inside substituteResultWithError(), since it will try to call dieUsage() again if the format parameter is invalid. This fixes the error message for invalid formats, which was broken. 2008-11-14 00:30:34 +00:00
Bryan Tong Minh
35b2c4d391 * (bug 15392) ApiFormatBase::formatHTML now uses $wgUrlProtocols. 2008-08-31 17:11:22 +00:00
Tim Starling
5df0b9bbb7 Like the comment says... dieDebug() instead of wfHttpError 2008-06-10 15:20:22 +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
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
Roan Kattouw
2d69c8b982 API: Don't output error messages caused by display_errors=On when using a non-fm format 2008-03-26 14:01:28 +00:00
Roan Kattouw
30842f073d * (bug 13218) Fix inclusion of " character in hyperlinks
* Using preg_replace rather than ereg_replace in formatHTML() (faster according to php.net)
* Correcting grammatical error in Title::userIsWatching() description
2008-03-02 13:57:56 +00:00
Roan Kattouw
19358606a1 API: Changing all modules' getParamDescription(), getAllowedParams() and getDescription() methods to public. ApiParamInfo needs them, and some versions of PHP threw fatal errors because they were protected. Oddly, other versions didn't (maybe because the caller and the callee have a common ancestor?) 2008-01-28 19:05:26 +00:00
Victor Vasiliev
32ccdc3d5a * Use *bold* and $italics$ highlighting only in API help. It completely breaks formatting on meta=allmessages and no one needs it 2007-12-01 17:37:08 +00:00
Brion Vibber
b61adceeb9 Revert r27581, 27598, 27626
format=raw is an HTML injection machine like action=raw but without any safeguards; it's trivial to create JavaScript exploits which hit at least Internet Explorer.
There's no reason to add a whole new danger point here when you've got machine-readable structure already... please do not add this raw formatter back.
2007-11-19 15:32:06 +00:00
Victor Vasiliev
96940993bd * (bug 11206) api.php should honor maxlag
* Add wfMaxlagError function
* Add MIME type override option for format=raw
2007-11-18 09:37:52 +00:00
Victor Vasiliev
60fc9cb245 API:
* Add format=raw
* Added raw output support to ApiExpandTemplates and ApiRender
2007-11-17 16:45:59 +00:00
Roan Kattouw
61f0d65096 API: Please use <?php tags, as <? tags can be disabled in php.ini 2007-10-30 21:39:10 +00:00
Daniel Cannon
bfcd95c8e5 (bug 11721) API: Use a different title for results than for the help page. 2007-10-24 19:34:29 +00:00
Brion Vibber
a7c34c4c51 Tweak it up a little more -- also unescape the double-escaped quotes and angle brackets to keep the help message legible, but move unescaping down below the XML metaformatting, so the mail samples don't get misformatted as if they were XML elements. 2007-09-19 14:51:02 +00:00
Brion Vibber
fef3b7b3c3 Tweaks to r25923 for my own peace of mind:
* De-escape &amp;amp; to &amp; rather than &amp; to & -- guarantees that we won't leave stray &s around producing invalid or freaky output
* Use == instead of = when comparing... :)
2007-09-19 14:44:50 +00:00
Daniel Cannon
697afaae0f (bug 11296) Introduced special case pretty-printer rendering of the help document, whereby ampersands will not be escaped, which seems to be the only cause ATM of broken links in the help. This is a *temporary* fix while we work on getting a fully-html version of the help complete, but one that should not reintroduce any security vulnerabilities (as the only text that is unescaped is hardcoded into the API). 2007-09-18 22:10:09 +00:00
Brion Vibber
8cde3600cf Reverting r25082:
Do not restore security vulnerabilities to the codebase after a security release.
Especially don't MAKE THEM WORSE IN THE PROCESS.
2007-09-13 19:06:54 +00:00
Daniel Cannon
70710a6bb8 (API) Partial revert of r25742. Escaping all html special characters in the output breaks links that have these special characters in them. 2007-09-11 22:47:27 +00:00
Brion Vibber
1346097566 * (bug 11158) Fix escaping in API HTML-formatted JSON 2007-09-10 21:01:40 +00:00
Rob Church
dcd57754d9 * Introduce wfScript() wrapper around script path generation
* Honour script extension in ApiFormatBase
* Fix up some uses of short open tags, which are discouraged, in ApiFormatBase
2007-07-06 03:41:04 +00:00
Yuri Astrakhan
4247af6c2d API: Documentation cleanup 2007-07-06 02:19:56 +00:00
Yuri Astrakhan
a31d9c9067 API: Minor cleanup 2007-06-29 22:05:30 +00:00
Aryeh Gregor
3293d6aaf2 Oops, one bogus one slipped through. 2007-06-29 01:25:07 +00:00
Aryeh Gregor
a15c419b3d Remove ?>'s from files. They're pointless, and just asking for people to mess with the files and add trailing whitespace. (Yes, I looked over every one and reverted those that were bogus. Slash-enter a million times in less worked well enough, although it was a bit mind-numbing.) 2007-06-29 01:19:14 +00:00
Yuri Astrakhan
cb38c11c84 API: documentation and cleanup. 2007-05-20 23:31:44 +00:00
Yuri Astrakhan
ef219bae7b API:
breaking change: Query watchlist shows flags only when explicitly requested with wlparam=flags, and rc_this_oldid (textid) is no longer accessible
query watchlist cleanup
bug in the integer parameter min/max validation
bug in feed formatting in error handling
some documentation
2007-05-20 10:08:40 +00:00
Yuri Astrakhan
aab4c9d205 API:
* breaking change: Converted a map of revisions into a list of revisions to allow easier json processing (no need to know map keys)
* html formatting now properly links urls ending with a '\n' string (jsonfm)
* regression: fixed allpages to return int instead of string for pageid and ns
* Added: info now returns page length, counter, and a new flag
2007-05-19 20:26:08 +00:00
Nick Jenkins
f9619da3f0 Yet more doc tweaks:
* Add @addtogroup tags to various classes, to try and group conceptually-related classes together.
* Add brief descriptions to various Special pages, thanks to Phil Boswell.
* Moving some docs to be right above the classes they represent, so that they are picked up.
2007-04-20 08:55:14 +00:00
Brion Vibber
2ccfa04784 * (bug 8673) Minor fix for web service API content-type header 2007-01-18 00:01:20 +00:00
Yuri Astrakhan
ed43f714f4 API * better self-description for various modules
* namespace type for parameters
* fixed bug with incorrect ordering in paging
* fixed bug with revisions and watchlist paging
2006-11-03 06:53:47 +00:00
Nick Jenkins
c79b4e9e75 "si" param should be "siprop" in example (si param is ignored). 2006-11-02 02:33:14 +00:00
Yuri Astrakhan
3ec1b5b646 API * simple backlinks module (no redirect resolution yet)
* Cleaned up references
2006-10-25 03:54:56 +00:00
Yuri Astrakhan
eb02c1a87b API * cache expiration control
* Added PHP-serialized & WDDX formats
2006-10-22 23:45:20 +00:00
Yuri Astrakhan
88e42b579b API * Common field output function to simplify result generation
* Recent changes parameters
2006-10-21 08:26:32 +00:00