Commit graph

55 commits

Author SHA1 Message Date
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
Roan Kattouw
750cc9a535 API: (bug 19271) list=usercontribs reported all pre-April 2008 revisions as new 2009-06-18 08:59:54 +00:00
Jure Kajzer
c3fafd96f7 Added bitwise operations to DatabaseBase and overloaded in DatabaseOracle. 2009-06-13 06:31:38 +00:00
Roan Kattouw
03c8bcb8db Fix up r50600, which had no effect 2009-05-15 10:42:25 +00:00
Chad Horohoe
80f670d1cb Followup to r50423: Check if the row is null, since older revs don't necessarily have rev_len populated. 2009-05-14 20:29:54 +00:00
Roan Kattouw
9c55278c40 API: (bug 18743) Add ucprop=size (enabled by default) to list=usercontribs. Also fix warning from r49732 2009-05-10 09:25:46 +00:00
Roan Kattouw
6f5aa4c078 API: (bug 18554) Also list hidden revisions in list=usercontribs for privileged users 2009-04-22 09:21:33 +00:00
Roan Kattouw
5f0226fd8d API: Fix up r46825:
* put the tables in the right order
* JOIN on user_text as well for better index usage
* Force the index on the recentchanges table as well
* Don't ORDER BY rev_user_text if it's constant
2009-02-09 14:07:18 +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
3a259992fb API: Re-enable ucprop=patrolled and rcshow=patrolled|!patrolled using the timestamp index for the join (thanks to Tim for pointing this out) and a STRAIGHT_JOIN for the inner join case 2009-02-04 23:19:18 +00:00
Roan Kattouw
f68b0a79c1 API: Temporarily disable ucprop=patrolled and ucshow=patrolled|!patrolled because of performance concerns mentioned on bug 17215 2009-02-04 13:16:12 +00:00
Roan Kattouw
9100cdcd03 API: (bug 17069) Added ucshow=patrolled|!patrolled to list=usercontribs 2009-01-19 16:04:33 +00:00
Roan Kattouw
0635eeb4c4 API: (bug 17048) Show the 'new' flag in list=usercontribs for the revision that created the page, even if it's not the top revision 2009-01-19 15:23:12 +00:00
Siebrand Mazeland
c426e6b9d7 Consistent casing for wfGetDB(), getDB(), and getDBKey() 2008-11-06 22:38:42 +00:00
Domas Mituzas
22f8f4ca17 usertext, not user :) 2008-10-28 18:49:00 +00:00
Alexandre Emsenhuber
1cf75c3fb4 Fixes for r42735:
* option's name is USE INDEX
* use the index is user_timestamp (per domas)
* force it on the 'revision' table, not 'page'
2008-10-28 18:42:49 +00:00
Chad Horohoe
efad3a8b76 Use FORCE INDEX here, because Domas said we should :) All hail Domas. 2008-10-28 17:51:38 +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
Alexandre Emsenhuber
018f7d9854 Per Catrope's request, commiting patch on bug 16018:
* (bug 16018) Added uccontinue parameter to list=usercontribs so paging works properly when multiple users are queried or a userprefix is used
2008-10-18 10:14:02 +00:00
Bryan Tong Minh
f2962d36cd * Added flag "top" to list=usercontribs if the user is the last contributor to the page
* Limited API section in RELEASE-NOTES to 80 chars
2008-07-09 11:44:49 +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
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
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
Brion Vibber
7b6fd38bc2 Revert 33072 for now -- changes to ucuserprefix use
Using the user_timestamp index means you can't do an indexed search on the name prefix...
Basically the same as scanning raw on rev_timestamp, but with logged-in edits skipped so you don't scan *quite* as huge an amount of the table.
Since there's no index for the username prefix, the more specific the prefix, the *more* rows you'll have to scan through to fill out the result set, so the worse the performance will get.
2008-04-10 17:18:27 +00:00
Roan Kattouw
3081fa9a57 API: Enhancing ucuserprefix performance
* ucuserprefix now only works for anonymous users. This allows us to add WHERE rev_user=0 (fewer rows to scan) and use the user_timestamp index (so the ORDER BY rev_user_text DESC can be killed)
* ucuserprefix must be an IP containing at least two full octets, e.g. '12.345.', to ensure the resulting LIKE is somewhat sane
2008-04-10 11:57:27 +00:00
Roan Kattouw
c437a3c194 API performance enhancements (bug 13511):
* Replaced $wgAPIUCUserPrefixMinLength with the more generic $wgAPIMaxDBRows
* Added ApiBase::checkRowCount() which checks whether the amount of rows to be scanned is acceptable (i.e. <$wgAPIMaxDBRows). Not using this anywhere (yet?), but it's nice to have
* Killed a filesort in the usercontribs query, query is now indexed nicely
* Dropped the minimum length for ucuserprefix since it's no longer needed (query optimized)
* Removed drnamespace from list=deletedrevs (filesorts 8M rows for drnamespace=0)
* Support multiple orderings in ApiBase::addWhereRange()
2008-03-26 13:43:11 +00:00
Roan Kattouw
aa91ab36c1 API: Adding $wgAPIUCUserPrefixMinLength config variable to close a DOS window 2008-03-03 11:29:49 +00:00
Roan Kattouw
5fba640b14 API: Make spaces in ucuserprefix actually work 2008-03-03 10:08:55 +00:00
Roan Kattouw
93c6d4f251 (bug 13157) Adding ucuserprefix parameter to list=usercontribs 2008-02-26 16:56:08 +00:00
Roan Kattouw
deebcf4a82 (bug 12912) Made list=usercontribs' ucuser a multival. Concretely, this means you can grab contribs for multiple users at once (there is a catch, though, see comments on bug). 2008-02-05 15:40:58 +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
Rob Church
2da601e56b Better variable and method naming 2007-08-13 18:18:18 +00:00
Rob Church
5a5642fa3e * (bug 10902) Unable to fetch user contributions from IP addresses
* `list=usercontribs` no longer requires that the user exist
2007-08-13 18:15:35 +00:00
Yuri Astrakhan
8ca133afff API: Big change: Removed all userCanRead() checks per IRC discussion. Only rvprop=content will now check that the page can be read. 2007-07-14 19:04:31 +00:00
Yuri Astrakhan
8736c04e29 API: fixed timestamp format for 'continue' values 2007-07-09 05:19:07 +00:00
Yuri Astrakhan
fb4a5e0a4f API: Backlink-style queries (backlinks, imageusage, embeddedin) now use ??title parameter instead of titles (support for titles will be discontinued later). 2007-07-06 07:16:38 +00:00
Roan Kattouw
bd2fd5162d API: Adding ucnamespace parameter to list=usercontribs 2007-07-05 15:09:06 +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
6f82fb146b API: Added categorymembers list ability. 2007-06-16 00:39:01 +00:00
Yuri Astrakhan
692c3a1808 API: Security update - deleted rev/rc/log entries are no longer shown. 2007-06-02 03:47:34 +00:00
Yuri Astrakhan
6f6d1f2776 API: recentchanges and usercontribs cleaned up to allow more precise properties selection. Minor security updates. 2007-05-21 04:34:48 +00:00
Yuri Astrakhan
be2df31e64 API: Improved usercontribs module. 2007-05-20 23:41:25 +00:00
Yuri Astrakhan
fea6038271 * API: Watchlist feed allows 'hours' parameter of how many hours to go back 2007-05-19 18:08:36 +00:00
Yuri Astrakhan
1885b601f8 API: fixed bug 9927: usercontribs query does not accept IP address 2007-05-19 04:26:08 +00:00
Yuri Astrakhan
3a5ae24924 * API: Allow for query extensions
* API: User contrib query now uses 'contributions' db group
2007-05-15 03:35:32 +00:00