Also:
1. Other minor fixes in comments touched by this patch.
2. Add a separate test for subpage with spaces.
Change-Id: I267f19027098e5778b1cd491826e1741fc7ee794
And start using them instead of wfGetDB(), LB/LBF connection methods or
worse, $this->getDB().
$this->getDB() reuses the database object regardless of whether you're
calling a replica or primary, leading to returning a replica on a
primary and other way around.
Bug: T330641
Change-Id: I9e2cf85ca277022284fc26b9f37db57bd12aaa81
They're under 'specials' because that's where they're mostly used,
but they're just another kind of Pager (shown by their use outwith
the MediaWiki\Specials hierarchy, which is a bad code smell for us
to review later).
Bug: T166010
Change-Id: Iad3f91582b723c1e6679525aa852ffdfd8c6d5ba
Maintenance class provides a method for getting a fresh reference
of the MW services container instance. Let's make use of these in
maintenance scripts now that we have it.
NOTE: There are still some static methods like in refreshLinks.php
that makes use of services that we can't use this method for now.
Change-Id: Idba744057577896fc97c9ecf4724db27542bf01c
With this patch deprecation warnings will be emitted
if $wgUser is accessed or written into. The only pattern
of usage still allowed is
$oldUser = $wgUser;
$wgUser = $newUser;
// Do something
$wgUser = $oldUser;
Once there is no deprecation warnings, we know that nothing
legitimately depends on $wgUser being set, so we can safely
remove the code that's still allowed as well.
Bug: T267861
Change-Id: Ia1c42b3a32acd0e2bb9b0e93f1dc3c82640dcb22
1) The following methods were hard deprecated:
- User::addAutopromoteOnceGroups
- User::getEffectiveGroups
- User::getAutomaticGroups
- User::getFormerGroups
2) User ::getGroups, ::getGroupMemberships, ::addGroup,
::removeGroup were replaced in the production code,
but they were not hard deprecated because of conflict
with UserRightsProxy class.
Bug: T275148
Change-Id: Ia69598316f5dc5dd9511f6112b5b13e1aa07575a
This covers only directly used services by this special page and pager
Services used by the base class are not part of this patch set
Have to change the signature of one static function to avoid global
state and changed the caller as well
Bug: T259960
Change-Id: I9502c6cfd718b6edb074a50931094fcdbf2c48de
Deprecate the second argument to Maintenance::error() in favor of a new
Maintenance::fatalError() method. This is intended to make it easier to
review flow control in maintenance scripts.
Change-Id: I75699008638f7e99b11210c7bb9e2e131fca7c9e
AuthManager is coming, which will make it easier to add alternative
methods of authentication. But in order to do that, we need to finally
get around to ripping the password-related bits out of the User class.
The password expiration handling isn't used anywhere in core or
extensions in Gerrit beyond testing for expired passwords on login and
resetting the expiry date on password change. Those bits have been
inlined and the functions removed; AuthManager will allow each
"authentication provider" to handle its own password expiration.
The methods for fetching passwords, including the fact that mPassword
and other fields are public, has also been removed. This is already
broken in combination with basically any extension that messes with
authentication, and the major use outside of that was in creating
system users like MassMessage's "MediaWiki message delivery" user.
Password setting methods are silently deprecated, since most of the
replacements won't be available until AuthManager. But uses in unit
testing can be replaced with TestUser::setPasswordForUser() immediately.
User::randomPassword() and User::getPasswordFactory() don't really
belong in User either. For the former a new PasswordFactory method has
been created, while the latter should just be replaced by the two lines
to create a PasswordFactory via its constructor.
Bug: T47716
Change-Id: I2c736ad72d946fa9b859e6cd335fa58aececc0d5
Set the $commit parameter of WikiPage::doDeleteArticle() to true so
the transaction it starts is explicitly committed. Also fixed similar
bugs in two other maintenance scripts.
Follows-up 02f17b5790.
Bug: T110189
Change-Id: Ifde98066e25cb616f23c8998f9461ebf7a2073d6
* The delete calls already try to start transactions. Also CLI scripts
run in autocommit mode anyway.
Change-Id: I433691b3e4e578983e4e15334248f029e0b0d277
The main purpose of this script is to purge local overrides to
avoid them from blocking an i18n update in the future.
However empty messages should remain empty and often have a
richer edit history (e.g. Sitenotice) and may not stay empty
for long.
Change-Id: I5b416cda25a3641862df9919c46ae59ad5d5d6e0
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.
Also updated usage in text in documentation and the
installer LocalSettingsGenerator.
Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;
Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
Previously it ran for either the base pages (comparing against
content language) or 1 lang-code subpage.
And the latter was actually broken as it forgot to add the
subpage back on, thus resulting in incorrect deletions
(deleting MediaWiki:Foo instead of MediaWiki:Foo/nl).
Also fixed a bug where it used the subpage lang-code to create
a Language object and call ucfirst(). Page titles should only be
capitalized by content language.
Bug: 48050
Bug: 43917
Change-Id: I2680413c276365a44c935a6f6fdd740daa86341e
Squiz.WhiteSpace.LanguageConstructSpacing:
Language constructs must be followed by a single space;
expected "require_once expression" but found
"require_once(expression)"
It is a keyword (e.g. like `new`, `return` and `print`). As
such the parentheses don't make sense.
Per our code conventions, we use a space after keywords like
these. We appeared to have an unwritten exception for `require`
that doesn't make sense. About 60% of require/include usage
was missing the space and/or had superfluous parentheses.
It is as silly as print("foo") or return("foo"), it works
because keywords have no significance for whitespace between
it and the expression that follows, and since experessions can
be wrapped in parentheses for clarity (e.g. when doing string
concatenation or mathematical operations) the parenthesis
before and after basiclaly just ignored.
Change-Id: I2df2f80b8123714bea7e0771bf94b51ad5bb4b87
Also clarify that the talk page number is in addition to the
other number. So it says "10 pages are equal (+ 2 talk pages)"
instead of "10 pages are equal (2 talk pages)".
Document better that the default is a dry run.
Change-Id: I95edb08d7b92c393ed226bef2575e52a6135f8df