Commit graph

576 commits

Author SHA1 Message Date
Florian Schmidt
2d82f0881a PageArchive: Fix typo in class file
Follow up: I02b7e4785f369c7b6574c4bce093b6de58d1c651

Change-Id: Iec60fb023ef3c57e61ee29c829f750ca1b34467e
2017-03-06 22:46:55 +01:00
Florian Schmidt
03927b2ec1 Move PageArchive class to it's own file
Change-Id: I02b7e4785f369c7b6574c4bce093b6de58d1c651
2017-03-05 22:15:09 +00:00
jenkins-bot
207191ef15 Merge "Move ProtectedPagesPager to it's own file" 2017-03-03 19:05:45 +00:00
Stephane Bisson
3db26d8d8b Maintenance: init a user preference based on another preference
For the ERI beta feature, we want the feature to be
enabled by default for the users who have the ORES
beta feature enabled at the time of the release.

Bug: T159007
Change-Id: Ibf0f9095c7a611a513711badf00f937ac8dc1b63
2017-03-03 11:02:58 -05:00
Aaron Schulz
e01fd44388 Move ResultWrapper subclasses to Rdbms
Change-Id: I6f3f0e85e268b24c57c537aa6ad8016e0b4cdddb
2017-03-03 00:44:41 +00:00
Florian Schmidt
4d24132c33 Move ProtectedPagesPager to it's own file
Change-Id: I79aecf74e4a71b05247e0c4a0e44f7a97e672507
2017-03-02 19:00:48 +01:00
Timo Tijhof
bb33522e26 resourceloader: Add purgeModuleDeps.php maintenance script
Based on cleanupRemovedModules.php. Update both to use safer batching,
based on known selection instead of recursing until the table is empty
(which may end up deleting new rows from live traffic).

Bug: T158105
Change-Id: I05f650a0cfa8ca647f143a40e1087338adbef6da
2017-03-01 11:27:34 -08:00
Kunal Mehta
a57b64436c Use wikimedia/timestamp
Bug: T100924
Depends-On: I0a067367cda6885fa45631ed7c18799d653dc9bf
Change-Id: I69ba64e364df8af089c1c918cdf32f99454e693a
2017-02-28 21:15:38 -08:00
jenkins-bot
ea79f57eb0 Merge "maintenance: Replace implicit Bugzilla bug numbers with Phab ones" 2017-02-28 00:37:39 +00:00
Florian
8d010b9721 Add maintenance script to add sites to sites table
Also: Add language code validation to Site::setLanguageCode().

Bug: T132937
Change-Id: I763ec65cb06d5250a3886a66eefdde8701b2299c
2017-02-26 16:30:13 +00:00
jenkins-bot
6ad363a177 Merge "Log a backtrace from the culprit location if headers were already sent" 2017-02-24 22:41:45 +00:00
jenkins-bot
c10cdec089 Merge "Move remaining LoadBalancer classes to Rdbms" 2017-02-24 05:25:29 +00:00
Aaron Schulz
64df456b39 Move remaining LoadBalancer classes to Rdbms
The old names are left as aliases.

Change-Id: I52a327f2463a2ba7437324047b5b00d28cd1d758
2017-02-23 20:38:31 -08:00
jenkins-bot
3635092917 Merge "Drop in replacement of eval.php based on psysh" 2017-02-24 01:20:16 +00:00
Tim Starling
f193271cff Log a backtrace from the culprit location if headers were already sent
Install the backtrace collector very early, so that we can get the
backtrace even if headers were sent from LocalSettings.php.

Bug: T157392
Change-Id: I9bc732b34481c95afb5362e135a87bd4302498e2
2017-02-23 14:10:12 +11:00
James D. Forrester
242df680ce maintenance: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

This includes renaming fixBug20757.php to fixT22757.php for similar consistency.

Change-Id: If81a590d658fbd82c20c54ac47dfdc8856745ca3
2017-02-21 18:32:44 -08:00
Aaron Schulz
2dc621fd82 Move ORAResult to /db
Change-Id: I9be89faef693343a4071d7c29b6ca0c021e7fb63
2017-02-17 03:07:14 +00:00
Aaron Schulz
8a5d8c0c71 Move Field classes to Rdbms namespace
Update core callers and leave a class alias to \Field.

Change-Id: I4908282301d5de2a20baafe510557bd2c3867de5
2017-02-16 01:14:37 +00:00
Aaron Schulz
019fa7cb9c Move Blob class to Rdbms namespaces
Leave \Blob as an alias. Callers can now use the Rdbms\Blob class
for "extends"/"new" and the Rdbms\IBlob interface for type hints.

Change-Id: I983b76f181ac60c1eb92c350cd27ad77ec90a192
2017-02-13 21:07:00 +00:00
Antoine Musso
7671b2b71e Drop in replacement of eval.php based on psysh
eval.php is meant to eval() commands in MediaWiki global scope. We had
at least a couple attempts to move it to a regular Maintenance script.

As noted on the revert commit b475e930 r54839, using a Maintenance
script drop us in the callee function scope instead of the global scope
which is a hard requirement.

http://psysh.org/ is a Read-Eval-Print-Loop with color highlight, modern
code and more.

Add maintenance/shell.php script as MediaWikiShell class.

Passing command from stdin is supported.
Execution is forked for graceful handling of PHP fatal errors.
Colors!!
Support the undocumented '-d' arguments from eval.php:
  0 set $wgDebugLogFile to stdout. Eval.php used /dev/stdout, make it
    php://stdout in the new script.
  1 additionally set DBO_DEBUG on all the database load balancer servers

PHP globals have to be whitelisted which is not supported out of the box
by Psy. Upon request, the author of PsySh, Justin Hileman, kindly
provided a pass to inject globals (with the exceptions of super
globals). He agreed for code reuse:
    https://github.com/bobthecow/psysh/issues/353
The code was added to maintenance/CodeCleanerGlobalsPass.inc

Note that this is not a perfect simulation of global scope (but pretty
close): variables declared in the shell which did not exist before
won't be global unless the 'global' keword is used.

Example usage:

$ php maintenance/shell.php

>>> $wgFullyInitialised
=> true

>>> $hashar = User::newFromName( 'hashar' )
=> User {#274
     +mId: null,
     +mName: "Hashar",
     ...

>>> ls --long --all $h
<descriptive output of all object properties/methods>

Bug: T117661
Signed-off-by: Justin Hileman <justin@justinhileman.info>
Signed-off-by: Gergő Tisza <tgr.huwiki@gmail.com>
Change-Id: I3d6d42e138d3cc4a0aaafdd7f5f97cb17d8b8cb3
2017-02-13 08:34:38 +00:00
jenkins-bot
71803987d3 Merge "Create IResultWrapper interface for type-hints" 2017-02-10 22:01:43 +00:00
jenkins-bot
03000d40b7 Merge "Move mssql class to /libs" 2017-02-10 20:20:16 +00:00
Aaron Schulz
2f2b1661fa Move mssql class to /libs
* Inject global variables in MWLBFactory.php
* Remove incompatible ignoreErrors() override which is only called
  from the base classes.
* Remove use of wf* methods.

Change-Id: Idf8202474182cc82fb6ef453e2722e7af17e32aa
2017-02-10 10:31:52 -08:00
Aaron Schulz
864eab03e7 Move DBMasterPos to Rdbms namespace
Updated all callers

Change-Id: Iacd5d6f7f18d8b23df24637cda61592112490eb0
2017-02-10 02:38:56 -08:00
Aaron Schulz
3bb4e07a08 Create IResultWrapper interface for type-hints
Change-Id: Ie46ede59c09eb7b0b9ff06c6988e39fe2a953e46
2017-02-10 02:26:57 -08:00
Aaron Schulz
6494ea0ba0 Move ILoadBalancer to Rdbms namespace
All callers are in core and have been updated.
Other callers can now be switched from LoadBalancer type hints to
ILoadBalancer type hints. Once that migration is done, the classes
implementing it can be moved too.

Change-Id: I6b34099b5816dd8bf9646ed39f7a2d1960e2ed06
2017-02-07 23:22:36 -08:00
Aaron Schulz
38b31bc8db Move DatabaseDomain to Rdbms namespace
Change-Id: Ifb06e792a36b5123ec3596933d0d394711ee5d08
2017-02-07 13:21:40 -08:00
Aaron Schulz
a57af76a0f Move LikeMatch to Rdbms namespace
Change-Id: I0cba263cd02fc5c4bfe8f063f38d1b4be28246b0
2017-02-06 21:20:39 -08:00
Aaron Schulz
4a177b34ef Move LBFactory to Rdbms namespace
Change-Id: I5ae10783228d0252284807c9562bc8e328d4becb
2017-02-03 17:24:03 -08:00
jenkins-bot
ec84fa3d7d Merge "Displaying interwiki results in sidebar" 2017-02-03 19:04:54 +00:00
Jan Drewniak
d78a470fcd Displaying interwiki results in sidebar
Displays newly designed interwiki search results in the
sidebar of the specialSearch page.

A prototype of this change can be viewed on this labs url:

http://sistersearch.wmflabs.org/w/index.php?title=Special:Search&search=mars

Bug: T149806

Change-Id: I66e4b6a502dae488d105f11cad73e145990c2327
2017-02-03 18:18:20 +01:00
jenkins-bot
407155c20b Merge "Move LoadMonitor to Rdbms namespace" 2017-02-02 20:15:58 +00:00
jenkins-bot
fb52b78920 Merge "UsersMultiselect widget and form field." 2017-02-01 14:37:50 +00:00
Timo Tijhof
39a6e3dc4d Refactor RCFeed configuration (backwards compatible)
Previously:
* Engines had to be registered in $wgRCEngines.
* The RCFeedEngine classes took no constructor arguments and
  were expected to send whatever text is previously formatted
  without any information about it. This generic design was
  flexible in allowing one to use any formatter with any engine
  with minimal configuration and no need for additional classes.
* Each feed configured their destination by setting a 'uri'
  option that encodes the name of the engine in PHP as the uri
  scheme. Other uri components had to be used for any other
  parameters to the engine (host, port, path). While fairly
  limited, it was sufficient for the default engines in core.

Changes:
* Allow feed classes to be directly associated with a feed in $wgRCFeeds
  via a new 'class' option - without the indirection of 'uri' and
  $wgRCEngines. All options are passed to the given class constructor.
  This matches the design used elsewhere in MediaWiki. (ObjectCache,
  FileRepo, FileBackend, JobQueue, LBFactory, etc.)

  This means we no longer enforce a 1:1 mapping of internet protocols
  to a specific feed engine, and it allows settings to be passed
  without being encoded as a URI neccecarily.

  Main use case for this refactor is EventBus (see I7edc4d57fa),

  Interestingly, this matches the (then incorrect) documentation
  written for $wgRCFeeds in 2961884b43 (which mentions an 'engine'
  property that would do the same thing).

* Move the default 'omit' filters and unrestricted 'formatter' handling
  to a new FormattedRCFeed class, which remains the default.

* Deprecate RecentChange::getEngine() in favour of RCFeed::factory().

* Document wgRCEngines as "@since 1.22". Follows 2961884b43, ffc71cb6af.

Change-Id: I8be497c623c5d928762e3d3406a388f4d91add9a
2017-02-01 04:23:38 +00:00
Aaron Schulz
2c7b26c169 Move LoadMonitor to Rdbms namespace
Change-Id: Icc178acb5ba0e21d1a8e857c43724c694c7ebeb1
2017-01-31 19:45:54 -08:00
Phantom42
c70f464c07 UsersMultiselect widget and form field.
New widget and html form field, which allows selecting multiple
users using convenient single-line input (CapsuleMultiselectWidget)

Bug: T131492
Change-Id: I7b6ffe7fb47e0a7083e2a956156ab0f142444398
2017-02-01 00:35:33 +02:00
jenkins-bot
0eae584888 Merge "Move ChronologyProtector/TransactionProfiler to Rdbms namespace" 2017-01-31 04:00:24 +00:00
This, that and the other
73224f4f8b User group memberships that expire
This patch adds an ug_expiry column to the user_groups table, a timestamp
giving a date when the user group expires. A new UserGroupMembership class,
based on the Block class, manages entries in this table.

When the expiry date passes, the row in user_groups is ignored, and will
eventually be purged from the DB when UserGroupMembership::insert is next
called. Old, expired user group memberships are not kept; instead, the log
entries are available to find the history of these memberships, similar
to the way it has always worked for blocks and protections.

Anyone getting user group info through the User object will get correct
information. However, code that reads the user_groups table directly will
now need to skip over rows with ug_expiry < wfTimestampNow(). See
UsersPager for an example of how to do this.

NULL is used to represent infinite (no) expiry, rather than a string
'infinity' or similar (except in the API). This allows existing user group
assignments and log entries, which are all infinite in duration, to be
treated the same as new, infinite-length memberships, without special
casing everything.

The whole thing is behind the temporary feature flag
$wgDisableUserGroupExpiry, in accordance with the WMF schema change policy.

The opportunity has been taken to refactor some static user-group-related
functions out of User into UserGroupMembership, and also to add a primary
key (ug_user, ug_group) to the user_groups table.

There are a few breaking changes:
- UserRightsProxy-like objects are now required to have a
  getGroupMemberships() function.
- $user->mGroups (on a User object) is no longer present.
- Some protected functions in UsersPager are altered or removed.
- The UsersPagerDoBatchLookups hook (unused in any Wikimedia Git-hosted
  extension) has a change of parameter.

Bug: T12493
Depends-On: Ia9616e1e35184fed9058d2d39afbe1038f56d7fa
Depends-On: I86eb1d5619347ce54a5f33a591417742ebe5d6f8
Change-Id: I93c955dc7a970f78e32aa503c01c67da30971d1a
2017-01-27 09:24:20 +00:00
Aaron Schulz
2e5eb693de objectcache: add WANObjectCacheReaper for assuring purges
* This fixes keys based on some sort of change log.
  Updates are wrapped in a mutex and keep track of the
  last known good position.
* Make WANObjectReapUpdate class that cleans up title
  related keys using the recentchanges table. This triggers
  as a deferred updates on RC view.

Change-Id: I7f14b9ca2533032147e62b1a3cc004a23da86579
2017-01-27 02:21:06 +00:00
Aaron Schulz
59053a0716 Move ChronologyProtector/TransactionProfiler to Rdbms namespace
Change-Id: I37a655bd8bd267c9bc32028b55925b2dce527d33
2017-01-26 10:30:57 -08:00
Max Semenik
13054a4c70 refreshLinks.php: allow refreshing by categories, tracking or not
Needed for selective updates of pages using a particular feature.
Intended to be run in production, so needs to scale.

Bug: T149723
Change-Id: If20fb1f91de8d4227def5b07d6d52b91161ed3fd
2017-01-23 14:30:16 -08:00
Aaron Schulz
b38e4461db Add small script for common job queue admin tasks
This can handle dropping queued and re-enqueueing abandoned jobs.
Also use the DB cache table to avoid re-enqueuing duplicate jobs
if this has to get used several times for a queue during a week.

Change-Id: Ib56cf57e56f03ce6f1c4b52e3e36f228413c1056
2017-01-18 16:14:21 -08:00
Erik Bernhardson
c43655edc9 Extract 'did you mean' widget out of SpecialSearch
Bug: T150390
Change-Id: I41d767550ab4112fcd9cc4094b27a14c7d29169b
2017-01-17 15:58:00 -08:00
Erik Bernhardson
a0936780bb Extract main search result rendering from SpecialSearch
Has a pre-existing problem related to the link offset of secondary
inline results. Specifically the offset of secondary inline starts
at the provided offset, even though there may be primary results
displayed above it.

Bug: T150390
Change-Id: Id1d6b357f45a2cf615d9412cc95dd597c724e8b6
2017-01-17 15:57:40 -08:00
jenkins-bot
350dcb4cd7 Merge "Extract search form from SpecialSearch into widget" 2017-01-17 23:32:30 +00:00
Erik Bernhardson
d400f7a668 Extract search form from SpecialSearch into widget
Bug: T150390
Change-Id: Ibda84349e1f552641805d6236605c8718540817f
2017-01-17 15:12:22 -08:00
jenkins-bot
90cd6d2426 Merge "Pull rendering of single result out of SpecialSearch" 2017-01-07 07:26:05 +00:00
MtDu
d08751030c Add API action to set the language of a page
Currently, a user who wants to set a page's language must use the
Special:PageLanguage interface. However, this is not easy for bots and
scripts to use. The addition of action=setpagelanguage to the API makes
this process easier for such users.

Bug: T74958
Change-Id: I42e74ed3bcd0bfa9ec0c344ba67668210450c975
2017-01-05 03:19:32 +00:00
Erik Bernhardson
6e155624fa Pull rendering of single result out of SpecialSearch
First step in refactoring the search results page. Pulls out widgets
to render our two styles of search result, Full and Simple.

Bug: T150390
Change-Id: If78cb0c29ae394f16e465c15a8e8246c1b56dcea
2017-01-04 13:33:19 -08:00
divadsn
7492975a28 Removed deprecated class ImageGallery
Bug: T61113
Change-Id: If315002ef7d1a3937f150d0dda930976c1d95f57
2017-01-01 15:56:55 +00:00