Commit graph

68 commits

Author SHA1 Message Date
Jack Phoenix
96b4f302af API: fix copyright symbol, coding style cleanup, more braces 2010-02-24 13:34:11 +00:00
Sam Reed
9e44e9295d Fixup spaces to tabs from r62404 2010-02-14 14:29:24 +00:00
Sam Reed
6911358977 Complete dieUsage errors in 6 more Api files 2010-02-13 01:05:14 +00:00
Sam Reed
2081a0693f Rest of dieUsageMsg in getPossibleErrors 2010-02-13 00:28:27 +00:00
Sam Reed
8761fef623 Stylize.php on API 2010-01-31 21:21:46 +00:00
Roan Kattouw
39a50765c5 API: Document the behavior added in r61447 2010-01-24 10:10:00 +00:00
Sam Reed
ed02427598 minor followup to r61447, moving commment 2010-01-24 00:14:21 +00:00
Sam Reed
3f9621dfd1 * (bug 22245) blfilterredirect=nonredirects in blredirect mode wrongly filtering
If filterredir == 'nonredirects', only filter if !redirect
2010-01-23 23:32:15 +00:00
Sam Reed
b739e97341 More of r61437 (adding/removing whitespace) 2010-01-23 22:47:49 +00:00
Sam Reed
01e257cbd5 Normalise check for filterredir in Allpages to that of backlinks
Add a couple of blank lines
2010-01-23 21:28:27 +00:00
Sam Reed
9edf60de0f filterredir is mutually exclusive (one value)
Change 2nd if for else if in both 1st and 2nd queries
2010-01-23 21:25:25 +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
Roan Kattouw
73560aeb2c API: Do a STRAIGHT_JOIN in ApiQueryBacklinks's first query to counter a MySQL 4 bug where the optmizer chooses to do a table scan on page instead. 2009-08-27 14:58:19 +00:00
Siebrand Mazeland
8e23949bee Proper casing for getDBkey() 2009-05-24 08:29:10 +00:00
Roan Kattouw
c3096d8ac6 API: (bug 18601) generator=backlinks returns invalid continue parameter. Patch by Brad Jorsch 2009-04-27 14:09:47 +00:00
Roan Kattouw
555f84e41a API: Change Image: to File: in examples 2009-03-09 10:44:34 +00:00
Roan Kattouw
88f35cdf6e API: Some cleanup
* Aggressively intval() numeric things; addresses the concerns raised on bug 11633
* Use ApiQueryBase::addTitleInfo() everywhere
* Remove a drug-induced-looking line from ApiQueryWatchlist.php
2009-02-27 16:03:01 +00:00
Roan Kattouw
b2503c70ab API: (bug 17563) Fix regression from r46845 that changed the output for list=backlinks to use page IDs as array indexes instead of 0,1,2,... (which makes a big difference in JSON and breaks clients) and caused weird output for generator=backlinks as well. Patch by Brad Jorsch 2009-02-19 21:24:28 +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
37ebf53907 Explain why this code doesn't use LinkBatch. 2009-01-24 13:10:30 +00:00
Roan Kattouw
32042c271f API: (bug 16483) Kill filesort in ApiQueryBacklinks caused by missing parentheses. Building query properly now using makeList() 2009-01-24 13:00:43 +00:00
Bryan Tong Minh
24a930a13e Force the use of the PRIMARY key rather than the name_title in the second query. 2009-01-08 22:02:16 +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
Ilmari Karonen
34fb6297cd Step 2 in NS_IMAGE -> NS_FILE transition (bug 44) (WARNING: huge commit).
This is a global search and replace of NS_IMAGE and NS_IMAGE_TALK with NS_FILE and NS_FILE_TALK respectively in all core files, excluding those already updated in step 1 (r44004).
2008-12-01 17:14:30 +00:00
Bryan Tong Minh
0e5ad9bbde Allow easier debugging of this module by distinguishing between the two queries 2008-11-28 11:36:04 +00:00
Siebrand Mazeland
c426e6b9d7 Consistent casing for wfGetDB(), getDB(), and getDBKey() 2008-11-06 22:38:42 +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
a901d184dd API: * Fix up r42471 which hardcoded pl_from instead of using $this->bl_from
* Fix the second half of bug 16076 (using pl_from>=123 in combination with multiple values for pl_namespace and pl_title causes filesort)
* By pure accident this fixes a bug about list=backlinks&blredirect dropping results under obscure conditions
2008-10-24 22:22:40 +00:00
Roan Kattouw
31cf2fef2d API: Partial fix of bug 16076: use pl_from instead of page_id in list=backlinks query. The two are equal because of the JOIN clause, but pl_from is indexed whereas page_id isn't (MySQL 5 automatically rewrites this, 4 doesn't) 2008-10-24 18:54:02 +00:00
Roan Kattouw
309e57fd4a API:
* BREAKING CHANGE: list={backlinks,embeddedin,imageusage} now return an array with keys 0, 1, 2, ... (list) rather than an array with pageIDs as keys (hash table/associative array) for consistency with other list= modules.
* Attempting to fix an error about "Invalid title ``''" (i.e. empty string as title) I encountered at Wikipedia.
2008-08-19 15:05:29 +00:00
Roan Kattouw
268f78e083 API: More cleanup:
* Cleaning up some comments
* Breaking the description for iiurlwidth in two lines
* Clarifying the descriptions for amfilter and amlang
2008-07-10 14:28:09 +00:00
Bryan Tong Minh
a250de2567 (bug 14526) Unescaped SQL in list=backlinks 2008-06-13 13:22:50 +00:00
Roan Kattouw
b3ba069578 Please use standardized error messages here 2008-06-12 11:43:15 +00:00
Aaron Schulz
f030fc2995 Tweak error messages 2008-06-05 00:00:07 +00:00
Aaron Schulz
966352ed2f '0' is a title 2008-06-04 23:44:13 +00:00
Aaron Schulz
d808746a74 Title may come in as an empty string, which is not null, so the previous fails and lets a bad title slip in, which can make errors 2008-06-04 23:24:25 +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
Roan Kattouw
5b8213e9ef * Re-applying r34449, r34500 and r34518 which Brion reverted by accident
* Adding ApiQueryBase::addJoinConds() as wrapper for Database::select()'s $join_conds parameter
* Migrating query modules to addJoinConds()
* Using implicit join rather than INNER JOIN in ApiQueryBacklinks
* Using FORCE INDEX (times) on logging table in ApiQueryLogEvents; although MySQL 4 seems to pick this index automatically (evidenced by the fact the WMF servers are still alive), MySQL 5 doesn't and filesorts
* Replacing LEFT JOIN with implicit (inner) join in ApiQueryContributions: revisions without a corresponding page table entry shouldn't be shown anyway
2008-05-10 10:49:26 +00:00
Brion Vibber
4bc02c88ca Revert to r34430 in order to revert r34431 which is breaking the site (unindexed filesorts) 2008-05-09 18:00:15 +00:00
Roan Kattouw
dee7ab1a1a (bug 14021) Removing titles= support from list=backlinks, has been obsolete for ages (since July 2007) 2008-05-09 14:44:32 +00:00
Roan Kattouw
b7d460aaeb API:
* Added ApiQueryBase::addJoin() which provides a cleaner interface to construct JOIN queries. Behind the scenes this still uses the old, ugly way, but it'll be easy to rewrite when/if the Database class gets its own function for JOINs
* Used addJoin() in query modules where necessary
* Removed FORCE INDEX (rc_timestamp) from ApiQueryRecentchanges: it's nigh impossible to integrate with addJoin() and it doesn't seem to be necessary anyway (my MySQL instance automatically chooses rc_timestamp)
2008-05-08 12:33:20 +00:00
Roan Kattouw
418effe71e E_NOTICE 2008-04-22 18:43:22 +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
7e5449b4d2 API:
* (bug 13418) Disable eiredirect because it's useless (see also Bugzilla)
* (bug 13419) Make gblredirect actually work
2008-03-18 19:31:02 +00:00
Roan Kattouw
ec4342599a API: Rewriting ApiQueryBacklinks big time. Implemented blredirect and cleaned up continue parameter handling and generation, among other things. 2008-02-25 14:32:57 +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
0495f90ebb Revert r28215: incorrectly moved files 2007-12-06 18:33:18 +00:00
Victor Vasiliev
4e4cdf079e Create includes/api/query for Query API and includes/api/edit for Edit API 2007-12-06 18:22:15 +00:00
Brion Vibber
f6c8f40f96 Fix regression from r26954 -- caused non-empty data sets to *fail* to render, in addition to making empty data sets render. :) 2007-11-16 22:50:59 +00:00
Daniel Cannon
ea107b7d00 (bug 11588) API: Preserve document structure for empty dataset in backlinks query. (typo fix) 2007-10-26 03:59:16 +00:00