Commit graph

3210 commits

Author SHA1 Message Date
Brad Jorsch
4e198a96e4 API: Adjust feature usage log format
On the advice of the Research Analyst, quote all data fields and add
slashes to escape quotes.

Change-Id: I3471475c0ae7a11398a774b1a14d023676259c04
Follows-up: Ifd640883e46f3e6c8179c63d122c704b046674ca
2014-08-20 11:17:35 -04:00
jenkins-bot
377a12e5da Merge "API: Add a "submodule" param type" 2014-08-20 07:15:31 +00:00
jenkins-bot
92e31275a4 Merge "Test only against protection for deleting" 2014-08-19 17:22:57 +00:00
Brad Jorsch
afa153ae9d API: Add a "submodule" param type
This allows action=paraminfo to indicate when a parameter is specifying
a submodule (so clients can detect what the submodule names are). This
will also allow the future action=help HTMLization to easily auto-link
to submodule docs, and will allow ApiSandbox to handle submodules more
generically.

For BC, rather than directly specifying "type": "submodule", it lists
the names of all the submodules as the type and adds an additional
"submodules" indicator on the param info object.

Change-Id: Id31babdc81d970ac781ec11daa3cdafef18ecd5d
2014-08-19 11:25:07 -04:00
Brad Jorsch
3ed94e8b3e API: Mark seldom-used formats as deprecated
While it doesn't take a lot to maintain most of these, there is some
effort needed (e.g. wddx was breaking with HHVM). None have much if any
usage that seems likely to be actual code of some sort, and humans
should be able to read the jsonfm format as easily as dbgfm, dumpfm, or
txtfm.

Change-Id: I4e3d2ef59d4306756b289a4be46caef7d359ccef
2014-08-15 09:03:17 -04:00
Brad Jorsch
b5cd9e2f6b API: Log usage of various deprecated features
This will let us know how aggressively we can finally remove these.

Change-Id: I03fab36e921807e74fbabfa878756af254d89a1b
2014-08-14 16:51:14 -07:00
Brad Jorsch
a04f192094 API: Add method for logging feature usage
For example, to determine usage levels of deprecated features.

Change-Id: Ifd640883e46f3e6c8179c63d122c704b046674ca
2014-08-14 23:39:03 +00:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
umherirrender
ab20f80116 Fixed spacing
- Added newline at end of files
- Added/Removed spaces around comma, parentheses and negation
- Added space after function word

Change-Id: I2dd338153aeb5f07702ba015945e95c7d0ae673b
2014-08-13 20:14:56 +00:00
Yuri Astrakhan
703464a88c Cleanup - let's make IDEs more useful
http://phpdoc.org/docs/latest/references/phpdoc/types.html

If IDEs have many warnings, we don't look at them.
Let's minimize the number of warnings, and make them useful again.

* Some function docs fixes
* Removed unused $iwprefixes var in ApiQuerySearch.php
* declared private $blockStatusByUid in SpecialActiveusers
* declared private $repo in UploadFromChunks

Change-Id: Ifd20f78b168b9a913fdb8d89dc26a76a173b1c29
2014-08-13 16:02:59 -04:00
umherirrender
f6e19c0afe Fixed some docs
- Added since to @deprecated
- Use lowercase array on @param
- Added missing type on @param
- Swapped type and variable on @param
- Fixed spelling of @return

Change-Id: Idbbc6b4c8aadb6d98c636f53024ac513346c912b
2014-08-13 20:01:46 +02:00
umherirrender
a203032d00 Docs: compatability -> compatibility
https://en.wiktionary.org/wiki/compatability

Change-Id: I71d82ae04d4b17609a1d5a7eec4497115e64972e
2014-08-13 19:39:07 +02:00
Jackmcbarn
9dafa73b2f Test only against protection for deleting
When deleting a page, only check that the user can edit through
protection, rather than running all of the other checks. This is Tim
Starling's option 3 from bug 69380.

Bug: 69380
Bug: 69398
Change-Id: I5a7c4147bd241dc086fda6c16827f9554d78599b
2014-08-12 11:47:01 -04:00
Brad Jorsch
002a277901 Do not allow a user to delete a page they can't edit
This was probably overlooked in the past because usually the only users
who can delete pages also have permission to edit the relevant
protection levels.

Change-Id: Ibe28a69c9fbab00b81c53b1643df722a3f1fbf19
2014-08-10 22:11:48 +01:00
jenkins-bot
78f56b0753 Merge "API: Remove action=paraminfo 'props' and 'errors' result properties" 2014-08-10 14:08:52 +00:00
rillke
c31fbf073e Unify the spelling of MIME in documentation
Writing MIME as written in Wikipedia and some documentation clean up.

Change-Id: I9dfc36d2bf55d72d9374c4075bd6d45eef0415a4
2014-08-07 23:38:45 +02:00
Brad Jorsch
f0a6435f3b API: Remove action=paraminfo 'props' and 'errors' result properties
The format for 'props' was never specified and the list for 'errors' is
impossible to keep updated when considering that many errors come from
MediaWiki backend code and extension hook functions. And since there
doesn't seem to be any real use case for either of these, let's just
kill both of them instead of wasting effort on trying to fix them.

Note that neither getResultProperties nor getPossibleErrors are called
from any extensions in gerrit, and none of the other deprecated methods
are called outside of the implementations of those two methods. Removing
the obsolete methods is left to the maintainers of the extensions, as
keeping them hurts nothing and is needed to maintain compatibility with
earlier versions of MediaWiki.

Change-Id: Ie11a401d60c834059fbf1b5625ca8ea093b3337c
2014-08-07 16:51:19 +01:00
Chad Horohoe
af87cb4a3f Remove score display from search engine
Scores are an internal metric that should not be exposed to
users, plus most backends fail to even support it.

Removes PostgresSearch*-specific result classes as they're not
needed anymore.

Change-Id: I00acaabad0565b9a5b3524c992feea366eb74bcc
2014-08-07 14:19:37 +01:00
jenkins-bot
57ec9e0669 Merge "Allow factory functions for creating API modules." 2014-08-07 08:07:48 +00:00
jenkins-bot
decb85352d Merge "SpecialActiveusers: Use Config objects instead of globals" 2014-08-06 21:43:59 +00:00
daniel
baa11f7430 Allow factory functions for creating API modules.
This enables factory functions to be registered for API modules,
in addition to the module class itself. This allows modules to
use proper dependency injection via the modules constructor.

Example:

  $wgAPIModules['foo'] = array(
    'class' => 'ApiFoo',
    'factory' => function( $main, $action ) { ... }
  )

Change-Id: Ieb85493a7765f466317f5fa74b0b0e262220deab
2014-08-06 22:58:14 +02:00
Kunal Mehta
6aede494fb SpecialUndelete/PageArchive: Use Config instead of globals
Change-Id: Ic025412ed74d9cffad48a3ab04788d46ab43befb
2014-08-06 16:20:26 +01:00
Kunal Mehta
9e1f4a6974 SpecialActiveusers: Use Config objects instead of globals
Except for SpecialActiveUsers::cacheUpdate because I couldn't figure
out what was calling that.

Change-Id: Ib37beba34d41e2a27e4d87f1b2d7654d519334f8
2014-08-03 14:19:24 -07:00
Brad Jorsch
d0e16713bc Check for result size failure in ApiQuery
If someone sets $wgAPIMaxResultSize crazily small and then queries a
large number of pages, it can cause ApiQuery to fail to populate the
'pages' node. Then submodules might add data to the node, leading to
errors from the XML formatter (or bogus output from other formatters).

While that particular failure mode is probably going away soon, it's
still good to catch the error situation.

Bug: 68989
Change-Id: If0b2eda421fd86dd7acc4fe48cec47741e214221
2014-08-01 12:26:49 -04:00
Brad Jorsch
3fd7a3cebe API: Allow undeleting files
Strange that action=undelete didn't support this already.

Bug: 40817
Change-Id: Ia864158370411e555f63f70588ebd305a756d6f5
2014-07-31 16:07:26 +00:00
Reedy
58f369557d list=logevent userid is returned as string, should be integer
Bug: 68921
Change-Id: Ibdc771cfc3286f8f20f64a2817a2ef01d4b1f8ad
2014-07-31 15:24:58 +01:00
Étienne Beaulé
b230bdce16 Create preference to watchlist pages after rollbacking
This change adds a  preference in the 'watchlist' section to
automatically watchlist a page after rollbacking.

The setting is only visible, if the user has the 'rollback'-right.
I have removed the watch reverts function per advice by Vogone.

Bug: 4488
Change-Id: I3aa831c9c04d627684641af0ca5a332795c87062
2014-07-30 21:51:41 +00:00
csteipp
fe32899523 SECURITY: Prepend jsonp callback with comment
Mitigate CVE-2014-4671 for unpatched flash players

Bug: 68187
Change-Id: I2f46e623c1f541dbbafb6e8333e0929055098b15
2014-07-30 20:26:39 +02:00
Étienne Beaulé
c3fcaba02f Enable the creation of empty pages
This change enables the direct creation of empty pages without needing
to use a work-around (such as "{{subst:ns:0}}"). A warning is added as
the message "blankarticle" to request confirmation that the empty page
was meant to be blank. A automatic edit summary has been added when
creating a blank page. The message is: "autosumm-newblank."

The API has been updated to permit the creation of empty pages, when
"text" is null, but not non-existant.

Unit tests have also been added to test these features.

Bug: 57238
Bug: 65206
Change-Id: I3457c36a909d1dbfaeed04a1f0568c69e0ef3386
2014-07-25 23:26:18 -04:00
umherirrender
02dc9da399 Cleanup some docs (includes/[a-d])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I7b65fe04db431342cc58b469dc48f41a50c4e891
2014-07-24 19:42:45 +02:00
umherirrender
347a0b294e Fix deprecated of ApiQuery::setGeneratorContinue
No @ before the since

Change-Id: I849b9f950069fe248a6cd86afb1e1beda271f235
2014-07-23 23:36:10 +02:00
S Page
16a169c6c8 Provide namespace to ApiParse->getSectionContent
Improves the "Sections are not supported by <PAGE>" error message when
it fails.  Also add phpdoc comment

Bug: 68416
Change-Id: Iaa5d3a1f33b8a9c48263c2ce27cd3b4fe98fbf01
2014-07-22 18:26:53 -07:00
umherirrender
53c420e278 Fixed spacing
- use tab as indent instead of spaces
- Added space after closures "function"
- Added spaces around string_concat
- Added newline inside empty blocks
- Removed four spaces after comma

Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
2014-07-20 21:41:41 +02:00
umherirrender
2b021dc48a Fixed spacing
- Added/removed spaces around parenthesis
- Added space after switch/if/foreach
- changed else if to elseif

Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
2014-07-19 23:12:10 +02:00
eikes
2f002458d5 Split "suppressrevision" into two user rights
In this change, a new passive user right named "viewsuppressed"
which can be used in order to view suppressed page content was added
to MediaWiki core.
Furthermore, this right was also added to the list of available rights,
to qqq.json and to en.json where also the description of the
"suppressrevision" right was adjusted in order to reflect reality.

Bug: 20476
Change-Id: Id1baacb9c782763db5e05ef8b5c1b761997efcc9
2014-07-19 18:11:15 +02:00
Brad Jorsch
b1a3d390ae API: Cleanup list=filearchive
It should return fa_id so that a client can know what to pass to
action=revisiondelete and (soon) action=undelete. And the continuation
was very broken.

Change-Id: Icf93293f312d41b44d1c4972d75acf2ff2dc1b80
2014-07-15 12:59:56 -04:00
Yuri Astrakhan
43b1eb3f72 Added ApiResult::NO_SIZE_CHECK flag for addValue()
This way we no longer need to disable size checking just for one operation
(enable|disable)SizeCheck functions were depricated.

Overall, this is a much better practice than disabling than re-enabling
the flag, as it might lead to accidentally forgetting to re-enable it,
just like the issue with the dangling file handlers, etc.

Example:

disable, do some complex logic, re-enable.  And later, by accident,
the complex logic is changed to return a value half-way, or throws
an exception that gets handled as part of normal operations. This
results in the unsafe disabled state of the result object,
which is not good (tm).

Change-Id: I389a334d35f52f23a1847aca4aef5e96b262f589
2014-07-11 14:53:58 -04:00
jenkins-bot
3d469fe791 Merge "API: Fix list=deletedrevs with pre-1.5 revisions" 2014-07-10 18:37:26 +00:00
Chad Horohoe
a4334bbef5 Use PHP_VERSION constant instead of phpversion() function call
Change-Id: Ifb3d1bd92d6abaa561e7337b311b4cb10c38a2b6
2014-07-09 16:46:35 -07:00
umherirrender
0a06cbf00f Change some mixed @param docs in api classes
Change-Id: I2ab4b0ae452325392c4ea72ab3d985107d429ac2
2014-07-09 18:41:01 +02:00
Brad Jorsch
e3ba5956e0 API: Fix list=deletedrevs with pre-1.5 revisions
In pre-1.5, deleted revisions have the text in the ar_text field of the
archive table with empty ar_text_id. Adjust the JOIN used for
drprop=content to take this situation into account, and the logic for
extracting the revision content to match.

Bug: 67699
Change-Id: I3672435ac97fa1eff2bdf80b24c470525c93ab27
2014-07-09 10:26:39 -04:00
Brad Jorsch
1e7ea938da API: Refactor continuation code and add to purge, watch, etc.
While generator support was added to various actions, the continuation
parameters from the generators weren't being returned to the client.

This patch refactors the code for handling continuation out of ApiQuery
and into ApiResult, and then uses it in the other actions that need it.

Bug: 60734
Change-Id: I1a6e51cdc964ddcdd69aaa2f735223371233e8af
2014-07-04 15:48:35 -04:00
jenkins-bot
1da24f74e9 Merge "API: Fix queries for list=allusers&auactiveusers" 2014-07-01 19:14:54 +00:00
Brad Jorsch
1552e7db72 API: Fix setnotificationtimestamp with no pages given
When newerthanrevid or torevid is used and no pages are given, do not
throw a fatal PHP error.

When no pages are given in other modes, do not return a database error.

Bug: 48071
Change-Id: I5abcdf0fa20486f1198d1cc111461b3088a311df
2014-07-01 11:31:03 -04:00
jenkins-bot
7234b48772 Merge "Removes 'languageshtml' property in mediawiki API's 'parse' action" 2014-07-01 15:00:45 +00:00
Rohan
f1b0316570 Removes 'languageshtml' property in mediawiki API's 'parse' action
Bug: 67149
Change-Id: Ib1dfa0d04380839bbe474cbb5c0a9b6af09b8371
2014-07-01 19:28:39 +05:30
Brad Jorsch
eb4eb3c798 API: Fix queries for list=allusers&auactiveusers
The query introduced to support the auactiveusers is itself broken (it
counts every edit multiple times when combined with the group filters or
auprop=groups or auprop=rights, or for users with multiple rows in
ipblocks) and it breaks auprop=groups and auprop=rights.

Instead, let's filter using the same cached data used by
Special:ActiveUsers and do the actual counting of recent "edits" in a
subquery. And for parity with Special:ActiveUsers, let's skip
RC_EXTERNAL when doing the count.

Also, it turns out the "recenteditcount" property in the result is
really more like "recentactions" since it counts any action that shows
up in recentchanges; the discrepancy between that and "editcount" can be
confusing if someone is doing a lot of logged actions that don't create
dummy revisions. Let's rename that, but we'll have to keep the old
property around for a while for BC.

Bug: 64505
Bug: 64507
Bug: 67301
Change-Id: I461e92819188c311cbb3853bc6bfad45962c8d7b
2014-06-30 12:33:27 -04:00
umherirrender
f0d2926c03 Remove ApiBase::createContext() (deprecated since 1.19)
Change-Id: Iee20e1c5e5b83b5b43303bde7e524b95b74eb62b
2014-06-25 20:35:56 +02:00
Brad Jorsch
839f02bb45 Actually fetch config object in ApiQueryRecentChanges::getResultProperties
Change-Id: Id9c316733896a27ce3f6c3e0e5efdf62f7d1ff1b
2014-06-24 12:54:10 -04:00
Kevin Israel
1402236c4b Remove use of OutputPage::addParserOutputNoText()
Simply clicking "Show preview" on the edit page triggered a deprecation
warning.

Also removed the wfDeprecated() call from the method, which is still used
in a few WMF-deployed extensions without a corresponding open change.

Follows-up e8f1fede77.

Change-Id: I2cfdc84b92cf13478b9f462028d525e4ec14fdf2
2014-06-24 04:53:44 -04:00