Commit graph

2860 commits

Author SHA1 Message Date
Aaron Schulz
c61d48f87e Stop spamming exception log with random upload stash failures
* Things like authorization and validation problems do not belong in the
  exception log.

Change-Id: I3c4c1bab65cfe9111dc2161bda6d023234112900
2013-06-25 16:10:42 -07:00
jenkins-bot
6e7286ccac Merge "Improve help text for list=alllinks and alltransclusions" 2013-06-24 17:45:20 +00:00
jenkins-bot
cea6e75464 Merge "API: Fix imageinfo iiurlheight on audio files" 2013-06-24 17:15:43 +00:00
Brad Jorsch
0f09d8ed27 API: Fix imageinfo iiurlheight on audio files
When iiurlheight is given without iiurlwidth, we want to limit the
thumbnail by just the height. MediaWiki's file classes don't really
support this, though, so we pass the image's full width as the limiting
width to achieve the same effect.

However, this fails for audio files where $file->getWidth() returns 0,
but we can still get a thumbnail of a placeholder image. In that
situation, we should just choose an arbitrary non-zero limiting width.

Change-Id: I4318a06a96265d39e39e90cc706d49a1c3b6e8e3
2013-06-24 12:12:52 -04:00
umherirrender
772918db60 Capitalize URL in api help
As part of bug 34965

Change-Id: Ia1df9748b5de33f6ef5088103ccc6b886f9a17d5
2013-06-21 23:32:28 +02:00
umherirrender
0220705fa7 Improve help text for list=alllinks and alltransclusions
This patch set changed some
- "link titles" to "linked titles"
- "transclusion titles" to "transcluded titles"

Change-Id: If536368e95ca5e160d8a69e832e67e3248b787fd
2013-06-21 23:17:07 +02:00
Brad Jorsch
c94454687f Return errors from WatchAction
Currently, WatchAction::doWatch and WatchAction::doUnwatch return true
always. Let's have them return a status object instead.

This also cleans up the handling of Status objects in some of the API
modules.

Change-Id: I9dd9f0fd499c37f29fa12bcdb6142238a1f11e4d
2013-06-20 15:51:05 -04:00
Brad Jorsch
652cfa803b Improve documentation of action=parse (followup Ie4f7324c)
The documentation for action=parse needs clarification, particularly in
light of the changes made in Ie4f7324c which were too hastily merged.

Also, add the RELEASE-NOTES entry missing from Ie4f7324c.

Change-Id: Ia8847f7e99620a9f7af24956d972c882f78aae26
2013-06-19 10:53:57 -04:00
Niklas Laxström
1104392eba Restore API action=parse&text=foo functionality on wikidata.org
Bug: 48201
Change-Id: Ie4f7324c2a10700e52dadc4facd6b4fe6c76cf48
2013-06-19 11:07:41 +00:00
Brad Jorsch
484770e8d2 API: Fix action=parse without any page or title or text
action=parse was raising an error about missing 'text' with 'title' even
when 'title' wasn't actually passed, due to a fix for bug 33865. But
this broke using action=parse to parse an edit summary without also
giving it wikitext to parse.

Instead, let's give the client a warning (unless it seems clear they
know what they are doing) and assume the empty string for 'text'.

Also, while we're editing the file, add some more examples as also
requested in bug 48319.

Bug: 48319
Change-Id: I03c1fbcb0bd31dea8bd84e164104f7ced0ace449
2013-06-13 20:58:27 -04:00
Brad Jorsch
4134a0b70f API: Fix IPv6 handling in list=blocks
The current handling of the bkip parameter assumes IPv4, and breaks for
IPv6 CIDR ranges (it also isn't working right for IPv6 non-CIDR, but not
in an obvious way).

This rewrite handles IPv6 correctly. It also necessarily adds validation
for the bkip parameter, which would formerly return (not very sensible)
results when passed invalid values.

Bug: 48129
Change-Id: I02471bb32c3a217004d07a79d9f98b62133b31ef
2013-06-13 10:42:32 -04:00
Max Semenik
5d3374f48e Add section preview mode to API action=parse
In https://gerrit.wikimedia.org/r/#/c/67266/, it was enabled automatically
when a section was specified in preview mode. However, this only works for
previews of a saved page's content, failing for user input previews which
might contain several sections of various degrees of nestedness.

Change-Id: I987144e5e315ed9e0a67f599083461a78879c0df
2013-06-13 02:46:04 +04:00
jenkins-bot
986b8b953d Merge "Only show notoken as possible API error once" 2013-06-11 13:40:03 +00:00
Marius Hoch
50faf2138c Allow patrolling pages by revision id
This became necessary as it's quite hard to
get the rc id of a change from the html after
I1e24733c.

Bug: 49259
Change-Id: Ia7d3960cf11bf8ae0fc06ae1a0f7fcfb3c080f21
2013-06-10 20:54:43 -04:00
Marius Hoch
4650adb9b2 Only show notoken as possible API error once
Currently notoken is being listed as possible
API error twice if it's explicitly set as
required parameter and needsToken() returns
true.

See:
https://www.wikidata.org/w/api.php?action=paraminfo&modules=edit

Change-Id: Ia17c5cfa634919b43affa146df0d1dc0ff06b758
2013-06-11 00:03:46 +00:00
umherirrender
c802c5b1ab Remove unneeded parenthesis from warning text in prop=revisions
Change-Id: I8d2ca6a4b7199fa1f4fe3b3e63dbefb2cc273d7b
2013-06-09 12:07:41 +02:00
Max Semenik
d7a61d7223 action=parse now can parse in preview mode
Bug: 49239
Change-Id: Iacfea0219ef21dc91d669f51140ec129c2f41f76
2013-06-06 20:04:40 +04:00
Matthias Mullie
52ecc8d9b5 invalidparammix/missingparam get the module prefix twice
dieUsage will call encodeParamName, which will already prefix the error code with the module prefix

E.g. for ApiViewFeedbackArticleFeedbackv5 (prefix afvf), this error code was
(incorrectly): afvfafvfinvalidparammix. Should be: afvfinvalidparammix

Change-Id: Ia351678b49e96ef58dce773331ebe9a1b3ebf824
2013-06-03 20:23:18 +02:00
Brad Jorsch
55a48577cd (bug 48294) API: Fix chunk upload async mode
I915c1678 fixed single-chunk chunked uploads for the common case, but
didn't store the data for async uploads under the correct filekey. This
fixes that.

Bug: 48294
Change-Id: Idbeab2fd0d801974b610198dcf02c81798f65a0d
2013-05-29 13:32:09 -04:00
umherirrender
2d9b71818f ApiHelp: Avoid header for example, when there no examples
When writing a new extension the source:

	public function getExamples() {
		return array(
			//TODO
		);
	}

would produce a empty "Example:" header on the help page. Avoid this, by
changing the condition to check for truthy instead of false and empty
string.

Change-Id: I67ecacbbac66b97ed96412abf79b49aebe0ebdbf
2013-05-28 15:37:41 +00:00
umherirrender
4a2a94b0d2 Set context when using UserrightsPage
SpecialPage::getContext called and $mContext is null. Return
RequestContext::getMain(); for sanity

Change-Id: Ie0ed360835164e8a4eb1c675ec8edd944ab95898
2013-05-24 15:58:54 +02:00
umherirrender
602b89caf5 Add page language to prop=info
This can be useful to determine the language of a page, for example
javascript has english as page language. MediaWiki pages has it page
language corresponding to the lang code in the sub page.

Change-Id: Idd0412574b314ecf52d92243a3f8a08755474663
2013-05-22 16:33:49 +00:00
umherirrender
ec9296e42f Do not returning external title in ApiPageSet::getRedirectTargets
Having a page with a redirect to "en:Main Page" will be added as "Main
Page" to the output, that is wrong

http://test.wikipedia.org/w/api.php?action=query&titles=Redirect%20to%20interwiki%20page&redirects

Change-Id: I7b59f592c1293dbb96f4c4279201bf04fcfea29d
2013-05-22 14:04:19 +00:00
csteipp
4233341283 SECURITY: Do checks on all upload types
Also, verify file before stashing it

Change-Id: Ib2474cb778d53959a4f479e53d0392f916b18d83
2013-05-21 13:20:06 -07:00
jenkins-bot
f22f809192 Merge "Add helpurls to some api modules" 2013-05-17 14:42:54 +00:00
Brad Jorsch
810879a349 (bug 47216) API: indicate default and skipped skins in meta=siteinfo
action=query&meta=siteinfo&siprop=skins can easily indicate which of the
returned skins is the default and which are unusable (e.g. because
they're listed in $wgSkipSkins). So we may as well do so.

Bug: 47216
Change-Id: Ib4ea5fe85e1b02895dba15f3a245c7a7d8724470
2013-05-17 09:51:18 +10:00
umherirrender
5da19f4b3a Add helpurls to some api modules
Change-Id: I41cc20ea5daf089e5fb26d1548d3b58cfe5f4d31
2013-05-16 09:08:18 +02:00
umherirrender
9d690a51c4 Fix badcontinue in possible errors of paraminfo
Badcontinue results in
<error code="unknownerror" info="Unknown error: &quot;badcontinue&quot;"
/>
because there is one array deep too much.

Change-Id: Iff88c3864f65e5da6cd31594396dffdaa71b5593
2013-05-16 08:55:39 +02:00
Timo Tijhof
4bd5471ca3 docs: Remove odd colons after @todo
Most were this way already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html

Ran a find/replace on the odd ones. Also made them all
lower case.

Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
2013-05-15 06:23:40 +00:00
Timo Tijhof
176c5354bb docs: Consistently use "since" phrasing in @deprecated
Most have it already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/deprecated.html

Ran a find/replace on "@deprecated \d" to fix the odd ones.

Change-Id: I5217aaf75264a0036b5426cd8536116b4bb8f535
2013-05-15 00:56:57 +00:00
Brian Wolff
8c328d030f Add identifying info (img_timestamp and img_sha1) to upload log.
I came across people complaining that it was hard to associate
upload log events to actual images since img_timestamp could
be different from log_timestamp, and generally no unique id.

Well I was there I made uploads use the new logging system.

Change-Id: Icd8662ecb9eb0f6c0ff9841bdbd5736d6dd0d015
2013-05-10 21:10:49 +00:00
jenkins-bot
d5bd4f6e61 Merge "Change EXIF to Exif" 2013-05-10 12:55:45 +00:00
Siebrand Mazeland
59f6fd0199 Change EXIF to Exif
Per https://en.wikipedia.org/wiki/Exchangeable_image_file_format. Spotted
by Shirayuki and documented on
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Sesp-property-exif-data/en

Change-Id: I92ba67ec60ccfe7a173d950593357b86792b8ed3
2013-05-10 13:51:06 +02:00
umherirrender
21751b9ba7 echo is not a function
Removed parenthesis after echo

Change-Id: Ia533aedf63b11d15dcc6a5cf75a56134a4b11d86
2013-05-09 19:52:45 +00:00
Timo Tijhof
50e7985d4d phpcs: Fix WhiteSpace.LanguageConstructSpacing warnings
Squiz.WhiteSpace.LanguageConstructSpacing:
   Language constructs must be followed by a single space;
   expected "require_once expression" but found
   "require_once(expression)"

It is a keyword (e.g. like `new`, `return` and `print`). As
such the parentheses don't make sense.

Per our code conventions, we use a space after keywords like
these. We appeared to have an unwritten exception for `require`
that doesn't make sense. About 60% of require/include usage
was missing the space and/or had superfluous parentheses.

It is as silly as print("foo") or return("foo"), it works
because keywords have no significance for whitespace between
it and the expression that follows, and since experessions can
be wrapped in parentheses for clarity (e.g. when doing string
concatenation or mathematical operations) the parenthesis
before and after basiclaly just ignored.

Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
2013-05-09 05:56:26 +02:00
umherirrender
69c42aadaa Add content model to prop=info
Fields of page table are shown by default in prop=info

Change-Id: Id8b90c341dea19337558ed355975ab890f0663e2
2013-05-08 20:08:40 +02:00
Catrope
8457ee8591 Allow iiurlheight to be used without iiurlwidth
Wanting to get a thumbnail with only the height constrained is a
reasonable use case, the only reason we don't support it in the
API is because the backend doesn't support it directly. This is
easy enough to emulate by setting the width to the full width of
the image if only the height is specified. This makes the transform
function use a bounding box of size w x h, and if w is the width of
the original image that's equivalent to just bounding the height.

Change-Id: I28c7c22ee91669469cbd9e7d25f09100933582de
2013-05-02 17:34:07 -07:00
umherirrender
e36883264f ApiResult::setContent is static
Change-Id: Ifee10208e8b79928ecaa47f541bb61dd6e9c29e4
2013-04-30 20:16:36 +02:00
kaligula
d797477d7b (bug 47219) Allow specifying change type of Wikipedia feed items
It exposes field /rc_type/ as ApiQueryRecentChanges does thus allowing
user to define which (edit, external, new, log) changes to show in feed.

Bug: 47219
Change-Id: If22827129b04d423711f921307dc820d4840d9d1
2013-04-30 18:52:56 +02:00
daniel
8e7150b549 (bug 45535) Hook for changing language links.
This adds a new hook called LanguageLinks which is called
whenever a list of language links is returned to the user.
This gives extensions the option to manipulate the links
on the fly.

Note that this change only covers the language links used
in OutputPage and by ApiParse. Adapting ApiQueryLangLinks is
left as a follow-up task.

As explained on bugzilla, this is a precondition to
allowing Wikibase/Wikidata to update languagelinks without
forcing a (redundant) re-parse of the page content.

This change also introduces the notion of link flags that
can be used to associate flags with language links. This
will be integrated with ParserOutput and OutputPage in a
follow-up.

Change-Id: Iaec0faa131413a291fc8f77496e4f371addb3b99
2013-04-29 09:13:47 -04:00
umherirrender
6f79eef473 Fixed spacing around parenthesis in includes
Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
2013-04-28 15:50:07 +00:00
Victor Vasiliev
dc73a41fff Fix email address formatting in API credits.
Change-Id: I9d295d5b07558e2b28105899c3c40331cea06adf
2013-04-28 15:34:30 +00:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
umherirrender
da39005596 Removed space after isset
While at it, added/removed some other spaces in the same files

Change-Id: Iabb23a448f6f53eb6020155f9c744f74f8b11786
2013-04-26 14:18:06 +02:00
Brian Wolff
6793fe0bf4 Add parentid to output of list=usercontribs
This makes it consistent with prop=revisions. Was requested on
irc by Betacommand.

Change-Id: Idfbee9b4f089738ab70825c11945faf8dd3da66d
2013-04-24 14:33:43 +00:00
csteipp
d3208b719b (bug 38082) Check read permissions in ApiFeedContribs
Before showing the contents of a title in the generated feed, check
that the calling user has permissions to read the specific title.

Change-Id: Iba16a5489d80cd4f0958ad6bbcf2e1a948e97f93
2013-04-23 11:59:10 -07:00
Chad Horohoe
ea430cba3d Handle search engine returning status objects to the API
This is a followup to I54ab5207, which allowed search backends
to return status objects. We handled it in Special:Search, but
the API was overlooked.

Bug: 47353
Change-Id: Ib7abe8d5bc19d27c472053602c0e43cb1301b078
2013-04-22 01:13:24 +00:00
umherirrender
a35cce4be0 Fixed spacing in api folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Id7779dca4d1185245cf5764102b8de8b232c34b6
2013-04-20 07:47:36 +00:00
umherirrender
4975761eb2 API: Add new hook 'APIGetPossibleErrors'
This allows extensions to modify the array.

This completes the serie of hooks for similar get methods in ApiBase.

Change-Id: Ib398f5815ab57f25d56356b0997c55a03fd96874
2013-04-19 15:25:58 +02:00
umherirrender
97234cc884 Added spaces before and removed spaces after 'array'
Fix some other spacing while at it

Change-Id: I13f81533eaf40e06c13cf377c0f08ef5cef01d00
2013-04-14 21:57:46 +02:00