The funky iteration here was at best annoying. Switch
it over to an iterator based approach with appropriate
BC code to simulate the old iteration style.
Depends-On: I19a8d6621a130811871dec9335038797627d9448
Change-Id: I9fccda15dd58a0dc35771d3b5cd7a6e8b02514a0
Redundant given this is the project-wide license already,
especially in file headers that already include the GPL license
header.
This and other minor fixups based on feedback from Ie0cea0ef5027c7e5.
* Add @file where missing.
* Move @ingroup and @deprecated from file to class doc where needed.
Change-Id: I7067abb7abee1f0c238cb2536e16192e946d8daa
This deprecates the Preferences class and replaces it with
a PreferencesFactory service. Basically, all code from Preferences
is moved into DefaultPreferencesFactory. All Prefereces methods
are now either shims calling DefaultPreferencesFactory or just
throw exceptions.
Bug: T178449
Change-Id: Id0b2db0c2de0890f6e1609a9a0dca207c4600f99
Add fallback lookup based on the interface language to
Special:MyLanguage. Lookup order:
<user lang> -> <explicit lang> -> <fallback lang(s)> -> <base>
Example when the user's lang is arz:
arz -> <explicit lang> -> ar -> en -> <base>
Bug: T50292
Change-Id: I245cab71fdd4b4585f86dde808493cd69841b09a
Convert Watchlist settings to new UX, with following rules:
- If "Hide edits by anonymous users from the watchlist" is checked,
add "Registered" filter to defaults.
- If "Hide edits by logged in users from the watchlist" is checked,
add "Unregistered" filter to defaults.
- Change test for Special:Watchlist page, so new structured filters
are supported.
Bug: T172757
Change-Id: I27bdaa1401323fa3143f79a57dc5b9773e48fd1d
This works by using the new table introduced with T156318.
The only thing that differs from normal Special:Contribs is we are
showing the IP address next to each entry. This is it how it is
displayed if you request to see newbie contributions:
https://en.wikipedia.org/wiki/Special:Contributions?contribs=newbie
For the time being, Special:DeletedContributions does not support
IP ranges. Various other irrelevant links such as Uploads and Logs
are also hidden.
Refer to P4725 for a way to automate creation of edits by random
IPs in your dev environment.
IP::isValidBlock() has been deprecated with this dependent change:
https://gerrit.wikimedia.org/r/#/c/373165/
Bug: T163562
Change-Id: Ice1bdae3d16cf365da14c6df0e8d91d2b914e064
When the 'watchlistunwatchlinks' preference option is enabled, this
adds a '×' link to each entry of the watchlist that unwatches the page
of that entry. When clicked, it changes into a '+' which can be used to
re-watch the page (effectively undoing the earlier unwatch).
When a page is unwatched, its entries and the entries of its associated
talk page (or vice versa) become translucent and are struck through.
Without JS, '×'/'+' link to action=(un)watch for the relevant page.
In addition, ChangesList classes have been modified to allow a prefixer
that adds a prefix to each line (used in this case to put the unwatch
link) and to add HTML data attributes to reliably determine the target
page of each entry. Unit tests have been updated accordingly.
Bug: T2424
Change-Id: I450b2901413d7e75c11de2a446829fdbb22d31e1
Reenable MediaWiki.WhiteSpace.SpaceBeforeClassBrace.NoSpaceBeforeBrace,
because the mentioned bug is fixed
Bug: T172933
Change-Id: I1593bdba2295ebed401b921f2beabed69dba7638
This new config variable ($wgShortPagesNamespaceBlacklist)
allows wikis to specify namespaces which should be excluded from
Special:ShortPages.
This will be used by Commons, for which NS_FILE is a content namespace
(accessible via Special:Random and Special:Nearby) but is not useful
to list on Special:ShortPages.
If the blacklist cancels out all namespace in wgContentNamespaces then
all namespaces will show up on the page.
Bug: T170687
Change-Id: I10b4849a5d7f3f8af75ccc6cfba230d03725c898
Allow fractional values (e.g ?days=0.25). Previously, fractional values
were rounded down (truncated) to integers.
When computing the cutoff timestamp, don't round down to midnight UTC.
This caused a strange phenomenon where ?days=1 would display between
24 and 48 hours' worth of changes depending on when you used it:
if the current time was 2017-07-24 23:59 UTC, the cutoff would be
set at 2017-07-23 00:00 UTC so you would see almost 48 hours' worth,
but if you refreshed two minutes later, the cutoff would be set at
2017-07-24 00:00 UTC and you should see just over 24 hours' worth.
In addition to this strangeness, it also made fractional values
somewhat meaningless and made a feature like "show only the last 3 hours"
impossible to implement.
Bug: T162784
Change-Id: I75b71324e29a4da09939c4b00feeb4cb556f797c
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168
Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||
Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
* Convert year/month date filter parameters to use start/end so that
ApiFeedContributions still works as expected after b668887
* Move SpecialContributions::processDateFilter (used to convert
year/month parameters to start/end parameters) to ContribsPager
since ApiFeedContributions also uses it now
Bug: T166859
Change-Id: I34fc8388a29e4cd36474934e6266127d0e3253cd
* Add two DateInputWidgets to Special:Contributions, one for start and
one for end
** If start input is empty but end input is not, display edits up to end
input, and vice versa
** If both inputs are specified, display edits between the two dates
** If both inputs are empty, no date range is used
* Legacy options (year=/month=) are converted to use for the end
timestamp, so URLs with them should still work.
* Unit tests!
Bug: T120733
Change-Id: Id15f2b2ce2954fe98dfbbb7b0e86c0e4e5713f5e
It's ; for namespaces (since that is generally what we're using,
e.g. for STRING_OPTIONS), and | for tags. I would have
preferred them to all be consistent, but there is one revision
that has a ;, and this seems better than modifying the DB.
Comma is already used as a delimiter between separate parameters
(e.g. hideanons and namepsace).
Also, fix multiple namespaces for parseParameters and add test
cases.
Bug: T164132
Bug: T164133
Change-Id: Iad061e0bc17e3522a3f5d330ac2c8bf9cf0e614f
Some combinations of RC filters should never appear
together because they guarantee to return no data
and cannot be visually represented in the new RC
filters UI (ERI project).
Examples include:
* 'hidemyself' and 'hidebyothers'
* 'hideminor' and 'hidemajor'
* All of the filters in the changeType group (which
is extended by extensions)
This also handles an old special case, but it now redirects
instead of doing it silently:
hideanons=1 & hideliu=1 & hidebots=1 -> hideliu=1 & hidebots=1
hideanons=1 & hideliu=1 & hidebots=0 -> hidehumans=1
Bug: T151873
Change-Id: Id08dccd07b262ce61c9d38563f19a0ab181e2341
Replaces \TestingAccessWrapper (defined in core) with
\Wikimedia\TestingAccessWrapper (defined in the composer package
wikimedia/testing-access-wrapper).
See https://gerrit.wikimedia.org/r/#/q/topic:librarize-testing-access-wrapper
for downstream patches.
The core version of the class is kept around for a while to avoid
circular dependency problems.
Bug: T163434
Change-Id: I52cc257e593da3d6c3b01a909e554a950225aec8
The default will remain PHPUnit 4.x due to PHP 5.5 support.
But, we should allow developers to run tests with newer PHPUnit
versions which are noticably faster (especially for code coverage
reports).
* <https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-5.4.0>
PHPUnit 5 deprecates the getMock() shortcut for getMockBuilder()->getMock().
It instead introduces the shortcut createMock() which has better defaults
than getMockBuilder(). For example, it sets 'disableArgumentCloning' and
other things by default.
Going forward, code should either use getMockBuilder directly and configure
it using the setter methods (instead of the confusing variadic arguments
of getMock) or simply use the new minimalistic createMock method. This patch
backports the createMock method to MediaWikiTestCase so that we can start
using it.
Change-Id: I091c0289b21d2b1c876adba89529dc3e72b99af2
SearchResult::newFromTitle involves database connnection,
thus better to avoid calling this in the data provider.
Change-Id: I891e97cf18ca1dd44abefe01731dfc5da51f1982
Fix a regression caused by aa063f4c5a. Restore the behavior
where:
* Without action=submit: Boolean preferences apply to the displayed form and its
results, but they can be overriden by the query string.
* With action=submit: Only boolean parameters in the query string apply;
preferences are not considered.
(However, boolean preferences not on the form, i.e. 'extended', still
always apply.)
This behavior is a consequence of how checkboxes work in HTML; only
checked boxes are sent to the server.
Bug: T160734
Change-Id: Ic050dd1445ade9449496bb051f04ca0a87b8b5d7
Generate old RC, Related changes (it was already displayed and working
on 'Related changes' before this change), and Watchlist/etc. and data
for new UI from back-end.
This moves everything used for defining the old (unstructured) and new
(structured) filters into unified objects, ChangesListFilter and
ChangesListFilterGroup (and sub-classes).
This includes the query logic (see below) and logic for adding
CSS attribution classes.
This is a breaking change (for subclasses of ChangesListSpecialpage)
due to the signature (and name) change of buildMainQueryConds and
doMainQuery. An alternative that I don't think is a breaking change
would be to put the filter->DB logic in runMainQueryHook, but then it's
doing more than just running a hook.
This is because it used to only build $conds here, but it's clear from
filterOnUserExperienceLevel filters need more than this. I added all
the DB parameters from the hook, but this could be debated.
I have an checked and fixed the WMF-deployed extensions affected by
this.
Other than that, there should be full back-compat (including legacy
filters not using the new system).
* add hidepatrolled/hideunpatrolled to new UI.
* Move userExpLevel from RC to ChangesListSpecialPage. Although for
now the structured UI only displays on RC anyway, when it displays on
watchlist, it seems we'll want userExpLevel there.
Change this to make 'all' exclude unregistered users.
* Don't have front-end convert none-selected to 'all' on string_options.
* Needs the hideanons/hideliu special redirect to be done before this
is merged (T151873)
Bug: T152754
Bug: T152797
Change-Id: Iec2d82f6a830403d1c948a280efa58992e0cdee7
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.
Change-Id: I46261416f7603558dceb76ebe695a5cac274e417
Not a big change, but makes it so there is only one path into
SpecialSearch::showResults(). Makes things a little easier to follow.
Also moves the code for checking if full text search is disabled into
execute(), makes sense to check before even trying to make a search
engine. Also moves some setup code out of execute and into the setupPage
function
Bug: T150393
Change-Id: Ib527fc3a3c39eb2e56985e5d1e4905fc4562353c
The new system message uncategorized-categories-exceptionlist can be changed
on-wiki to hold a list of categories, that shouldn't be visible on the special
page Special:UncategorizedCategories (with a trailing "* "), even if
these categories aren't in any category.
Bug: T126117
Change-Id: I65989e40f3caa2fad7b8b35109c0466e01084f72
Allows filtering changes based on user
experience level. Supports the following
levels: 'newcomer', 'learner', 'experienced'
Will be used by the ERI project.
Bug: T149637
Change-Id: Ib2ac92925836ce2f3706d898968538aa18d14d5d
'hidemajor', along with the existing 'hideminor'
RC filter, allow showing just the minor edits,
just the major edits, or both.
This will be used by the ERI project.
Bug: T149863
Change-Id: I936a4a1b13d8c4a15c745012cd0f82207d9e57ca
Allows hiding edits that have not been patrolled.
In other words, showing only edits that have been patrolled.
Will be used by the new Special:RC filters (ERI project).
Bug: T152061
Change-Id: I3cd896812c5af87bc4be53d493055c37298c712f