Commit graph

60 commits

Author SHA1 Message Date
Sam Reed
50b88a5b1b Remove arrays from getDescription where we are only using 1 line 2010-05-25 20:46:09 +00:00
Sam Reed
e55ed729c4 Mixture of things.
Couple of class comments

Normalisation of "." usage at end of lines (removed)

Normalisation of {prefix}parameter as per bug 23461
2010-05-11 22:30:18 +00:00
Sam Reed
0769301e87 Stylize Api upto date 2010-04-17 20:58:04 +00:00
Alexandre Emsenhuber
00ed478a33 Fixed some doxygen warnings 2010-03-07 17:26:23 +00:00
Jack Phoenix
7fa78fefa9 API: fix copyright symbol, coding style cleanup, more braces 2010-02-24 14:00:23 +00:00
Sam Reed
40dd0530f9 Stylize API files 2010-02-13 01:41:37 +00:00
Sam Reed
1f9a7d791c Implement 9 modules dieUsage errors 2010-02-13 00:48:31 +00:00
Sam Reed
b15f2c8c46 Normalise comment usage (# --> //) 2010-01-23 22:52: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
Bryan Tong Minh
859ff802ca API: Expand the thumburl to an absolute url to make it consistent with url and descriptionurl 2010-01-04 11:13:25 +00:00
Roan Kattouw
6d638b24cb API: Handle image redirects properly in imageinfo, based on reports of API requests dying with backtraces on Commons, e.g. http://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&iiprop=user&titles=File:Semaphore_Alfa.svg 2009-09-23 20:55:54 +00:00
Bryan Tong Minh
05336e91ad Unify properties in ApiQueryAllimages, ApiQueryImageinfo and ApiUpload. 2009-08-26 17:30:36 +00:00
Andrew Garrett
106e14ba7e Fix fatals in ApiQueryImageInfo.php where no metadata exists 2009-03-25 13:59:06 +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
Tim Starling
dc40106960 Don't give a warning if there are no files in the page set. 2009-02-18 06:04:09 +00:00
Roan Kattouw
f825c7ba23 API: Page prop=imageinfo by (title, timestamp) rather than using an offset. Suggested by Brad Jorsch. 2009-02-10 19:10: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
bb81750f27 * API: (bug 17326) BREAKING CHANGE: Changing output format for prop=imageinfo&iiprop=metadata to something based on name/value pairs. This means we don't use parts of the metadata in attributes anymore, something that caused invalid XML to be output. For more info on the exact format, see the mediawiki-api mailing list
* Removed the spaces-to-underscores hack in the XML formatter
2009-02-03 16:25:50 +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
Tim Starling
96d89329f3 * Don't force rendering in File::getThumbnail(). The old code (pre-filerepo) required rendering to be forced all the time, the new code is much smarter about when to render and doesn't need rendering to be forced. Forcing rendering causes non-scaler servers to be used for scaling.
* Use File::transform() in the core instead of the deprecated File::getThumbnail().
2008-09-05 04:23:24 +00:00
Bryan Tong Minh
e2564980c3 API: Added iiprop=bitdepth to imageinfo and aiprop=bitdepth to allimages 2008-07-31 20:10:36 +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
Brion Vibber
fdbfd946ef * Fix typo in ApiQueryImageInfo which made mime type query fail to work :)
* Fix ForeignAPIRepo's query to use the corrected parameter to the API
* ForeignAPIFile fixes to use queried mime type if available, and type-safety checks in case some values are missing or funny
2008-05-22 16:25:45 +00:00
Bryan Tong Minh
7715a9a6b7 Add descriptionurl to imageinfo 2008-05-21 13:03:07 +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
Bryan Tong Minh
0204ede45d Forgot to remove one debug statement. 2008-05-20 17:09:59 +00:00
Bryan Tong Minh
06c09e9835 Add RepoGroup::findFiles to efficiently find many files if the repo supports it. Added support for this in ApiQueryImageInfo. 2008-05-20 17:05:57 +00:00
Bryan Tong Minh
bad5057d7d Forgot one $this => self when making ApiQueryImageInfo::getInfo static. 2008-05-20 14:34:19 +00:00
Bryan Tong Minh
28babe0e65 Use ApiQueryImageInfo::getInfo for both ApiQueryAllimages and ApiQueryImageInfo. Should also give some more consistency between the two modules. 2008-05-20 14:32:52 +00:00
Roan Kattouw
168f93e4a8 Unified aiprop and iiprop somewhat by adding iiprop=mime and aiprop=metadata. The size vs. dimensions discrepancy is weird, but won't be fixed for backwards compatibility. Also iiprop has user, comment and archivename because it handles file *revisions*, whereas allimages doesn't. 2008-05-20 09:16:01 +00:00
Bryan Tong Minh
0ef06182c8 As per mailing list: $wgOut->redirect auto expands; File::getFullUrl exists. 2008-05-15 20:55:09 +00:00
Bryan Tong Minh
5a0bc51845 Force output of a full URL in Special:Filepath and ApiQueryImageInfo in case the wiki images are not configured to full urls. (using wfExpandUrl this time) 2008-05-15 20:39:09 +00:00
Brion Vibber
aca1bd92fa Revert r34877 -- duplicates wfExpandUrl() 2008-05-15 19:42:55 +00:00
Bryan Tong Minh
0ea9e36c3c Force output of a full URL in Special:Filepath and ApiQueryImageInfo in case the wiki images are not configured to full urls. 2008-05-15 18:33:12 +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
Bryan Tong Minh
27de29c1f7 (bug 13606) Added archivename to iiprop 2008-04-04 11:49:20 +00:00
Roan Kattouw
a95cd777c7 (bug 12953) prop=imageinfo should only set query-continue when there is only one title; trying to overwrite a previously set query-continue causes a fatal error 2008-02-07 12:21:48 +00:00
Roan Kattouw
0d5b7c3a1d (bug 12875) Adding query-continue to prop=imageinfo. Patch by Bryan Tongh Minh. 2008-02-03 19:03:01 +00:00
Bryan Tong Minh
eb0caaec62 In case the current image is not included return the correct amount of items. 2008-02-02 21:14:45 +00:00
Bryan Tong Minh
2331d7489c Convert size, width and height to int, as before r29981 2008-02-02 16:04:54 +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
Bryan Tong Minh
5b1493c931 ApiQueryImageInfo: Convert sha1 to base16 like before r29981 2008-01-23 20:32:47 +00:00
Roan Kattouw
307264971e API:
* Returning proportions of thumbnailed image
* INTERFACE CHANGE: thumbnail url is now returned as "thumburl" rather than "url"
* Adding RELEASE-NOTES entry that should've been added a couple of days ago
2008-01-22 21:46:29 +00:00
Roan Kattouw
22da621e60 Small fix 2008-01-20 13:22:14 +00:00
Roan Kattouw
01a2ae7561 * Refactoring ApiQueryImageInfo to use new File::loadHistory() interface. No change in user-observed behavior 2008-01-20 13:09:32 +00:00
Roan Kattouw
f0f08ff3f2 API: Adding thumbnailing support to prop=imageinfo 2008-01-18 20:17:26 +00:00
Roan Kattouw
88b441f69a Limiting image history listings to 500 for now. A hard-coded limit sucks, but an alternative isn't really available as the File handling code doesn't allow it (see also bug 12645). Besides, very few image histories are that long. 2008-01-15 21:09:44 +00:00
Roan Kattouw
bd143c2c28 Fixing hinky indentation in ApiQueryImageInfo.php 2008-01-15 20:45:58 +00:00
Victor Vasiliev
0495f90ebb Revert r28215: incorrectly moved files 2007-12-06 18:33:18 +00:00
Renamed from includes/api/query/ApiQueryImageInfo.php (Browse further)