Commit graph

95 commits

Author SHA1 Message Date
Sam Reed
4c3fba4f60 Followup r83856
Per BRYAN (;P) don't use a conditional parameter, just die if miser mode and prefix set
2011-03-13 22:12:57 +00:00
Sam Reed
2109e5fc4a * (bug 27020) API: Allow title prefix search of logevents (only when not in miser mode)
Won't work on WMF wiki's as miser mode is enabled, but won't show as an available option either
2011-03-13 21:43:20 +00:00
Sam Reed
a5db765083 Fix undefined $p from r83797 2011-03-13 21:33:35 +00:00
Sam Reed
8c6f2012b9 * (bug 27670) Ordering by timestamp (and usage of start and end) isn't as clear in auto generated document, as it is on mw.org
where dir = (newer|older)

Will look at doing (asc|desc)(ending)?
2011-03-12 23:39:15 +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
Roan Kattouw
b81ac8ea52 Improve some of the descriptions added in r68482 2010-12-14 11:47:13 +00:00
Sam Reed
4a0c3d8ff5 Comment return types, some explicit class variable declaration 2010-10-09 00:01:45 +00:00
Sam Reed
3013d5baf6 Few explicit class variable definitions 2010-10-01 11:21:46 +00:00
Sam Reed
63623255e5 r71834, params and desc would be good 2010-08-28 00:57:58 +00:00
Sam Reed
c2a1fe9677 Couple more userid properties for Bug 19195 2010-08-28 00:52:38 +00:00
Alexandre Emsenhuber
457eb73b61 Standardised file description headers, added @file 2010-08-07 19:59:42 +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
Mark A. Hershberger
894f7a21dd follow up r69339: Add a missing setVaryCookie for consistency and to avoid user X with skin Y getting the response marked up for skin B. 2010-07-14 21:00:09 +00:00
Sam Reed
f5c639fd10 Stylize API
Add a few braces
2010-07-06 13:15:59 +00:00
Sam Reed
2d21295243 * (bug 23473) - Give description of properties on all modules
Commit patch by John Du Hart with a few minor tweaks/fixes
2010-06-23 19:36:26 +00:00
Sam Reed
19d004fa66 * (bug 24089) Logevents causes PHP Notice if leprop=title isn't supplied
Patch by John Du Hart

Add a couple of missing braces
2010-06-23 12:34:59 +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
Sam Reed
faf34b4073 Per http://www.mediawiki.org/wiki/Special:Code/MediaWiki/66168#c7252 switch while ( $row = $db->fectchObject( $res ) ) to foreach ( $res as row )
On ApiQueryUsers switch $r to row, and remove nested brackets
2010-06-20 18:48:34 +00:00
Sam Reed
a90a0783de Nuke $db->freeResult() from Api stuffs 2010-06-20 17:48:21 +00:00
Sam Reed
e55ed729c4 Mixture of things.
Couple of class comments

Normalisation of "." usage at end of lines (removed)

Normalisation of {prefix}parameter as per bug 23461
2010-05-11 22:30:18 +00:00
Matthew Britton
fb18f9d8e7 (bug 22868) don't list infinite block expiry date as "now" in API logevents 2010-03-31 14:44:35 +00:00
Sam Reed
8328c6d619 Fixup r63301 as per Roan comment
Still not using an index...
2010-03-06 18:03:05 +00:00
Sam Reed
abe0f5cc07 * (bug 22738) Allow filtering by action type on query=logevent
Needs patrol fixing (but not an api problem)
2010-03-05 23:21:38 +00:00
Jack Phoenix
eba6c94002 API: fix copyright symbol, coding style cleanup, more braces 2010-02-24 14:45:19 +00:00
Sam Reed
1f9a7d791c Implement 9 modules dieUsage errors 2010-02-13 00:48:31 +00:00
Tim Starling
91f1c4c903 Fix for r61957: initialise array variables explicitly. 2010-02-05 04:40:57 +00:00
Sam Reed
aed9f28554 array_flip() as per r61760#c5615 (follow up to r61760) 2010-02-04 18:12:01 +00:00
Tim Starling
6892c5536d Fix for r58399 (missing index on change_tag table), using the patch from bug 22032 by Gurch, but altered to respect $wgOldChangeTagsIndex. 2010-02-03 23:30:19 +00:00
Roan Kattouw
c7e2c70837 Whitespace fixes for r61761, r61779 2010-02-01 15:36:14 +00:00
Sam Reed
f344af3a83 Fix r61760/r61762 2010-01-31 23:09:03 +00:00
Sam Reed
bece7af972 Fix r61760 2010-01-31 23:08:15 +00:00
Sam Reed
c1f6d86274 Finish (bug 18427) Comment (edit summary) parser option for API
Followup to r61747 r61754 (RELEASE-NOTES to cover whole bug)
2010-01-31 23:06:35 +00:00
Sam Reed
c60017bfcb in_array to isset on ApiQueryLogEvents as per (most?) rest of the API 2010-01-31 22:28:27 +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
e5e9095bd6 Fix parse error from r58419 2009-11-03 06:56:29 +00:00
Roan Kattouw
fc92a38146 Redo r58410, r58411 (attempts to to fix r58399) properly: isset vs. !is_null wasn't the problem, it's that the 'tag' parameter wasn't in the parameter list. 2009-11-02 08:29:26 +00:00
Roan Kattouw
1d471caa46 API: (bug 19004) Add support for tags. Patch by Matthew Britton 2009-11-01 10:42:41 +00:00
Brion Vibber
8919302663 Revert r54291 "(bug 19004) Added support for tags to the API. Patch by Matthew Britton."
Per notes on code review, this doesn't handle multiple tags correctly right now.
2009-08-19 17:34:08 +00:00
Bryan Tong Minh
1ac223539e (bug 19004) Added support for tags to the API. Patch by Matthew Britton. 2009-08-03 17:48:01 +00:00
Jure Kajzer
c3fafd96f7 Added bitwise operations to DatabaseBase and overloaded in DatabaseOracle. 2009-06-13 06:31:38 +00:00
Roan Kattouw
c7ca98503a Fix up r47901: don't return the string "true" or "false", be consistent with the rest of the API 2009-03-01 11:02:49 +00:00
Nicolas Dumazet
fe53e8d894 For move logs, log_params can have a "suppressedRedirect" boolean, as a second parameter. Adding support to display it. 2009-03-01 05:13:42 +00:00
Roan Kattouw
1ca568692f Slight fix for r47781: remove useless if($index) conditional: $index is always set and non-false 2009-02-25 14:42:31 +00:00
Aaron Schulz
f0566ab4b6 INDEX use fixes 2009-02-25 04:33:44 +00:00
Roan Kattouw
7b631ca58d API: Add a STRAIGHT_JOIN to list=logevents on Domas's request. Also make an implicit JOIN explicit so the LEFT JOIN still goes against the right table 2009-02-20 21:18:07 +00:00
Aaron Schulz
48993f18f9 Hide title if DELETED_ACTION is on, but don't worry about type/action, which isn't what we're worried about 2009-02-06 14:42:50 +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