Commit graph

3277 commits

Author SHA1 Message Date
Brad Jorsch
1204a50435 API: Fix ApiQueryBacklinks redirlinks
The fast case needs to pass the redirlinks subarray through array_values
and set an indexed tag name.

Bug: 71907
Change-Id: I865aad6485a2598c9e574ab5c38e8e0923d11ddd
2014-10-10 15:27:39 -04:00
umherirrender
a5b61579a3 Set redirlinks indexed tag name on list=backlinks
Bug: 71907
Follow-Up: I32381c0f082d2f8e063af99ee353ae003c163c23
Change-Id: I4af6000c146e60cd6e3fbda42fcc7bef2952c4ba
2014-10-10 15:40:00 +02:00
Mark A. Hershberger
50adf671ef Update usage of getRedirectSnippet() and getSectionSnippet()
Meant to include this in I571e015814ea756771c66c243cb8db86448db463 but
it was missed.

Change-Id: I9ff805daee1c10d7ea75dedd0ba59b467aaadd50
2014-10-05 16:02:05 -04:00
jenkins-bot
d5aac726d0 Merge "Update usage of getTitleSnippet(), getRedirectSnippet() and getSectionSnippet()" 2014-10-05 18:30:31 +00:00
Brad Jorsch
85f7b9085b API: Log usage of action=tokens
Change-Id: I5fb7d4e3c7924e61747b652a5cbc3ce0a7ccef01
2014-10-03 14:06:43 -04:00
jenkins-bot
31f73c4213 Merge "Made upload jobs avoid using the user session" 2014-10-03 15:41:11 +00:00
Brad Jorsch
4184f1a254 API: Fix ApiQueryBacklinks logic and use *_from_namespace
The original intent of this patch was to have ApiQueryBacklinks use the
*_from_namespace fields added in Icca99b6a. It does that, but in the
process several other bugs were found in the module:

* Continuation could skip pages when blredirect was used.
* The result object would be populated incorrectly if
  $wgAPIMaxResultSize was hit and blredirect was used.
* Continuation could (probably) skip or (maybe) repeat pages when
  blredirect was used and $wgAPIMaxResultSize was hit.

In the process of analyzing and fixing these problems, the code was
heavily refactored.

Change-Id: I32381c0f082d2f8e063af99ee353ae003c163c23
2014-10-01 20:23:31 +00:00
jenkins-bot
e6444a462a Merge "User rights API: Abstract out some stuff about core's form into separate methods" 2014-10-01 13:33:10 +00:00
Alex Monk
7ac4fec0ba User rights API: Abstract out some stuff about core's form into separate methods
To we can make a CentralAuth API module for global user rights.

Bug: 71495
Change-Id: I139c43e5eaa1fb63b75baddbafb7caa3c964d6b5
2014-10-01 13:11:50 +01:00
Aaron Schulz
c7844017c0 Made upload jobs avoid using the user session
* This causes problems with some session handlers and it is
  also trickier to deal with in non CLI script without leaking
  cookie headers.

Change-Id: Iaf2a57f9299e42a5f68bf85115e62e88fa0f8ed6
2014-09-29 16:35:59 -07:00
jenkins-bot
f0f10216c7 Merge "API: Rewrite queries for list=allusers" 2014-09-29 20:36:32 +00:00
Aaron Schulz
14733fc007 Lowered ActiveUsers query period to reduce timeouts
Change-Id: If34266cbac79d319fe33e1f362791fb438577fd7
2014-09-29 11:43:22 -07:00
Anomie
8f0ed5f5a7 Revert "Replace wfMsgReplaceArgs by RawMessage"
This was merged too quickly, has several issues.

This reverts commit 6abefb274f.

Change-Id: Ibf3e464fa9eb534d599274dd9262a30d5a6a6948
2014-09-29 17:41:56 +00:00
umherirrender
6abefb274f Replace wfMsgReplaceArgs by RawMessage
The replace of $n params can also be done using the Message class. In
case there are no message keys, the RawMessage class is used.

Deprecated wfMsgReplaceArgs, but added no warning, because it is used in
some extensions and from deprecated functions

Change-Id: I62091b09e4490e59ed7258566e0ddf2f8ee799d2
2014-09-29 19:23:19 +02:00
Brad Jorsch
e6b9fa4abd API: Rewrite queries for list=allusers
The existing query only works with a single value for augroup, or mostly
if it's combined with auprop=groups or auprop=rights (since most users
don't have every possible group).

When used with multiple values for augroup, it will raise an error if it
happens to encounter enough users who have more than one of the
specified groups. And further, it will lead to repeated groups for these
users if combined with auprop=groups or auprop=rights.

An attempt to use EXISTS instead of a JOIN to query user_groups failed
because it made the planner scan the user table where a smaller scan of
user_groups plus a filesort was faster. So instead, let's just fix it
directly by acknowledging that supplying multiple groups for
augroup is going to give us duplicate rows.

At the same time, let's try using a subquery (with GROUP_CONCAT) to
fetch the actual groups the user belongs to, both to avoid processing so
many duplicate rows and to simplify the row-processing code. And let's
kill the forced index, it's probably not needed anymore.

Bug: 70496
Change-Id: Ic87dbc3b2d933775ca71a72932e0658e2f082bb6
2014-09-29 12:34:18 -04:00
umherirrender
307d5ac0a2 Remove ApiQueryUsers::getAutoGroups (deprecated 1.20)
Change-Id: Idb43eca139c3e63f8a53ef076b2dfa7c5e3941b5
2014-09-26 14:32:25 -07:00
Mark A. Hershberger
ee12c35ac5 Update usage of getTitleSnippet(), getRedirectSnippet() and getSectionSnippet()
According to I5aae8caf, the parameter is gone now.  Found while
tracking down a strict warning in MWSearch.

Change-Id: I571e015814ea756771c66c243cb8db86448db463
2014-09-26 16:46:23 -04:00
Brad Jorsch
07e40d04c6 API: Add ApiPageSet accessors for just good and missing titles
ApiPageSet::getAllTitlesByNamespace is fine when that's what you want.
But in all existing uses in core, it's not what's actually wanted.
* ApiQueryBacklinksprop can generate wrong ORDER BY because it considers
  redirect and invalid titles that it doesn't acutally query.
* ApiQueryCategoryInfo raises a fatal error with category redirects.
* ApiQueryDuplicateFiles and ApiQueryImageInfo will add information for
  redirects, leaving them missing the standard data and missing from
  indexpageids.

What all these need is really something along the lines of
"ApiPageSet::getGoodAndMissingTitlesByNamespace". So let's add that,
plus a few similar methods for good measure.

Bug: 71337
Change-Id: I3a205057edcbc303393718e1c8bfb1f1b1f95323
2014-09-26 11:25:36 -04:00
Reedy
a5994e2776 Revert "API: Fix list=allusers with multiple values for augroup"
Causing a large load spike on enwiki api db slaves

This reverts commit aa5800519f.

Change-Id: Ied559c4e701bb644b354af4e158b84537dde94e9
2014-09-25 21:33:54 +00:00
Brad Jorsch
1efb0a4880 API: ApiBase::PROP_* constants are deprecated
They should have been marked so along with Ie11a401d.

Change-Id: I029f81dabf89c1765fc514579f44a6a0c940b572
2014-09-24 11:42:22 -04:00
Kevin Israel
33339c68eb API: Remove XML tag highlighting from non-XML formats
Since 926afc65c3, the transformation assumes < and > occur in pairs.
This assumption is invalid for formats such as JSON.

Implementing proper JSON syntax highlighting falls outside the scope
of this workaround and is left for separate changes, likely including
the addition of a hook. That is part of the API roadmap RfC.

https://www.mediawiki.org/wiki/Requests_for_comment/API_roadmap#Changes_to_pretty-printed_HTML_formats

Bug: 65403
Change-Id: Iff8d444c82f7efd2bd1c9f703defc4f0984e8211
2014-09-23 19:44:31 +00:00
Brad Jorsch
8e938814c4 API: Add prop modules for backlinks
With the success of prop=redirects, let's create prop=linkshere,
prop=transcludedin, and prop=fileusage.

Let's also add a miser-mode-sensitive 'namespace' parameter to
prop=redirects, since the other three have a 'namespace' parameter using
the new *_from_namespace fields.

Change-Id: Ib650db9988a553771582eed0c183d0cae4b71252
2014-09-18 17:04:42 -04:00
Brad Jorsch
756691eace API: No mustposttoken error with $wgDebugAPI
$wgDebugAPI is supposed to be a way to quickly (and insecurely) test API
modules using GET where they'd normally require POST. But this purpose
is defeated if token handling still throws mustposttoken.

Change-Id: Iee2fb76da86bf0670f9816f24f68c611fa0728b1
2014-09-18 15:56:53 -04:00
jenkins-bot
3e0056ef43 Merge "Do not require iiurlwidth when getting thumbnails." 2014-09-18 17:48:00 +00:00
jenkins-bot
8d0fff60dd Merge "Add duration field in query=imageinfo&iiprop=dimensions" 2014-09-18 17:46:47 +00:00
Brian Wolff
84d8b18bd9 Add duration field in query=imageinfo&iiprop=dimensions
If the file has a duration (e.g. an audio or video file), include
it in the list of dimensions returned. Do not include anything
for still media (normal pictures).

This affects both query=imageinfo and TMH's query=videoinfo.

Bug: 55941
Change-Id: If172a1cbaca08bff2eb709f6c829985b28b0200d
2014-09-18 13:38:36 -03:00
Brian Wolff
542cbb8b40 Do not require iiurlwidth when getting thumbnails.
Some file types might not have a specific width/height. As an
example, TimedMediaHandler can specify thumbnails that are
"mid" sized instead of specific width. The requirement for
iiurlwidth was breaking some edge cases with ForeignAPIRepo
and TimedMediaHandler (Specificly with ?embedplayer=yes).

Do not require a width, but also verify that thumbnail parameters
are ok by running through normaliseParams (Formats that require
a width make this function return false if none is specified).

Change-Id: I8bb4c26db56c814ddfbd3e53ca98d05378c2a0bd
2014-09-18 13:29:27 -03:00
daniel
4f0b2f4241 Allow callback functions for creating SpecialPages.
This enables factory functions to be registered for special
pages, as an alterative to giving a class name. This follows the
same rationale as Ieb85493a7765, which introduced factory functions
for API modules.

Change-Id: Ia2107dc5af7869187ba5dc02a1bef46d6801e138
2014-09-18 14:47:34 +02:00
jenkins-bot
ab8bb1bdd2 Merge "ApiQuerySiteinfo: Use proper localised skin display names if available" 2014-09-15 15:59:54 +00:00
jenkins-bot
a3872d2efd Merge "API: Add timestamp of block to blockinfo" 2014-09-15 15:24:41 +00:00
Bartosz Dziewoński
49edf82e05 ApiQuerySiteinfo: Use proper localised skin display names if available
Based on the code in Preferences::generateSkinOptions(). This should
probably be turned into a helper method one day…

Bug: 48953
Change-Id: Ib85a783bd19de8a59e7b81a4203a05b786e67772
2014-09-15 13:03:01 +00:00
jenkins-bot
8959a09b8f Merge "Prevent "Notice: Undefined index" in ApiQuerySiteinfo" 2014-09-15 03:13:39 +00:00
jenkins-bot
085ca26d69 Merge "Don't list nonexistent groups as addable or removable" 2014-09-15 03:00:28 +00:00
Jackmcbarn
d01b01c6cc Don't list nonexistent groups as addable or removable
You can't add or remove a group that doesn't exist, so don't claim that
it's possible on Special:ListGroupRights or the API.

Change-Id: I02d3f00142ca1cb0cdcbf30e79fecb3c96e96405
2014-09-14 22:48:01 -04:00
Marius Hoch
01ca947a06 Prevent "Notice: Undefined index" in ApiQuerySiteinfo
$row['iw_trans'] wont be set if $wgInterwikiCache is used.

Change-Id: Iea1041b9c699667c251442ed7f4c95e3ba550e7c
2014-09-15 04:33:16 +02:00
Derk-Jan Hartman
d87164e91a API: Add timestamp of block to blockinfo
This change affects list=allusers, list=users
and meta=userinfo.

Note: This change also add block expiry to meta=userinfo.
Unlike this field in other modules, it formats the timestamp
properly, instead of just dumping db contents.

Resurrecting from abandoned change Ifdeac5c5f547

Bug: 63326
Change-Id: I4b3e55fe2d07271e1ded89d36d0b98de0e643177
2014-09-14 20:02:04 -03:00
Brad Jorsch
be9a357bee API: Add rawcontinue parameter to action=query
Soon the simplified continuation will become the default for
action=query. This parameter will then serve select the return of the
raw continuation data. To allow for clients to transition without
"unrecognized parameter" warnings, I'd like to add the parameter now
before even adding deprecation warnings.

Change-Id: I5f6895b6a94c53a231a50707ee9463f91295da8f
2014-09-13 14:16:25 -04:00
Kunal Mehta
ea44f2e3b5 SpecialEmailUser: Use Config instead of globals
Change-Id: I81f6fb942a9cb12332c4763ab4c26cfcc556ddcb
2014-09-12 23:39:59 -07:00
jenkins-bot
8217cfefb3 Merge "API: Fix list=allusers with multiple values for augroup" 2014-09-12 17:27:02 +00:00
jenkins-bot
97b23a2a40 Merge "Properly deprecate srprop=score|hasrelated" 2014-09-12 16:38:50 +00:00
jenkins-bot
5ea9ec39f5 Merge "Remove "related" searches" 2014-09-12 16:38:48 +00:00
Chad Horohoe
67dcb0b2d6 Properly deprecate srprop=score|hasrelated
Logs stats on usage, output param descriptions for callers.

Change-Id: I000b91ff4d81dc1563231cd3ae0b56952b9574fd
2014-09-12 09:29:18 -07:00
Chad Horohoe
a82024c637 Remove "related" searches
Poorly documented and never used anywhere properly.

- No core search backend supports it.
- MWSearch implements it but we've never turned it on.
- SolrStore copies MWSearch but it doesn't even work.
- CirrusSearch doesn't bother because it's silly.

Change-Id: I8b052e8e772030fba6c361fdb2775b10a7f7a15a
2014-09-12 09:28:05 -07:00
Brad Jorsch
aa5800519f API: Fix list=allusers with multiple values for augroup
The existing query only works with a single value for augroup, or mostly
if it's combined with auprop=groups or auprop=rights (since most users
don't have every possible group).

When used with multiple values for augroup, it will raise an error if it
happens to encounter enough users who have more than one of the
specified groups. And further, it will lead to repeated groups for these
users if combined with auprop=groups or auprop=rights.

To avoid both these issues, let's use EXISTS instead of a JOIN to test
augroup. While auexcludegroup doesn't have this problem, we may as well
make the same change there, too. And doing that, there's no reason to
continue with an error when both augroup and auexcludegroup are used.

Bug: 70496
Change-Id: Ia7086ce87012c22651ac4c7a3f75558347276226
2014-09-12 09:24:29 -04:00
Brad Jorsch
f149198b2e API: Deprecate binary sortkey input in ApiQueryCategoryMembers
Depending on what method is being used to encode the binary sortkeys,
it's very possible that sending a binary value will be mangled by
WebRequest's UTF-8 normalization.

Rather than trying to fight it, let's just do what should have been done
in the first place when r86257 changed sortkey output to hex-encoded.
Too bad now we have to deprecate the old params and add
differently-named new ones instead of piggybacking on the original
breaking change.

Bug: 70690
Change-Id: I5a031e980967cbe574dddc261d56604cecc7147a
2014-09-11 10:46:33 -04:00
MZMcBride
2b521feb30 Clarify "mustposttoken" API error message
Bug: 70656
Change-Id: Id30e54472299bc3998644914eca4e19e9429fd2b
2014-09-10 21:22:17 -04:00
umherirrender
b99197d906 Fix column alias in sql on ApiQueryAllUsers.php
PostgreSQL needs explicit AS, so using the array syntax, which produce
the correct sql.

Change-Id: I9588678af955f260df628c6355bf0865f894c224
2014-09-10 20:41:14 +02:00
jenkins-bot
8b7c7dcd68 Merge "Add content-not-allowed-here to API message map" 2014-09-09 05:10:06 +00:00
Alex Monk
78ebf8767e Add content-not-allowed-here to API message map
So we don't get 'Unknown error: "content-not-allowed-here"'

Bug: 70593
Change-Id: Ibde9eb45c798a7b3abef088f7abd78c926d13031
2014-09-09 02:16:04 +01:00
jenkins-bot
4dd56b2268 Merge "API: created a new api to flag messages as read" 2014-09-08 15:20:30 +00:00