Commit graph

140 commits

Author SHA1 Message Date
Sam Reed
232cabd9f8 Followup r68157 and r68161 per Bryans comment (anons aren't in the group user) 2010-06-20 17:30:23 +00:00
Roan Kattouw
a1db76daaf Followup to r68157: simplify ApiQueryUsers::getAutoGroups() 2010-06-17 09:39:07 +00:00
Sam Reed
a5054efc97 Rem whitespace, function comment for r68158 2010-06-17 08:15:56 +00:00
Sam Reed
18227749a6 Minor followup to r68156, add "user" as implicit group
Refactor out and reuse in ApiQueryUserInfo

Add couple more braces to SpecialUserrights
2010-06-17 08:00:42 +00:00
Sam Reed
a19c0eb2a3 * (bug 24009) Include implicit groups in action=query&list=users&usprop=groups
Add some whitespace, fix some braces in ApiQueryUsers

Add a few braces to SpecialUserrights.php, change or to || and and to &&
2010-06-17 07:39:31 +00:00
Jack Phoenix
7ced9bc569 API: fix copyright symbol, coding style cleanup, more braces 2010-02-26 13:18:56 +00:00
Sam Reed
47c24175d3 Add/remove whitelines to increase readability in API code files 2010-01-23 22:26: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
Chad Horohoe
a4e5e935b6 Mass convert NULL -> null. Left strings and comments alone, obviously. 2009-12-11 21:07:27 +00:00
Alex Z
68596ac79c merge most of r56515 back to trunk (changing UserrightsPage::fetchUser to non-static)
Fixing ApiQueryUsers so it should work properly for interwiki users
2009-09-17 16:21:27 +00:00
Roan Kattouw
9e78c71b1e API: Make it possible to fetch userrights tokens for interwiki users; make UserrightsPage::fetchUser() static 2009-09-10 13:44:49 +00:00
Tim Starling
ecaa39d51b Followup to r49056: gender property gives "unknown" when gender option is null 2009-06-03 15:36:44 +00:00
X!
e774395b54 Added usprop=gender to list=users 2009-03-31 03:48:08 +00:00
Roan Kattouw
549b1688cc Redo r48746 (API userrights, reverted in r48909 and r48910) in a way that doesn't break CentralAuth. Basically, this works around PHP's inability (at least in < 5.3) to override static methods by adding a hook. Changes to CentralAuth in next commit. 2009-03-28 19:08:47 +00:00
Andrew Garrett
d4d0329547 Revert r48746 (API userrights). Breaks Special:GlobalGroupMembership by changing overridden methods to static methods, which cannot be overridden. Also reverts r48747, r48814, r48778, r48775 2009-03-27 05:59:42 +00:00
Roan Kattouw
3c52c2c64b * API: (bug 15935) Add action=userrights to the API
* Add ustoken=userrights to list=users
* Move the non-UI part of UserrightsPage::saveUserGroups() to the static and more generic doSaveUserGroups()
* Add a $reason parameter to UserrightsPage::addLogEntry() and make it and its helpers static
* Move UserrightsPage::changeableGroups() and changeableByGroup() to the User class and make the latter static
* In doSaveUserGroups(), drop groups that the user doesn't have from $remove (and those that they do have from $add), and return array($add, $remove)
* Fix up a comment in ApiQueryRecentChanges
2009-03-24 16:04:50 +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
9a7d4c9795 API: Fix up r47470: User::newFromRow() needs all rows from the User table. This kills lots of warnings and really fixes bug 17561 2009-02-21 12:44:41 +00:00
Roan Kattouw
02e968c1c8 API: (bug 17561) Recommit r44231 ("Added usprop=emailable to list=users"), which was accidentally undone by r46845 2009-02-18 22:31:46 +00:00
Roan Kattouw
360f217786 API: Add AS explicitly for PostgreSQL compatibility and fix hinky indentation in ApiQueryUsers. Patch by Brad Jorsch 2009-02-16 19:08:07 +00:00
Roan Kattouw
036351d362 API: Fix yet another regression from r46845 that completely broke list=users. Patch by Brad Jorsch 2009-02-16 17:47:54 +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
56d9fba12d API: Recommit r44182 (Added usprop=canemail to list=users) and rename canemail to emailable 2008-12-04 14:42:30 +00:00
Brion Vibber
77f1ee20d2 Pull back r44182 for now "* API: (bug 16526) Added usprop=canemail to list=users, which tells whether a user can (and wants to be) e-mailed through [[Special:Emailuser]]."
"canemail" is ambiguously named, and on first blush indicates that the user "can email", which would mean that they can *send* email, which doesn't appear to be what it's used for.
2008-12-03 23:37:27 +00:00
Roan Kattouw
1040ce28e4 * API: (bug 16526) Added usprop=canemail to list=users, which tells whether a user can (and wants to be) e-mailed through [[Special:Emailuser]].
* Refactored some code to use a User object
2008-12-03 19:07:16 +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
Rotem Liss
81874262b1 API change: Registration time of users registered before the DB field was created is now shown as empty instead of the current time. 2008-07-25 13:59:24 +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
10274469e5 (bug 14022) Added usprop=registration and auprop=blockinfo 2008-05-09 10:00:34 +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
fa2ac03100 Reverting r34388, DanTMan fixed Database::select() in r34442. 2008-05-08 10:05:32 +00:00
Roan Kattouw
73158bd6de Fixing regression from r34353: using Database::select() for a join messes up in certain cases (puts `s where they don't belong, breaking SQL), but not for all joins. Seems to be related to table aliases, not sure though. 2008-05-07 18:57:06 +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
91ea00eedc (bug 13517) list=users threw fatal error when only invalid usernames are specified 2008-03-26 18:08:58 +00:00
Alexandre Emsenhuber
4f60e33303 setting property svn:keywords Id to api files that don't have it, for use in getVersion() 2008-03-03 19:34:11 +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
a81bd8ad8f API: Splitting of uiuser part of meta=userinfo to list=users, as discussed on the API list. 2008-01-27 20:28:36 +00:00