Commit graph

3092 commits

Author SHA1 Message Date
tonythomas01
74756a2409 Removed 'Remember my login' preference
Removed 'Remember my login' from Preferences, as it was unwanted. It adds
to the complexity of the user preferences

Bug: 52342
Co-Author: Tyler Romeo <tylerromeo@gmail.com>
Change-Id: I7c957e1e1aaecf47f7c47bc063b5d3b364644afc
2014-04-16 12:49:44 +05:30
Brian Wolff
b954a12809 Cache RecentChanges Atom feed in varnish for 15 seconds
Prior to fc20c30d20, the feed was cached for 10 seconds. That
change accidentally removed varnish caching. Re-add the caching,
and upping to 15 seconds for good measure (15 second delay on the RSS
feed shouldn't matter, people generally read those asynchronously
anyhow. I was thinking of maybe even uping to 30 seconds). Users
can still manually set an smaxage parameter via the url if they
don't like the default cache time.

This assumes nothing private (e.g. per user) is ever on the RSS
feed. Reading through the ChangesList code this appears to be
the case, as everyone is getting the feed from a shared
memcache entry.

Bug: 63249
Change-Id: I268d0a53067738ba96bee74c593358b0b28cc083
2014-04-14 13:51:03 +01:00
jenkins-bot
83a1cf573f Merge "Rename Skin::getUsableSkins() to Skin::getAllowedSkins()" 2014-04-13 00:30:53 +00:00
Brad Jorsch
d9534a5d56 API: Make more continuations unique
API queries must be completely ordered for proper behavior; otherwise
you may get into a situation where a query returns the same continuation
value that was provided. Various modules that have been using timestamps
in/as their continuation parameter can easily run into this problem.

Normally we'd have to add additional fields to the relevant indexes to
be able to make this work without having filesorting queries (which
MySQL really doesn't do well, it fetches all matching rows and only
applies the limit after[1]). But InnoDB has a "feature" where it
effectively appends the table's primary key to all other indexes,[2]
which makes these queries be properly indexed in that situation.
Apparently we're ok with this, since Icc43b62f was merged depending on
this feature.

Also, this change fixes some MySQLisms and other oddities done to
ApiQueryRecentChanges in Icc43b62f.

 [1]: https://dev.mysql.com/doc/refman/5.5/en/limit-optimization.html
 [2]: https://dev.mysql.com/doc/refman/5.5/en/innodb-table-and-index.html

Bug: 24782
Change-Id: I4c9f8c0c2bfd831755d4fa20a18f93fef1effd28
2014-04-11 10:50:16 -04:00
Bartosz Dziewoński
e745f30e4e ApiQueryDeletedrevs: Fix getDescription() docs
Strings were incorrectly quoted.

Change-Id: I5b7aa4709a9bfde36b4e81ba8ea3e15efde003b1
2014-04-07 16:10:55 +02:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
jenkins-bot
f1b45cbed4 Merge "New API module, list=prefixsearch" 2014-04-03 23:07:58 +00:00
jenkins-bot
a081770500 Merge "ApiFeedRecentChanges: Validate param target" 2014-04-03 14:59:24 +00:00
Niklas Laxström
25fdd5de7d ApiFeedRecentChanges: Validate param target
Change-Id: I6933177d47c25d48b9b55d479afa4dedcc64299d
2014-04-03 14:15:49 +00:00
Max Semenik
af6d9aba6d New API module, list=prefixsearch
It's pretty much like action=opensearch but can be used as a generator
which can be handy when you need to retrieve both the list of pages and
some information about them.

Change-Id: Iaffe30a0f7402e1316c4885a805692a34bbe1a6a
2014-04-02 19:14:07 +04:00
jenkins-bot
42db755b21 Merge "API: Allow for format modules that cannot handle errors" 2014-03-31 17:48:47 +00:00
jenkins-bot
57c4cd7ce5 Merge "Improve handling of uncommitted DB txns with "uncaught" exceptions" 2014-03-31 16:30:33 +00:00
Alexandre Emsenhuber
449ee32451 Add missing line breaks to wfDebug() calls
Also removed true as second parameter to it from CloneDatabase.php
since it is the default value of that parameter.

Change-Id: I727ebae2bd4df0e26019985ce8c7ce73381c5642
2014-03-29 11:52:07 +01:00
Brad Jorsch
dc7d342d93 Improve handling of uncommitted DB txns with "uncaught" exceptions
One of the causes (if not the cause) of bug 56269 is if something
manages to throw an exception that makes it to MediaWiki::run's
last-resort exception catcher while having an open database transaction:
the transaction never gets committed or rolled back, so it gets
implicitly rolled back and a warning is raised.

The API has the opposite problem in bug 63145: it catches the exception
but then does the normal DB shutdown which *commits* the transaction.
This is certainly the Wrong Thing to do.

Ideally, neither of these would ever happen because any code using
transactions would have its own try-catch that would catch any
exception, rollback the transaction, and then rethrow the exception. But
it happens anyway, so let's have both of these last-resort exception
handlers do the rollback, and also log the exception so the throwing
code has a better chance of being properly fixed.

Bug: 56269
Bug: 63145
Change-Id: I8f1da51187b281fe4afc0d5a0c49f5caf3612e92
2014-03-27 12:46:07 -04:00
Brad Jorsch
d0830af6ba API: Allow for format modules that cannot handle errors
ApiFormatFeedWrapper, for example, has nothing particularly useful to do
when given an API error to print. So allow for punting errors to the
default formatter instead.

Bug: 63150
Change-Id: Ifc034d4c7861905e382c42dc22585f0cd2beaf3f
2014-03-27 11:11:17 -04:00
Chad Horohoe
7e8c48ac3d Remove "include redirects" option from search
Always include redirects. Search results are worse without them
and MWSearch has never respected this option anyway.

Change-Id: I0ebe321a3b14e7960aa98e3225dc5a19ba916e7d
2014-03-26 09:28:26 -07:00
jenkins-bot
b27385b95a Merge "Fix possible error list of action=revisiondelete" 2014-03-21 10:39:33 +00:00
umherirrender
38770513fa Exclude prop=uploadwarning from allimages and stashimageinfo
Was added with I4a0af8986f924cd127a73828e72da6998f28536c,
but looks only useful on prop=imageinfo

Change-Id: I59c5f11f83be7e59f317686ab7fa16ad6fda008b
2014-03-21 06:14:50 +00:00
umherirrender
ac55607876 Fix possible error list of action=revisiondelete
Bug: 62853
Change-Id: I0efec9e8a6cf761def7673011bcc22a9f11111a9
2014-03-20 21:10:50 +00:00
Aaron Schulz
96528b1f88 Avoid header notice log spam from RunJobs API
* Moved ApiRunJobs to a special page instead of going through
  ApiMain and having to fight the logic there. As a separate
  internal API, this does not show up on the API help page and
  is no longer effected by $wgEnableAPI.

bug: 62233
Change-Id: I1db6f526d02e130a66ee03289858a734d89e6c00
2014-03-18 22:30:50 +00:00
Chad Horohoe
f508561f7b Moved $wgQueryPages stuff out of the global scope and into a function
Change-Id: Ica034bdad89133bfce0b4238d62ed00865936644
2014-03-18 08:36:32 -07:00
jenkins-bot
26924b8726 Merge "Adjust magic bolding in api help to only match lines inside *" 2014-03-13 19:00:54 +00:00
umherirrender
cc10e13612 Adjust magic bolding in api help to only match lines inside *
list=logevents&leaction has param values with *, which gets bold, when
there was two of them in the same line.

Bug: 61834
Change-Id: Idace9afd4f3a2dce9be539b209a02fa318df8f45
2014-03-13 18:55:40 +01:00
Brad Jorsch
1d79bd6036 API: Handle exceptions from ApiBeforeMain hook in a user-friendly manner
The immediate impetus behind this change is this series of events:

1. CirrusSearch hooks ApiBeforeMain to handle some setup that requires
   the User object.
2. So User is loaded from the session.
3. OAuth checks the headers as part of loading User.
4. OAuth sees that the headers are invalid, and since it was called from
   the API it throws a UsageException, expecting the API to catch it and
   return an appropriate response to the client.
5. But nothing does so, leading to an unhelpful "Internal Error" page
   being returned to the client.

We can do better than that.

Bug: 62312
Change-Id: Ib5735661eec6ebe57eaa69c67b399e703cc90fc4
2014-03-12 19:26:20 +00:00
Bartosz Dziewoński
fc20c30d20 ChangesListSpecialPage: Separate all functionality for generating feeds
I should have done it at the beginning instead of trying to
extract it from recent changes.

Same for SpecialRecentChanges and SpecialRecentChangesLinked
(subclasses).

Created a new API module for it: ApiFeedRecentChanges.
It's somewhat un-API-like and hackish, but all feed modules are.

Old URLs redirect to new ones, so this should be fully
backwards-compatible assuming sane feed reader clients.

Change-Id: I06ee0f01d896bc66545a1800b24693ce7524e433
2014-03-12 12:31:41 +01:00
jenkins-bot
968f3cd2d8 Merge "Let wildcard actions work in list=logevents&leaction=" 2014-03-10 15:12:11 +00:00
addshore
719d7a2f03 Add final period to API module descriptions
Change-Id: Icae68c1ab1fd0006e00a3a9a56ae8f831d3d0d45
2014-03-10 09:04:08 +00:00
jenkins-bot
ff7d760e79 Merge "Remove final period from api module descriptions" 2014-03-09 20:09:25 +00:00
Reedy
6127e7c6dd Wrap long text
Change-Id: I37fe6fbdc8779ba86318e587c3d9e217bede400a
2014-03-09 15:10:24 +00:00
Reedy
8bed6734cf Remove API developer email addresses
They just end up being used for direct support requests that should
really be done on public mailing lists etc

Change-Id: If704ec8dff5fc4669165b580290cc29cf953a25b
2014-03-09 15:01:18 +00:00
umherirrender
4bb30b1e48 Let wildcard actions work in list=logevents&leaction=
The documentation of leaction= shows actions like "thanks/*", at the
moment this will result in a search for log_action='*', which is always
a empty list.

Changing the validation of param leaction to allow specific any string
for the asterisk in this wildcard action.

Change-Id: Ia77e499909ce6f25ce74617367fc5b622ea9a7c9
2014-03-07 21:25:13 +01:00
Nik Everett
142db358fc Have ApiRunJobs run periodic tasks
Without this apirunjobs can't handle delayed jobs.

Small inline comment updates as well.

Change-Id: I85ba0ac99eaebc16eaa7e2eb7019546241f3149c
2014-03-07 10:40:38 -05:00
Brad Jorsch
6182886b3d API: Fix logic for list=recentchanges prop=userid
When prop=userid is requested, we need the rc_user field; when prop=user
is requested, we need both rc_user and rc_user_text.

But for some reason when only prop=userid is requested the code is
requesting only rc_user_text and not rc_user. Fix that.

Bug: 62301
Change-Id: I86f1f35ebd18e45335cdf43ab3ba0a3e9b0e06b4
2014-03-05 22:59:04 -05:00
umherirrender
44c60036b5 Use a secondary db connection for Revsion::getParentLength in api
Getting api connection before the connection is set to the named
connection and store it in a local var to use it later.
Same comment as in Special:Contributions

Bug: 61982
Change-Id: Ia66c4a65a24876e2a528034e8e003aa535e6b689
2014-03-04 02:10:22 +00:00
umherirrender
d99e39a97f Remove final period from api module descriptions
The most description are without a final period, so that looks common.

Change-Id: If72a3cc094cfff436b53948728354cbaeff768c8
2014-03-02 20:20:56 +01:00
Aaron Schulz
df2f5dc7a6 Avoid API error/header leakage from jobs API
* Also cleaned up some HTTP headers while at it

bug: 62092
Change-Id: Ia2c1643e47aae53916c107c901cca654dc438a16
2014-02-28 21:44:49 -08:00
jenkins-bot
e997530e24 Merge "Add option to show only creations in Special:Contribs, API" 2014-02-28 16:40:25 +00:00
PiRSquared17
2dfbd7761a Add option to show only creations in Special:Contribs, API
* Add newOnly option to Special:Contributions
* Add to i18n files
* Add ucshow={new,!new,top,!top} to list=usercontribs
* Deprecated 'uctoponly' in favor of ucshow=top per Anomie.
* Add param 'newonly' to API action=feedcontributions
* Implementation: rev_parent_id=0

Bug: 42026
Change-Id: I07d597ef378d897690097804bf7c774fdadb654c
2014-02-28 16:21:28 +00:00
Aaron Schulz
2ea4d7ae8c Moved job running via $wgJobRunRate to a special API
* A background internal HTTP request used to load the API.
  This handles job execution and related periodic tasks.
  It avoids blocking the main request or breaking it on fatals.
* This method avoids problems that shelling could have:
** Mismatched apache/cli PHP config or versions.
** Had to start a new process and could not use opcode cache.
** safe_mode and open_basedir restrictions required a fallback.
** Some wiki farms may not respect the --wiki parameter.
** wgMaxShellMemory applies to spawned PHP processes.
** Spawning processes is more prone to DOS due to a lack
   of proper limiting/pooling.

bug: 60208
bug: 60210
bug: 60698
bug: 60844
Change-Id: I78b0e709301ac4a0c7b7ed337d6969d7546674bf
2014-02-27 19:12:04 +00:00
Brad Jorsch
55cd620157 SECURITY: API: Don't find links in the middle of api.php links
Bug: 61362
Change-Id: Idf985e4e69c2f11778a8a90503914678441cb3fb
2014-02-27 15:30:48 +01:00
jenkins-bot
96b04cef36 Merge "Support interwiki searches in API" 2014-02-26 18:03:58 +00:00
Brad Jorsch
893efc8ff0 Remove STRAIGHT_JOIN from ApiQueryLogEvents
Per Sean Pringle:
> In all cases the STRAIGHT_JOIN forces an index scan on logging.times
> index, or more rarely a range access on logging.type_time index. Both
> query plans hit tens of millions of rows and take many minutes.
>
> Removing the STRAIGHT_JOIN allows the MariaDB query optimizer to
> choose a plan that takes seconds. Often it includes a filesort step,
> but more importantly it allows "index condition pushdown" which makes
> the filesort cheap.

Bug: 61889
Change-Id: Iad3905f29a2bdee1e3ebbfb2e1909b330faa8e81
2014-02-26 00:45:04 +00:00
Chad Horohoe
653b7d63bc Support interwiki searches in API
Adds new SearchResult methods for getting namespace text

Bug: 60975
Change-Id: I381c8681cabfa9ff7a73cbe0286ed32d267a5990
2014-02-25 13:54:23 -08:00
Brad Jorsch
0ce8a2ac12 API: Add prop=redirects and list=allredirects
While redirects can be sort-of queried using list=backlinks with
blfilterredir=redirects, we can get more accurate results with a module
dedicated to this purpose. We can also get the fragment of the redirect
without having to load the content of the redirect page and parse it.

I'm a bit surprised I was able to put together a query for this that
will work as a prop module. Or did I overlook something?

And then we may as well add the corresponding list=allredirects, to work
like alllinks, allfileusages, and alltransclusions.

Bug: 57057
Change-Id: I81082aa9e4e3a3b2c66cc4f9970a97eed83a6a4f
2014-02-24 11:01:44 -05:00
umherirrender
2e1222109c Fix possible error list for action=query&list=blocks
possible errors for requireMaxOneParameter are generated with getRequireMaxOneParameterErrorMessages,
not getRequireOnlyOneParameterErrorMessages

Change-Id: Ia3d705ddf2f2d969b3112962a13f27dc9a106037
2014-02-24 14:50:06 +00:00
YuviPanda
efcf0a3f61 Make ApiCreateAccount return camelcase statuses
Bug: 61663
Change-Id: I214d8eb7c9d49f55f49c5228c92806601c5499f6
2014-02-20 20:49:45 +05:30
umherirrender
4ba3a9aea9 Add llprop=langname and llprop=autonym for action=query&prop=langlinks
This can helps the client to build a language html.

Change-Id: I54c66c8935b0dbbf3bf8e292236119597f1cbe41
2014-02-12 15:18:50 +00:00
jenkins-bot
561ec7b2c2 Merge "Deprecate llurl= in favour of llprop=url for action=query&prop=langlinks" 2014-02-11 18:47:52 +00:00
umherirrender
06debf1eb6 Deprecate llurl= in favour of llprop=url for action=query&prop=langlinks
New props will be added with I54c66c8935b0dbbf3bf8e292236119597f1cbe41

Change-Id: I1340b18b51bccdfaaddec6a16df320d5f6e5acfa
2014-02-11 19:29:10 +01:00
Brad Jorsch
3927a8fc65 API: Fix PHP warning in action=parse help output
Change I0f41c837 removed a variable while it was still in use.

Bug: 61210
Change-Id: I91ad2e374a85e149303c6e8da7c3d94c1285a72a
2014-02-11 10:36:14 -05:00