Commit graph

47 commits

Author SHA1 Message Date
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
Roan Kattouw
167d11a8c3 * API: Listing (semi-)deleted revisions and log entries (with rev_/log_deleted != 0) as well in prop=revisions and list=logevents, with commenthidden/userhidden/actionhidden/texthidden flags where appropriate
* Still honors the paranoia checks added in r46807
* Use $index consistently in ApiQueryLogEvents
* Some whitespace consistency
2009-02-05 11:44:10 +00:00
Roan Kattouw
8fc3724a4a API: (bug 16541) Adding block expiry timestamp to list=logevents output (calculated from the block's timestamp and its duration) 2008-12-04 15:59:26 +00:00
Roan Kattouw
95c67c8df6 Revert part of r44232, accidentally committed too much 2008-12-04 15:55:47 +00:00
Roan Kattouw
7e35fc4b5a API: (bug 16515) Added pst and onlypst parameters to action=parse, which do a pre-save transform on the input 2008-12-04 15:51:39 +00:00
Roan Kattouw
70e0646bf0 API: (bug 16421) Actually do user name normalization in list=logevents. Also fix up User::idFromName so it doesn't think "Talk:Catrope" isn't the same user as "Catrope" 2008-11-22 15:46:36 +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
Tim Starling
c4dd73000a * Fix r41814: totally broken use of empty(), ignores conditions that compare with numeric zero. I've told you before, don't use empty() to test for zero-length arrays.
* Fix r34767: wrong indexes used in ApiQueryLogEvents
2008-10-25 08:13:40 +00:00
Victor Vasiliev
9e7fc0ae21 * (bug 15492) list=recentchanges&rctype=log does't list log action
Patch by Roan Kattouw
2008-09-06 12:18:36 +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
Aaron Schulz
53c5fa4034 log_id here too 2008-05-13 22:18:41 +00:00
Aaron Schulz
232266e2d3 * Totally redo index use.
* log_id is live
2008-05-13 22:17:54 +00:00
Brion Vibber
109a85a063 Disable logevents until it works...
Currently produces very slow queries like the following:
SELECT /* ApiQueryLogEvents::execute SineBot */  log_type,log_action,log_timestamp,page_id,log_user,user_name,log_namespace,log_title,log_comment,log_params  FROM `user`,`logging` FORCE INDEX (times) LEFT JOIN `page` ON ((log_namespace=page_namespace) AND (log_title=page_title))  WHERE (log_type != 'suppress') AND (user_id=log_user) AND log_deleted = '0' AND log_type = 'block' AND log_namespace = '2' AND log_title = '86.53.69.150'  ORDER BY log_timestamp DESC LIMIT 2;
2008-05-13 21:31:27 +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
Aaron Schulz
2007c7be22 Disallow shitty filesort query 2008-04-13 06:39:15 +00:00
Aaron Schulz
cbf29d43dd proper name 2008-04-02 17:43:57 +00:00
Aaron Schulz
5e24e3b85c Add getExcludeClause(), hide items from API too 2008-04-02 07:10:41 +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
Roan Kattouw
28cbc058b4 API: Adding missing description for leprop parameter 2007-12-12 19:30:17 +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
7e655f1116 (bug 10634) Fake out log_id until the column is live on Wikimedia 2007-07-18 21:47:09 +00:00
Yuri Astrakhan
152cafd3c5 API: improved list=logevents - added leprop, decoded some log types 2007-07-15 06:26:41 +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
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
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
cb38c11c84 API: documentation and cleanup. 2007-05-20 23:31:44 +00:00
Yuri Astrakhan
beb5c4c026 API:
* query=images - error when no valid pages
* log - added proper showing of the patrol events
* revisions - code cleanup
2007-05-20 08:34:47 +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
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
Nick Jenkins
f88c771756 The war on redundant ampersand usage!
* Convert "$dbw =& wfGetDB( DB_MASTER );" --> "$dbw = wfGetDB( DB_MASTER );"
* convert "$skin =& $wgUser->getSkin();" --> "$skin = $wgUser->getSkin();"

For the time being have not changed the function definitions of wfGetDB() or User::getSkin() [i.e. they are still both return-by-ref], so as to ensure the interface does not change for extensions [some of which may still be trying to run on PHP4 environments]. However presumably at some point this can be changed too.

Also includes tiny tweak to newlines in parserTests - will show 1 rather than 2 newlines between the "Reading tests from" strings when in quiet mode.
2007-01-22 23:50:42 +00:00
Nick Jenkins
a474761d9a Changing lines like this: "extract( $dbw->tableNames( 'page', 'archive' ) );" to be like this: "list ($page, $archive) = $dbw->tableNamesN( 'page', 'archive' );".
Three reasons for this:
1) It's better for analysis tools [which want explicit variable declaration]
2) It's easier for a human to read, as it's completely explicit where the variables came from [which is something you don't get with extract() ]
3) It makes it easier to find everywhere where a variable is used with search/grep [which you can't currently do with $tbl_page variables from things like: "extract($db->tableNames( 'page', 'revision'), EXTR_PREFIX_ALL, 'tbl');"].

Otherwise, from a functionality/efficiency perspective the two forms should be identical.

By doing this have been able run static analysis over the usages of these variables, thus eliminating 5 unneeded table names from calls, plus removing 3 unused calls entirely, and it just feels subjectively slightly nicer to me.
2006-11-27 08:36:57 +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
Yuri Astrakhan
82f93e6ae1 API * Minor fixes to user contribs and logevents. Paging is still broken. 2006-11-01 15:49:34 +00:00
Yuri Astrakhan
d1c8dbab7e Database: added STRAIGHT_JOIN option for mysql
API: Optimized logevents module query
2006-10-31 21:00:00 +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
88e42b579b API * Common field output function to simplify result generation
* Recent changes parameters
2006-10-21 08:26:32 +00:00
Yuri Astrakhan
10390af521 API * Added rudimentary RC list
* More readable query formulation
2006-10-20 07:10:18 +00:00
Yuri Astrakhan
550c083a18 API
* Removed slow result SanitizeData
* Fixed watchlist feed bug (reported by nickj)
* Fixed HTML formatting bug (reported & fixed by nickj)
* clarified HTML intro message
2006-10-18 05:27:43 +00:00
Yuri Astrakhan
f928f9a6cd API * Better log events info * Added RAW debugging format 2006-10-17 02:01:20 +00:00
Yuri Astrakhan
d7a95b125c * API: logevents query module (incomplete) 2006-10-16 07:19:20 +00:00