Commit graph

2494 commits

Author SHA1 Message Date
Tim Starling
343cbf7463 Add an API log
During incident response, it was not possible to tell what API modules
were being requested and by whom, since the action parameter is often
posted. This change logs the API parameters whether they are posted or
sent in the query string.

I did try to get the API parameters from the module, but that turns out
to be difficult. Modules create submodules (generators, page sets) as
local variables, which are created in a procedural style and destroyed
before logging is done, so there is no easy way to query them for
parameter lists after execution completes.

In ApiOptionsTest, use a real ApiMain object like all the other API test
cases, rather than a mock object. Otherwise the test fails.

Change-Id: Idc786007fe61811d1874f29b5ce4762dd97b1847
2012-09-24 21:22:09 +00:00
Siebrand
84b4875f45 Merge "(bug 35693) ApiQueryImageInfo now suppresses errors when unserializing metadata" 2012-09-23 18:55:37 +00:00
btongminh
5aab0ff71e (bug 35693) ApiQueryImageInfo now suppresses errors when unserializing
metadata

Change-Id: I7c9649b54a9d1d8f8b79beff7435a32860b80a61
2012-09-23 20:52:00 +02:00
umherirrender
eb41fc9dc1 Add User to Title::userCan calls in api
Change-Id: I86ee1398abe4a790796d61aba1e1739bc55e565b
2012-09-22 13:33:33 +02:00
Alexandre Emsenhuber
14d159af7e Use Revision::isCurrent() in ApiParse.
We have a loaded Revision object so we may use that
method as well.

Change-Id: Ie8bb871f8874871d7df3111d39ba23a01769cd34
2012-09-17 20:14:27 +02:00
Aaron Schulz
850373ba9c Merge "Use WikiPage::makeParserOptions() where possible." 2012-09-16 18:02:56 +00:00
Catrope
5fe12fad12 Apparently setIndexedTagName_recursive() wasn't enough here
Change-Id: I090b2a315040bc5594a31e5d44dcb9721b4750a6
2012-09-12 12:57:04 -07:00
Catrope
d7a50ae34c Fix fatal error in rcprop=loginfo
There was a recentchanges row on enwiki whose rc_params looked like
array('4::tags'=>array('db-g11')), and the tag name wasn't set
recursively so the inner array didn't get a tag name.

This still generates invalid XML of course, because <4::tags> isn't a
valid tag, but at least it doesn't fatal any more. RAWR XML GRUMBLE

Change-Id: Ibb775df4bd010bdce5632914f789230d8626c9e7
2012-09-10 16:44:43 -07:00
IAlex
8634014e86 Merge "Replace some occurrences of wfMsg* by alternatives. Undeprecated wfMsgReplaceArgs." 2012-09-10 17:33:37 +00:00
Reedy
92ff0e4a33 Alpha-sort lists of api modules in ApiQuery
$ocd++;

Change-Id: I3dbf763d360822f2c39e97622b2ca32b9c322ee5
2012-09-06 19:26:23 +01:00
Reedy
410d1617db Merge "add moveoverredirect to result of api move" 2012-09-06 00:03:16 +00:00
Reedy
0b53b320c4 * (bug 39665) Cache AllowedGenerator array so it doesn't autoload all query classes on every request.
Change-Id: I541ecf931a2bbe766bf31f569f81cc92308e35e1
2012-09-05 23:34:23 +01:00
Daniel Kinzler
a1a296ac84 Merge "New hook ApiCheckCanExecute." 2012-09-05 19:06:48 +00:00
Tyler Romeo
780b6878f7 New hook ApiCheckCanExecute.
Added new hook in ApiMain::checkCanExecute
so that extensions can authenticate and
authorize API clients before the module is
execute. (Necessary for extensions like
OAuth that externally authnz clients.)

Change-Id: I1b059fd9a4aa717928af8b09f5edebe899ab3ce1
Signed-off-by: Tyler Romeo <tylerromeo@gmail.com>
2012-09-05 14:33:14 -04:00
Fran McCrory
d6028a1811 (bug 34939) Handle mixed-case URL protocols in wikitext
This patch marks the regex matching url protocol as being case
insensitive. We will from now render links like [HTTP://ww].

Tests added.

Change-Id: I706acb7a0ae194b50d2318763beae4e5e83671f3
2012-09-04 16:26:46 +02:00
Siebrand Mazeland
475a1daa03 Replace some occurrences of wfMsg* by alternatives. Undeprecated wfMsgReplaceArgs.
* wfMsgReplaceArgs isn't really i18n related. It just replaces text parts.
* Updated language.txt. Now refers to mediawiki.org.
* Removed deprecated Block::formatExpiry(). Merge Id7d057a4 first.
* Reformatted weirdly formatted array in ApiBase.php.
* Removed wfMsg() in RandomTest.php.

Change-Id: Ied5cfda8fa5d9283dfeebdcb0e1af8453d47e7a9
2012-09-03 11:49:58 +02:00
Siebrand
fae05504fe Merge "Follow-up I0b781c11 (2a55449): use User::getAutomaticGroups()." 2012-09-01 12:33:07 +00:00
Alexandre Emsenhuber
be0878fd3a Use WikiPage::makeParserOptions() where possible.
- This is needed to for I90965346 ((bug 37453) Move
  $wgDisable(Lang|Title)Conversion to ParserOptions)
  because that change sets an option based on the Title,
  and I don't want to duplicate that to all ParserOptions
  that need it.
- Refactored ApiParse to have a WikiPage object available
  and changed some part to take advantage of having this
  object available. Also used ApiBase::getTitleOrPageId()
  to reduce code duplication.

Change-Id: Iec98e472af9c43d940f77261367a796b0d7b4b54
2012-08-31 23:16:03 +02:00
Demon
944e196c02 Merge "(bug 39180) Set x-frame-options='DENY' for api" 2012-08-31 14:47:28 +00:00
umherirrender
7a427c2be8 add moveoverredirect to result of api move
Change-Id: I5047d94d75112c1390c42a7eb3bb4f16b5249539
2012-08-31 16:15:13 +02:00
Aaron Schulz
a53de31828 Added explicit DB flags for Revision loading calls.
Change-Id: Ie90d4197ad7a16009c96273eeae1a658678a8200
2012-08-29 20:04:30 -07:00
Max Semenik
a1cedee3c4 New hook ApiMain::onException
Allows custom logging of API errors

Change-Id: If8841c33998dff96448a7eb8dbe95d68119e068f
2012-08-29 20:42:48 +04:00
IAlex
be7d3feab2 Merge "Replace deprecated wfMsg* calls with Message class calls." 2012-08-22 18:37:29 +00:00
Siebrand Mazeland
c848f486bc Replace deprecated wfMsg* calls with Message class calls.
Doing this in steps of roughly 100 changes per commit, so that it remains
reviewable. This should be the one but last change set with the "easy"
ones for core.

Change-Id: If894a92dd65b2f5f4f096b9133685eb3b067a1d8
2012-08-21 21:58:47 +02:00
umherirrender
5964a39755 prop=duplicatefiles does not show duplicates under same name
When under the same name on the repo a file exist, with the same hash,
prop=duplicatefiles does not list this file.
Checking also isLocal, when looking for the file itself helps.

Adding also a shared='' to indicate, that the duplicate with same name
is not the file itself.

Follow up I745cae7a

Change-Id: I4e613cb6d592521befe8bc876e251a89b3fa3047
2012-08-18 15:44:20 +02:00
Alex Monk
2fabea7eea Use wfMessage instead of deprecated wfMsg*
Or $this->msg in special pages.

Change-Id: I774a89d646615053c8424050e42ad95601f92543
2012-08-18 14:11:05 +02:00
csteipp
32b99b11c9 (bug 39180) Set x-frame-options='DENY' for api
By default, set the x-frame-options header for api result pages
to 'DENY'. This is to prevent an attacker from iframing an api
page that includes tokens and stealing them from a user, for example
with a fake captcha prompt.

The global $wgApiFrameOptions is used for the value, or can be set
to false to disable setting the header.

Change-Id: I498f874d7f6c180ec4f3abfc81f773c0fa0f421d
2012-08-17 12:20:47 -07:00
Reedy
c6e2265424 Some API errors didn't include the prefix of the module in parameter related error messages
This fixes up/normalises these usages (probably want refactoring out at a later date)

Change-Id: I5583d69d9e65a1ee09d31a37c88f369e7c0f7708
2012-08-17 14:54:24 +01:00
Catrope
321efff833 Merge "Allow aliased field names with separated syntax" 2012-08-15 18:01:18 +00:00
umherirrender
aff21af9ae Allow aliased field names with separated syntax
This introduce the syntax from aliased table names for aliased field
names into the abstract database layer:

array( 'alias' => 'field' ) gives 'field AS alias'

This patch also includes changes to query pages, api and some more
places to show, how the new syntax looks in "production".

This allow us to remove the "AS" for Non-PostgreSQL databases, if we
want that.

Change-Id: I5f0de1c2f29092c173aec3de93ffdef436799e8d
2012-08-15 15:16:09 +02:00
umherirrender
e421c99e87 Allow importing pages as subpage
Adding a "root page" input to Special:Import, which is used as prefix
before each imported page. With this option, it is possible to import
pages as subpage of a user or a project page.

On de.wp the import is often done into a low used namespace (100 or 101)
and than moved to the user space. Doing this in one step, makes things
easier.

Change-Id: Id5dbf742295a1bbddd8cb6eaa09fb28051f26613
2012-08-15 10:10:46 +02:00
umherirrender
26be14ea2d Notice: Undefined property: stdClass::$hitcount in list=tags
Full message:
Notice: Undefined property: stdClass::$hitcount in
..\includes\api\ApiQueryTags.php on line 76

Change-Id: I773e0a5f70ee025033899d6950336dff0829e09b
2012-08-14 21:34:09 +02:00
Siebrand Mazeland
9ff9aaae63 Fix typo: occured -> occurred.
Change-Id: I5e66fdd52791487f81796ae1965ac31c94b36182
2012-08-10 10:59:55 +02:00
Reedy
e3f2a90bf0 Remove unused variables/function values returned
Fix trailing whitespace

Change-Id: I53abf75e142f0166032b98e4adb3dabe06643017
2012-08-08 00:47:25 +01:00
Reedy
b192ba34aa Merge "Followup c17651/bug 39032" 2012-08-07 20:12:51 +00:00
Reedy
249e22b721 Followup c17651/bug 39032
makeHelpMsgHelper made a list of "allowed generators" at the same
time as generating stuff that was used to build the api help docs.

Change-Id: Idcc0b19ff62ab8da95c09c75a5222d3116ed0dc5
2012-08-07 20:25:30 +01:00
Brad Jorsch
d50b416d9f (bug 11142) Improve file ext error reporting in API upload
The API action=upload returns a generic error message when one or more
of the file extensions are blacklisted. It should return a more
informative message, and also return the list of blacklisted extensions
in a machine-readable format.

This changeset introduces a new message,
"api-error-filetype-banned-type", which is to
"api-error-filetype-banned" what "filetype-banned-type" is to
"filetype-banned". As a starting point, I've copied (with minor changes)
the existing filetype-banned-type message to
api-error-filetype-banned-type for all languages for which both
api-error-filetype-banned and filetype-banned-type are currently given.

This changeset also incidentally fixes an internal server error with
format=xml when the filetype-banned error is returned by the API.

Change-Id: I6b0c58fbc5b19aa55286c56fa7da2195ea683ae0
2012-08-07 11:50:08 -07:00
Aaron Schulz
617d0f03c8 Merge "change some rc_new to rc_type == RC_NEW" 2012-08-06 05:40:44 +00:00
umherirrender
58b7b644f9 change some rc_new to rc_type == RC_NEW
The field rc_new is obsolete and should be removed, see bug 34320

Change-Id: I411ec2cb0fe3eb078094eded210d4aefee5f8e74
2012-08-06 00:08:35 +02:00
Aaron Schulz
abad0ee867 Merge "Fix possible error texts in action=options" 2012-08-04 18:13:09 +00:00
Aaron Schulz
6e510a6f52 Merge "remove 'cantpurge' from possible errors in action=purge" 2012-08-04 18:10:54 +00:00
Aaron Schulz
d6a72e1bb4 Merge "Rename 'file-session-key' in api message map" 2012-08-04 18:10:30 +00:00
Aaron Schulz
b85d678557 Merge "unknown error 'filerevert-badversion'" 2012-08-04 18:10:02 +00:00
umherirrender
9b64000d1e fix list of possible errors for list=blocks
Change-Id: I4a091eeb788f465fe6cdbb7fe6d296606185ba3c
2012-08-04 16:35:49 +02:00
umherirrender
505ae65010 remove 'cantpurge' from possible errors in action=purge
Was removed in r74944

Change-Id: Ib13be4a3a9956b5c48f2d435092affe518fd7cd3
2012-08-04 16:26:53 +02:00
umherirrender
5d09035903 Fix possible error texts in action=options
Change-Id: I465b9cf109bd4f22542747ca72876caa3725a353
2012-08-04 16:18:18 +02:00
umherirrender
bb0975708e Rename 'file-session-key' in api message map
Follow up r92009

Change-Id: I4752d47e54f4b13101400bed097eccc525e8506e
2012-08-04 16:05:21 +02:00
umherirrender
c5d36b5b18 unknown error 'filerevert-badversion'
Adding 'filerevert-badversion' to message map
use some local vars in ApiFileRevert

Change-Id: I2341f3f212af484d446a7a84c1b5c7984597468d
2012-08-04 15:40:36 +02:00
Reedy
52861ea3a1 * Bug 39032 - ApiQuery generates help in constructor.
Functions called unnecesserily, as their return values aren't used
or even cached.

Removing them to reduce the pointless overhead of calling them

Change-Id: I0d8ddab9492ea79d5de4118944e77ac774275506
2012-08-04 14:35:23 +01:00
Reedy
3d0215c357 Merge "Use WebRequest instead of $_SERVER in ApiMain." 2012-08-03 20:59:04 +00:00