Commit graph

1801 commits

Author SHA1 Message Date
Sam Reed
fbe8a15c31 Fix typo in @param comment
Add type to CookieJar

Define $result before loop
2011-03-02 13:07:15 +00:00
Alexandre Emsenhuber
60f1302644 Per Platonides, fix for r82686: make ApiUploadTest work again
Added option request parameter to User::editToken() and User::matchEditToken() and use them where possible from the api.
Also removed $_SESSION usage since it's no longer needed
2011-03-02 12:52:47 +00:00
Sam Reed
573abcbd8c Refactor out the duplication I left with a TODO in r79659 2011-02-27 21:31:47 +00:00
Sam Reed
27ca6b2fa8 Tweak comments, remove some unused stuff.
Explicit definitions, move a few minor bits around
2011-02-27 21:10:11 +00:00
Sam Reed
dcda4332c9 Tweak some documentation
Add some braces

Explicitally define a variable
2011-02-27 00:40:06 +00:00
Bryan Tong Minh
48b63f4bb0 Follow-up r82853: Filter out create restriction from SpecialProtectedPages and Api. Added Title::getFilteredRestrictionTypes() for this purpose. 2011-02-26 16:29:48 +00:00
Sam Reed
66d3616fc6 Followup r82810, r82813, r82814
Only display hidden stuff if any vaguely related property is set
2011-02-25 21:41:19 +00:00
Sam Reed
3f3e6617a4 Fix double indenting 2011-02-25 20:24:08 +00:00
Sam Reed
19e698b82c One minor followup to r82810
return $vals; early, rather than indenting all of the code another level
2011-02-25 20:22:54 +00:00
Brian Wolff
a1eb4a0973 (follow-up r82810) Address Reedy's comments on irc. 2011-02-25 20:16:19 +00:00
Brian Wolff
c09deaa426 (bug 27715) Make imageinfo api module respect revDelete.
This treats metadata and similar properties to be deleted if the file is deleted, since they
are derived from the file, and i know examples of where the file was deleted to hide sensitive
data in exif. Does still show the file size if file is deleted, because that is what is done
in interface. Follows what ApiQueryLogEvents does and outputs userhidden="" if the user cannot
be displayed due to being hidden.

Due to this bug, all the secret oversight cabal info could be visible for images, so probably
should be merged into wmf stuff soon as possible.
2011-02-25 19:51:37 +00:00
Sam Reed
41e7860130 Implement getRequireOnlyOneParameterErrorMessages, to make the error messages requireOnlyOneParameter can throw.
Use in 4 modules for more dynamicness
2011-02-25 19:09:39 +00:00
Sam Reed
41cbdab221 Display userid, and actually put username in user (like usual)
Fix up a bad description
2011-02-25 17:21:34 +00:00
Sam Reed
442bec4f9b Commit stuff from my w/c
Remove white line

Make second if else if (they're opposites)
2011-02-25 16:53:33 +00:00
Sam Reed
20d56c63b3 * (bug 27708) list=users does not have a property to return user id
Add userid to ApiQueryUsers

Move userid in ApiQueryAllUsers before name
2011-02-25 16:19:44 +00:00
Sam Reed
13abc68f16 Refactor code a little bit, save doing redundant checks if known not necessary.
Improves flow a little
2011-02-24 23:03:55 +00:00
Sam Reed
ec07a4fe7b Bit of documentation, explicitness, variable definition 2011-02-24 23:03:00 +00:00
Sam Reed
448ab3b78d Fixup one missed alias rename from r82739 2011-02-24 20:46:45 +00:00
Sam Reed
35296f391f Followup to r82739 (bug 27688)
Remove u1 table aliases
2011-02-24 18:46:12 +00:00
Sam Reed
57923b31fa * (bug 27688) Simplify queries to list user block information
Also expose block expiry information, listed on Users, but not all users

Some minor simplifications to come
2011-02-24 18:43:44 +00:00
Sam Reed
28f7bf1f2b Followup r82727, improve comments, cast return value to bool 2011-02-24 16:00:06 +00:00
Sam Reed
ab408b911d Seems the api edit watch/unwatch wasn't too well tested (after it got poked a lot)
EditPage::commitWatch() unconditionally  does a watch/unwatch...

And multiple watches of a watched page end up with an INSERT IGNORE, so not a big deal
2011-02-24 15:51:51 +00:00
Sam Reed
c6b054661d Normalising API documentation
2 modules list older, newer

7 list newer, older

So changing 2 different to match the 7
2011-02-24 00:52:09 +00:00
Sam Reed
b73c12cf45 * (bug 27616) Add userid of blocked user and blocker to list=blocks
Also tweak comment about "blocking admin". Non admins can block if they have the right... Sooo,  "user" is more appropriate
2011-02-21 19:48:15 +00:00
Sam Reed
67a4be4866 * (bug 27611) list=blocks: Use ipb_by_text instead of join with user table
Save a table join when looking up blocks (yay!)

Minor issue, for blocks where users have been renamed, we get their old name (Not a big deal IMHO)
2011-02-21 19:34:57 +00:00
Sam Reed
14e998aae5 Followup r82509, prefix the code for urlwidth too 2011-02-20 13:59:40 +00:00
Sam Reed
adf3254f47 Remove error duplication in ApiQueryStashImageInfo by using non hardcoded prefix in ApiQueryImageInfo 2011-02-20 13:51:24 +00:00
Sam Reed
7c02dc5f13 Per comment on r82477, update output for prop=statimageinfo 2011-02-20 13:50:15 +00:00
Sam Reed
7906fde17e * (bug 27554) Update api information text to reflect change in bug 26125 2011-02-19 19:52:08 +00:00
Sam Reed
fa64025161 More parameter documentation 2011-02-19 00:30:18 +00:00
Sam Reed
5db6b7ab5c * (bug 27479) API error when using both prop=pageprops and prop=info&inprop=displaytitle
Followup r75282

Patch by Brad Jorsch
2011-02-16 23:38:21 +00:00
Bryan Tong Minh
a65582f4e8 Follow-up r82049: Fix strict comparison because MediaHandler::parseParamString() is not guaranteed to use intval() on the width and height parameters.
Add __METHOD__ to wfDebug() call.
2011-02-13 20:38:05 +00:00
Sam Reed
3721e827ac * (bug 27376) when using ApiBase::PARAM_TYPE => 'integer' without a min or max value, api doesn't validate the input is actually an integer
Fixup some space indention
2011-02-13 17:00:47 +00:00
Brian Wolff
fc5df5e52d (follow-up r81558) Per suggestion, make this use media handler's getParamString/parseParamString
Additionally, rename makeThumbParam back to getScale since that makes more sense now.
Also update the version number used in ForeignAPIRepo user-agent, since this is kind of significant change.
2011-02-13 07:30:49 +00:00
Bryan Tong Minh
0680ff6df2 Follow-up r81971: Can't use $this->setWarning() in static context, so append the error to the imageinfo array instead 2011-02-12 14:49:34 +00:00
Bryan Tong Minh
de9b4fb463 Follow-up r81971: Fix error handling 2011-02-11 15:42:28 +00:00
Bryan Tong Minh
290e4486a6 * (bug 27199) Thumbnail urls can be fetched for old files as well 2011-02-11 15:40:39 +00:00
Bryan Tong Minh
b6688f5b02 Follow-up r81558: Only raise a warning if no image handler could be found 2011-02-11 15:31:52 +00:00
Bryan Tong Minh
db7a518a4f Follow-up r70137: Unconditionalize the asyncdownload params and throw asynccopyuploadsdisabled if async is requested without $wgAllowAsyncCopyUploads. 2011-02-10 18:24:19 +00:00
Alexandre Emsenhuber
1fb56df473 Added "context title" to replace $wgTitle, current behavior unchanges, but added a comment that this might change in the future to completely remove $wgTitle usage in EditPage
Also removed null check on showEditForm() since $wgTitle is set on ApiEditPage.php, so it won't catch anything
2011-02-10 17:08:37 +00:00
Bryan Tong Minh
960130837c (bug 25832) query=allimages now outputs ns/title as well 2011-02-10 15:20:47 +00:00
Sam Reed
521044a529 Explicitally define $fld_rights on all code paths 2011-02-09 22:42:26 +00:00
Alexandre Emsenhuber
195eafd6ef * Add a amtitle param to meta=allmessages
Only used used when amenableparser is passed; the user can now define the page used for {{PAGENAME}} and related stuff instead of being hardcoded to "API"
2011-02-09 15:19:45 +00:00
Platonides
24fa8b42c2 Unused globals 2011-02-08 22:10:34 +00:00
Platonides
8ce7093775 Use of undefined constant h in line 250. Follow up to r81558 2011-02-08 22:08:58 +00:00
Sam Reed
41c35b3aa4 * (bug 27205) aiprop=metadata and aiprop=parsedcomment need help text
Refactored code out to reduce duplication (and hence, mismatches like this)
2011-02-06 23:59:03 +00:00
Daniel Friesen
1455b81f0c Kill off Linker::getExternalLinkAttributes. 2011-02-05 23:06:36 +00:00
Daniel Friesen
a605c35109 Followup r81569, kill the wfDeprecated for now till we can actually get rid of the use of languagesHtml. 2011-02-05 20:25:17 +00:00
Daniel Friesen
d77e4ff0c6 Followup comment to r81507. The api is using a legacy langlinks method no modern skin uses. Deprecating this and giving it it's own langlinks generation so that the api will be unaffected by anything we do to legacy skins. 2011-02-05 20:16:42 +00:00
Brian Wolff
ec2af084d2 (bug 26548) Make multi-paged documents (PDFs) work with ForeignAPIRepo (aka InstantCommons).
This adds a new parameter to the query=imageinfo (and query=stashimageinfo) that takes rendering
parameters other than width and height. This could be page for pdf's and DjVu, or thumbtime for ogg's, etc.
Syntax is &iiurlparam=param1=value1|param2=value2|... I'm not sure if that really fits with the normal way
of doing things in the api, but couldn't think of anything better since the parameters are arbitrary.

I also noticed that some of the pre-existing error codes in query=imageinfo seem to duplicate the module prefix. I'm
not sure what the deal with that is, but i did not follow that example in the new error codes i introduced.

Note: In order for this to work, both the foreign repo and the local wiki have to be running this code.
2011-02-05 08:49:48 +00:00
Alexandre Emsenhuber
edb12d7aac * Use wfMessage() instead of wfMsgGetKey()
* Don't play with $wgLang, pass the Language object to the Message object
* Bug fix: when 'enableparser' is passed without 'args', $1 is no longer replaced by an empty string (the default value on line 92 of the file was null instead of array(), making wfMsgExt() think that this was the value of $1 and thus this was replaced)
2011-02-03 17:30:14 +00:00
Roan Kattouw
f9942180cb Fix regression in r81124, causing &pst to be ignored for the purposees of actually parsing wikitext 2011-02-02 19:16:05 +00:00
Sam Reed
32eb80c15c A few return type hints 2011-01-30 08:16:13 +00:00
Roan Kattouw
56aa533a61 Implement prop=wikitext in action=parse, (optionally) returning the original wikitext. Requested by some Google folks wanting to get data about a revision in one request. 2011-01-28 01:47:08 +00:00
Roan Kattouw
809ab03c48 Add the resolved URL of each langlink to the API's action=parse output 2011-01-28 01:09:47 +00:00
Bryan Tong Minh
9fff147a37 Make the UploadStash repo specific by creating FileRepo::getUploadStash(). In practice this will probably not be used and makes getting an UploadStash object slightly more type work, but I think it is cleaner to have an upload stash explicitly bound to a repo. 2011-01-25 21:26:53 +00:00
Bryan Tong Minh
fe8d16bda9 Follow-up r69233: use getDbKey() instead of getText() for special pages. 2011-01-23 20:19:04 +00:00
Sam Reed
a52f1eef80 * Expose list of skins in meta=siteinfo 2011-01-23 02:05:26 +00:00
Zak Greant
6b8cbcdd11 Make paraminfo output examples along with parameter information. 2011-01-21 23:12:51 +00:00
Roan Kattouw
e94830540e Various fixes for API category changes:
* Followup r80326: clarify description of type property
* Fix r80355: need to use addWhereRange() for the static ORDER BY on cl_type as well, to make sure it flips direction when needed (mixed-direction multi-field ORDER BYs are not indexed)
* Followup r80358: use current not previous value for cl_from, and use >= instead of > . This is the way continues are normally done
* Followup r80362: clarify description for sortkeyprefix property
2011-01-19 00:13:20 +00:00
Sam Reed
44d605d5c3 Fix spaes from r80362 2011-01-15 00:50:48 +00:00
Sam Reed
610c943cd2 Last bits of bug 24650 Fix API to work with categorylinks changes
Allow optional output of cl_sortkey_prefix (will anyone needed it, no idea)
2011-01-15 00:10:57 +00:00
Sam Reed
569b833ad2 More for bug 24650. Update continue to be usable unique thing 2011-01-15 00:00:25 +00:00
Sam Reed
4106d51063 Bye bye filesorts. Making order by cl_type, and then addWhereRange adds cl_sortkey, cl_from to this ORDER BY 2011-01-14 23:45:20 +00:00
Sam Reed
bbd8f041a5 Bleh, didn't press save again (r80350) 2011-01-14 23:24:25 +00:00
Sam Reed
82aaf647cb More query reorganisation, in an attempt to be index friendly 2011-01-14 23:20:42 +00:00
Sam Reed
d89ed3f20b Fix indenting, rearrange some where statements 2011-01-14 22:37:12 +00:00
Sam Reed
d6c5ef7a5d Remove ancient comment, collapse if, move USE INDEX into if further down doing the exact same 2011-01-14 21:24:42 +00:00
Sam Reed
cab22980ed Followup r80324, add type property description 2011-01-14 21:15:12 +00:00
Sam Reed
cd98ba161a Start of bug 24650 Fix API to work with categorylinks changes
Addition of a type field for filtering (default is "all" ie no filter)

Adding of type to props, to allow it to be outputted
2011-01-14 21:08:08 +00:00
Sam Reed
135d0998b6 Not sure why I originally used array_key_exists(). Switch for isset() 2011-01-12 01:17:31 +00:00
Sam Reed
f3caa365e2 Document return type.
Explicit class member variable definition
2011-01-12 00:29:17 +00:00
Sam Reed
c4b687dc98 initFromQueryResult doesn't use the $db parameter.
Private method, updated callers to not pass it.
2011-01-12 00:24:25 +00:00
Sam Reed
d251f3ddd2 Normalise casing of svn:keywords Id
Add missing Id to ApiFormatDump and ApiUpload
2011-01-10 22:36:26 +00:00
Sam Reed
3403f6d2c3 * (bug 26650) Remove $wgAPICacheHelp in favour of $wgAPICacheHelpTimeout 2011-01-10 18:08:54 +00:00
Sam Reed
2616a18522 Widen documentation header also 2011-01-07 03:12:07 +00:00
Sam Reed
981e47d801 Widen api help splitters 2011-01-07 03:04:03 +00:00
Sam Reed
bfd67cf818 Remove some blank lines
Spaces to tabs in ApiBase
2011-01-07 02:53:00 +00:00
Sam Reed
8381c3338b Add some more requireOnlyOneParameter related errors
Remove some duplicated errors
2011-01-07 02:42:16 +00:00
Sam Reed
393f9bceb2 Remove one invalid errors, add 2 that could be returned 2011-01-07 02:29:31 +00:00
Sam Reed
aeca05efd6 More tweaks/comments/fixups per r79455
ApiParse is a mess!
2011-01-06 23:35:59 +00:00
Sam Reed
eec8a1c20f Adding some spaces, and some else block comments (due to length or ApiParse [and as such bug 26534] being duplicated and crappy), to help matching and readability 2011-01-06 23:19:19 +00:00
Sam Reed
2fa350deb2 Fix string concat error in r66150. Also was a bug/notice in TW 2011-01-06 22:06:47 +00:00
Sam Reed
7cd5f82d32 Pass 0 as 2nd parameter of an Article Constructor (2 cases) 2011-01-06 17:06:05 +00:00
Sam Reed
ae29df4914 Fix -rakkaus/#mediawiki-i18n- [06-Jan-2011 16:10:59] PHP Notice: Undefined variable: text in /www/w/includes/api/ApiParse.php on line 295 from r79455 2011-01-06 16:24:49 +00:00
Sam Reed
7ea350c3eb Minor followup to r79649. Rename variables 2011-01-06 00:31:23 +00:00
Platonides
9a5c36d3c1 Unused global 2011-01-05 23:59:04 +00:00
Sam Reed
27c07317c4 * (bug 26480) add a pppageprops param to prop=pageprops 2011-01-05 22:11:39 +00:00
Sam Reed
c5c5092156 Minor code order tweaks in ApiQueryPageProps.
Remove getPossibleErrors, as it adds an error that this module doesn't through
2011-01-05 21:59:05 +00:00
Sam Reed
b7ff4b8b88 * (bug 26484) add a lltitles param to prop=langlinks 2011-01-05 21:51:12 +00:00
Sam Reed
e76859d792 * (bug 26483) add a iwtitles param to prop=iwlinks 2011-01-05 21:28:18 +00:00
Sam Reed
be25e4316d * (bug 26485) add a elextlinks param to prop=extlinks
Refactored some code out of ApiQueryExtLinksUsage

Had to duplicate some code into ApiQueryExternalLinks (Boo). Marked with a TODO to fix it up
2011-01-05 19:45:19 +00:00
Sam Reed
f6c4df5eef Refactor out protocol preperation to ApiQueryExtLinksUsage::prepareProtocols() 2011-01-05 19:28:00 +00:00
Sam Reed
bfce19b61b Followup r79638
If we're ping limited, add a warning as such, and don't bother trying to linkupdate any of the other articles in the output.
2011-01-05 17:57:12 +00:00
Philip Tzou
52bb88d41e Follow r79649 and r79650. Errrr, remove the redundant minus 2011-01-05 16:37:36 +00:00
Philip Tzou
6fe99a3e4c follow r79649, move the in-block assignment outside. 2011-01-05 16:30:10 +00:00
Philip Tzou
233fb62e22 Add fallback languages support for ApiOpenSearch. 2011-01-05 16:21:01 +00:00
Sam Reed
f0cac4fcf1 * (bug 26498) allow LinksUpdate with API
Original patch by Umherirrender. Tweaked to take account of User->pingLimiter() (ie only update links if not limited)

Possible TODO: Error if we are limited? $this->dieUsageMsg( array( 'actionthrottledtext' ) ); seems a bit harsh

Maybe just have a linkupdate="$this->parseMsg( array( 'actionthrottledtext' ) )" in the result? Or something. Definately notification of error to some respect is needed. Just dieing and stopping the whole process is OTT?
2011-01-05 03:31:51 +00:00
Sam Reed
da31774f70 * (bug 26482) add a imimages param to prop=images 2011-01-05 02:52:04 +00:00
Sam Reed
5885c02a1a * (bug 26460) Add support for listing category members by category pageid 2011-01-04 23:59:39 +00:00