Commit graph

96 commits

Author SHA1 Message Date
Jack Phoenix
7ced9bc569 API: fix copyright symbol, coding style cleanup, more braces 2010-02-26 13:18:56 +00:00
Sam Reed
1f9a7d791c Implement 9 modules dieUsage errors 2010-02-13 00:48:31 +00:00
Sam Reed
d2d950d256 Start of blanket coverage of dieUsageMsg in getPossibleErrors
Only basic ones done.

Couple of other modules done manually
2010-02-13 00:09:05 +00:00
Roan Kattouw
e7aeb3f91f API: Support key-params arrays in 'descriptionmsg' in meta=siteinfo&siprop=extensions 2010-01-24 12:11:18 +00:00
Roan Kattouw
72d97f8fea API: (bug 22248) Output extension URLs in meta=siteinfo&siprop=extensions 2010-01-24 10:19:16 +00:00
Roan Kattouw
a94d246f1a Revert r61414 per CR comment: wfTimestampNow() doesn't take a TS_* parameter 2010-01-24 10:05:19 +00:00
Sam Reed
b15f2c8c46 Normalise comment usage (# --> //) 2010-01-23 22:52:40 +00:00
Roan Kattouw
10bafc0edb Followup to r61412: don't use time(), we have our own function for this 2010-01-23 15:05:24 +00:00
Sam Reed
e575b22704 * (bug 22240) - API: include time in siteinfo
Patch by Matthew Britton
2010-01-23 12:37:03 +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
Tim Starling
bd8fffe24d Reverted r58646 as per my comments on bug 20554. 2009-12-01 01:55:04 +00:00
Roan Kattouw
1b89cd274a API: (bug 20554) Expose average slave lag (avglag) as well as maxlag. Patch by Sam Reed. 2009-11-06 14:38:55 +00:00
Chad Horohoe
c319cc8968 (bug 13750) $wgCapitalLinks should be a per-namespace setting 2009-10-09 12:52:16 +00:00
Bryan Tong Minh
b17adbc880 (bug 17809) Add number of users in user groups to meta=siteinfo 2009-07-12 12:10:27 +00:00
Tim Starling
23cfebd3d2 * Introduced a new system for localisation caching. The system is based around fast fetches of individual messages, minimising memory overhead and startup time in the typical case. It handles both core messages (formerly in Language.php) and extension messages (formerly in MessageCache.php). Profiling indicates a significant win for average throughput.
* The serialized message cache, which would have been redundant, has been removed. Similar performance characteristics can be achieved with $wgLocalisationCacheConf['manualRecache'] = true;
* Added a maintenance script rebuildLocalisationCache.php for offline rebuilding of the localisation cache.
* Extension i18n files can now contain any of the variables which can be set in Messages*.php. It is possible, and recommended, to use this feature instead of the hooks for special page aliases and magic words. 
* $wgExtensionAliasesFiles, LanguageGetMagic and LanguageGetSpecialPageAliases are retained for backwards compatibility. $wgMessageCache->addMessages() and related functions have been removed. wfLoadExtensionMessages() is a no-op and can continue to be called for b/c. 
* Introduced $wgCacheDirectory as a default location for the various local caches that have accumulated. Suggested $IP/cache as a good place for it in the default LocalSettings.php and created this directory with a deny-all .htaccess.
* Patched Exception.php to avoid using the message cache when an exception is thrown from within LocalisationCache, since this tends to fail horribly.
* Removed Language::getLocalisationArray(), Language::loadLocalisation(), Language::load()
* Fixed FileDependency::__sleep()
* In Cdb.php, fixed newlines in debug messages

In MessageCache::get(): 
* Replaced calls to $wgContLang capitalisation functions with plain PHP functions, reducing the typical case from 99us to 93us. Message cache keys are already documented as being restricted to ASCII.
* Implemented a more efficient way to filter out bogus language codes, reducing the "foo/en" case from 430us to 101us
* Optimised wfRunHooks() in the typical do-nothing case, from ~30us to ~3us. This reduced MessageCache::get() typical case time from 93us to 38us.
* Removed hook MessageNotInMwNs to save an extra 3us per cache hit. Reimplemented the only user (LocalisationUpdate) using the new hook LocalisationCacheRecache.
2009-06-28 07:11:43 +00:00
Roan Kattouw
b6acef6319 Remove unused global left in r51727 2009-06-11 09:05:47 +00:00
Chad Horohoe
83eab2a0ce Per code review: Use Language::getLanguageNames() instead. 2009-06-11 04:49:10 +00:00
Roan Kattouw
72c9341d1d API: (bug 18785) Add siprop=languages to meta=siteinfo 2009-06-07 18:20:01 +00:00
Roan Kattouw
bb54f6c627 API: (bug 18773) Add content flag to siprop=namespaces output 2009-06-07 18:09:57 +00:00
Roan Kattouw
fc32d63609 Fix up r50126: dump $wgDBtype rather than a class name, per CR comment 2009-05-04 07:00:52 +00:00
Roan Kattouw
2e20458e1c API: (bug 18533) Add readonly message to meta=siteinfo output 2009-05-02 14:24:11 +00:00
Roan Kattouw
06687f0d95 API: Add PHP and database version to meta=siteinfo output 2009-05-02 13:35:20 +00:00
Tim Starling
4ba01bff2f Add lots more information to the siteinfo query. Based on the JS variable list. 2009-04-30 05:25:35 +00:00
Chad Horohoe
7748725389 (bug 17795) Make meta=siteinfo respect $wgDisableCounters. 2009-03-05 13:52:14 +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
8c813c3c92 Redo r47313 in a more readable way (probably more efficient too) by not using all those array_* functions 2009-02-16 12:19:29 +00:00
Roan Kattouw
37070d2e5a API: (bug 17502) meta=siteinfo&siprop=namespacealiases no longer lists namespace aliases already listed in siprop=namespaces 2009-02-16 11:20:58 +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
2b6314c9c4 (bug 17327) Normalize API help texts: remove quotes 2009-02-02 23:17:07 +00:00
Roan Kattouw
06b5d0f9d5 API: (bug 17224) Add siprop=rightsinfo to meta=siteinfo. Modified patch by Brianna Laugher 2009-01-31 15:56:52 +00:00
Roan Kattouw
383d826b0f Revert r46138 (Get $wgLegalTitleChars through API) per comments on CodeReview and Bugzilla (bug 17024) 2009-01-27 13:10:16 +00:00
Roan Kattouw
2e5e8808b4 API: (bug 17024) Added legaltitlechars field to meta=siteinfo&siprop=general output, which contains the value of $wgLegalTitleChars 2009-01-24 13:16:24 +00:00
Brion Vibber
5b8a7db0c4 Revert r45810 "API: (bug 17027) Allow all configuration variables in $wgAPIReadableConfigVars to be read through meta=siteinfo&siprop=configvars. I tried my best to only make useful stuff readable and skip stuff that's sensitive (like $wgDBpassword), available already (like $wgExtraNamespaces) or useless (like $wgUpdateRowsPerJob)."
This is way too tightly coupled to internal implementation details. Any and all of those things could change dramatically; they're not appropriate for an external API.
2009-01-20 22:57:05 +00:00
Roan Kattouw
b8d66efbb1 Followup to r45810: remove unused global declaration 2009-01-16 21:10:02 +00:00
Roan Kattouw
d161831223 API: (bug 17027) Allow all configuration variables in $wgAPIReadableConfigVars to be read through meta=siteinfo&siprop=configvars. I tried my best to only make useful stuff readable and skip stuff that's sensitive (like $wgDBpassword), available already (like $wgExtraNamespaces) or useless (like $wgUpdateRowsPerJob). 2009-01-16 21:03:13 +00:00
X!
97da594444 (bug 17025) Add "fileextension" parameter to meta=siteinfo&siprop= 2009-01-14 22:15:50 +00:00
Roan Kattouw
2584890446 Fix up r44860, use $wgContLang instead. 2008-12-20 23:49:16 +00:00
Roan Kattouw
25bf90b363 API: (bug 16726) siprop=namespacealiases should also list localized aliases 2008-12-20 23:20:15 +00:00
Roan Kattouw
cc98ce259b API: Fix up r44676: convert underscores to spaces in canonical names. 2008-12-18 15:00:07 +00:00
Brion Vibber
2f1cee5b91 Cleanup r44683 -- fix E_NOTICE bug in MWNamespace::getCanonicalName() instead of replicating the function. :)
(Also note -- using MWNamespace instead of Namespace for PHP 5.3 compat.)
2008-12-16 23:57:21 +00:00
Alex Z
ddde44606b Fix for r44676, fix E_NOTICE from having no canonical name associated with a namespace (ns 0), move RELEASE-NOTES entry to API section and clarify. 2008-12-16 19:59:37 +00:00
X!
5bf752ee6a * (bug 16672) Add canonical parameter to meta=siteinfo&siprop=namespaces|namespacealiases. 2008-12-16 17:19:05 +00:00
Chad Horohoe
a8a6844e61 Support extension information in meta=siteinfo. 2008-12-14 22:06:32 +00:00
Brion Vibber
4c54e4016f * API siteinfo query no longer throws an exception for empty sifilter parameter.
The parameter is defined as being one of two values ('local' or '!local'), but comes back as array() if it was specified but empty... which then got overly-strictly checked against 'false', which was used internally for the case where it's unspecified, and an exception thrown internally.

Now the filter parameter is nicely ignored whether it's unspecified or specified as empty, which is good clear behavior.

As before, other values return a standard API error about invalid values being passed.
2008-11-17 18:13:11 +00:00
Roan Kattouw
d5ed68afaa API: Self-revert r42811 (BREAKING CHANGE: Putting meta=siteinfo output in <siteinfo> element for consistency with every other API module.). On second thought, it's not really necessary. 2008-10-30 14:43:41 +00:00
Roan Kattouw
20dd6fdb02 API: BREAKING CHANGE: Putting meta=siteinfo output in <siteinfo> element for consistency with every other API module. Previously, it was just put in the <query> element, where it doesn't belong. 2008-10-30 14:36:05 +00:00
Roan Kattouw
ced78b9748 API: (bug 16126) Added siprop=magicwords to meta=siteinfo 2008-10-26 13:57:19 +00:00
Roan Kattouw
58ed5d34bf API: (bug 16047) Added activeusers attribute to meta=siteinfo&siprop=statistics output 2008-10-22 12:16:24 +00:00
Chad Horohoe
14a80040bf Deprecate SiteStats::admins() in favor of SiteStats::numberingroup('sysop'). Should make bug 13471 easy. 2008-07-28 15:49:44 +00:00
Victor Vasiliev
ed66838f12 * (bug 14723) Added time zone and writing direction to meta=siteinfo. Patch by MaxSem
* Some random cleanup
2008-07-04 09:21:11 +00:00