| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
A–F. Still need to do F–Z.
Bug: T353458
Change-Id: Ieb4bad0658b9cddc9403c6a55ef3bd1245aa08ae
|
|
|
|
|
|
|
| |
This does not include use of MediaWiki\Maintenance\Maintenance,
assuming the maintenance scripts going into the same namespace
Change-Id: I488f95b537ce86eb5e463be7bce3653610dd13d9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why:
* Maintenance scripts in core have bolierplate code that is
added before and after the class to allow directly running
the maintenance script.
* Running the maintenance script directly has been deprecated
since 1.40, so this boilerplate code is only to support a now
deprecated method of running maintenance scripts.
* This code cannot also be marked as covered, due to PHPUnit
not recognising code coverage for files.
* Therefore, it is best to ignore this boilerplate code in code
coverage reports as it cannot be marked as covered and also
is for deprecated code.
What:
* Wrap the boilerplate code (requiring Maintenance.php and then
later defining the maintenance script class and running if the
maintenance script was called directly) with @codeCoverageIgnore
comments.
* Some files use a different boilerplate code, however, these
should also be marked as ignored for coverage for the same
reason that coverage is not properly reported for files.
Bug: T371167
Change-Id: I32f5c6362dfb354149a48ce9c28da9a7fc494f7c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow Maintenance::error() and Maintenance::fatalError() to take
StatusValue objects. They now print each error message from the
status on a separate line, in English, ignoring on-wiki message
overrides, as wikitext but after parser function expansion.
Thoughts on the previously commonly used methods:
- $status->getMessage( false, false, 'en' )->text()
Almost the same as the new output, but it allows on-wiki message
overrides, and if there is more than one error, it prefixes each
line with a '*' (like a wikitext list).
- $status->getMessage( false, false, 'en' )->plain()
- $status->getWikiText( false, false, 'en' )
As above, but these forms do not expand parser functions
such as {{GENDER:}}.
- print_r( $status->getErrorsArray(), true )
- print_r( $status->getErrors(), true )
These forms output the message keys instead of the message text,
which is not very human-readable.
The error messages are now always printed using error() rather
than output(), which means they go to STDERR rather than STDOUT
and they're printed even with the --quiet flag.
Change-Id: I5b8e7c7ed2a896a1029f58857a478d3f1b4b0589
|
|
|
|
|
| |
Bug: T166010
Change-Id: I7257302b485588af31384d4f7fc8e30551f161f1
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is moderately messy.
Process was principally:
* xargs rg --files-with-matches '^use Title;' | grep 'php$' | \
xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1'
* rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \
xargs rg --files-with-matches 'Title\b' | \
xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1'
* composer fix
Then manual fix-ups for a few files that don't have any use statements.
Bug: T166010
Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a
Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
|
|
|
|
|
|
|
|
|
|
| |
so that extensions (i.e. CheckUser) can implement their own comment
store without having a lot of code duplication
basically the comment store version of I3a6486532f2ef36
Bug: T233004
Change-Id: Ib40f99e00a514d41776ce521baf113e46d37e9cd
|
|
|
|
|
|
|
|
|
|
| |
To follow Message. This is approved as part of RFC T166010.
Also namespace it but doing it properly with PSR-4 would require
namespacing every class under language/ and that will take some time.
Bug: T321882
Change-Id: I195cf4c67bd51410556c2dd1e33cc9c1033d5d18
|
|
|
|
|
| |
Bug: T166010
Change-Id: Idcf0e9dc6e0841e4f132207bce0f96774dad898c
|
|
|
|
|
|
|
| |
Allows scripts to edit pages that can vary by language, e.g. "{{int:mainpage}}"
or target pages using parser variables, e.g. "News_{{CURRENTYEAR}}".
Change-Id: I94bd613d34743739c6529f22c1dcccc27acc4e8b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Returning void from execute() is success.
Returning true is success, false is failure with exit(1)
Using fatalError also using exit(1)
Change-Id: I1d40430ad6226e4aab8f0810b03ee1213282d123
|
|
|
|
|
|
|
|
|
|
| |
One exception message contained a trailing dot/space, which I removed
as well, following I935835316c0.
A very small number of exceptions and output() calls contained trailing
space, which I removed for consistency.
Change-Id: I16f48c1a051c452bbef699eb9b7476d83f8821d8
|
|
|
|
|
|
|
|
|
|
|
| |
The user 'Maintenance script' is often used to perform various
automated tasks. Providing it everywhere as a string literal is
error-prone, and errors can be somewhat disruptive (e.g. with
User::newSystemUser with steal=true it can erase the credentials
of a legitimate account). Provide a constant instead.
Also replace existing uses for consistency.
Change-Id: I685a5bfe56bbf1a47f35072f7f7c8be320ee27db
|
|
|
|
| |
Change-Id: I5b2d4313f986484368da9b63c9a19892c2328dae
|
|
|
|
|
|
|
|
| |
Only use `wgUser` when setting or retrieving the global, not for
the user object that it is set to
Bug: T243708
Change-Id: Ie962192f1dbc066ba71b9abb48dc9d522d472c78
|
|
|
|
|
|
|
|
| |
Also remove print_r with a string
Always use english for maintenance scripts
Bug: T229843
Change-Id: I539a1ac1f6a201dd8ee9ce89599cc34bebfba79f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Benefit of keeping the parameter optional:
- In maintenance scripts that really only have one parameter, it's a
little more convenient to be able to ask for *the* parameter via an
empty getArg().
Disadvantages:
- It's unclear what getArg() means when there is no indication *which*
argument the code asks for. This might as well return the last
argument, or an array of all arguments.
- In scripts with two or more arguments, it's confusing to see
getArg( 1 ) next to an empty getArg().
- The methods are more complex and a bit more complicated to use with
the extra feature of this parameter being optional. Users need to
look up what the default is to be able to use it safely.
Change-Id: I22a43bfdfc0f0c9ffdb468c13aba73b888d1f15e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
During development a lot of classes were placed in MediaWiki\Storage\.
The precedent set would mean that every class relating to something
stored in a database table, plus all related value classes and such,
would go into that namespace.
Let's put them into MediaWiki\Revision\ instead. Then future classes
related to the 'page' table can go into MediaWiki\Page\, future classes
related to the 'user' table can go into MediaWiki\User\, and so on.
Note I didn't move DerivedPageDataUpdater, PageUpdateException,
PageUpdater, or RevisionSlotsUpdate in this patch. If these are kept
long-term, they probably belong in MediaWiki\Page\ or MediaWiki\Edit\
instead.
Bug: T204158
Change-Id: I16bea8927566a3c73c07e4f4afb3537e05aa04a5
|
|
|
|
|
| |
Bug: T202142
Change-Id: I97a74e5a029b014f3c2195188936d5c8233c1b7f
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds --slot and --remove options to the edit.php maintenance script,
to allow content of different slots to be edited, alots to be added, and
slots to be removed.
This is needed to help with testing MCR functionality, since EditPage
does not yet support MCR.
Bug: T189220
Change-Id: I985fb5afcd5d469fc31b32d2a927f425c40fc290
|
|
|
|
|
|
|
| |
This helps to find renamed or misspelled classes earlier.
Phan will check the class names
Change-Id: I1d4567f47f93eb1436cb98558388e48d35258666
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
Status::getWikiText is used for internal logging, api error messages and
maintenance scripts. All this places are usually in english, so pass an
english language to getWikiText.
Change-Id: I3010fca8eb5740a3a851c55a8b12e171714c78f7
|
|
|
|
|
|
|
|
|
|
| |
Per wikitech-l consensus:
https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html
Notes:
* Disabled CallTimePassByReference due to false positives (T127163)
Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
|
|
|
|
| |
Change-Id: I0e2aa83024b8abf5298cfea4b21bf45722ad3103
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I9388e6b3fec3c8ea92099aeaf010dd067f62a20f
|
|
|
|
| |
Change-Id: I2101360a934b8b9a92094c44429e3e2314c7fba3
|
|
|
|
| |
Change-Id: Iae44d0945a10832a7f6585d3620c8e994783457b
|
|
|
|
|
|
|
| |
Was breaking one of Echo's hooks
Bug: 49271
Change-Id: Ie1b5f5bc4a672bcfff3c99b9a76b37c502c09985
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
By PSR2 PHP Standard, the files should ends with exactly one newline.
Some of our files have 2 or more and some other were missing a newline.
Fix almost all occurences of CodeSniffer sniff:
PSR2.Files.EndFileNewline.TooMany
I have not fixed the selenium files, I believe we will drop them.
Change-Id: I89fca8c1786fee94855b7b77bb0f364001ee84b6
|
|
|
|
| |
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
|
|
|
| |
This reverts commit 67bfdc7a68940d901e585eadd984a2074bf0216a
|
|
|
|
| |
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
|
|
|
|
| |
Change-Id: I2c423744bd91044c37bbec53b35729bd1c09901b
|
|
|
|
| |
Change-Id: If0af9922ede902c2c6f18b627d5810f3e888c944
|
|
|
|
| |
Change-Id: I0e2869970c46f4fd14b792f2978cc1ba9d8550be
|
|
|
|
| |
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/107586
|
|
|
|
|
|
|
|
|
| |
-h alias to --help and -q to --quiet for all scripts
* Converted edit.php, people using short option version (with only one dash) won't have to change anything, but the ones using long options that were only one character (--u, --s, --m, --b and --a) will either need to change to short options or use full name
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/85557
|
|
|
|
|
|
|
| |
but could quite possibly break extensions that expect $wgTitle to be set during editing. I hate $wgTitle :(
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/81611
|
|
|
|
|
|
|
|
|
|
|
| |
maintenance rewrite). Right now, including a maintenance script causes it to execute. This is bad when you want to reuse the particular class but not have it start executing all by itself.
Until now, we relied on setting MW_NO_SETUP which was a) hacky, b) irreversable, and c) likely to be forgotten if you didn't use one of the wrappers like runChild().
Instead, move the freaky magic to doMaintenance and have *it* check if it's in a specific call stack that indicates this is being run from the file scope and should be executed. Rename DO_MAINTENANCE to RUN_MAINTENANCE_IF_MAIN so it's nice and clear what magic happens behind the require_once().
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/80205
|
|
|
|
| |
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/78372
|
|
|
|
| |
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/77711
|
|
|
|
| |
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/66977
|
|
|
|
| |
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/66751
|
|
|
|
|
|
|
| |
arguments like descriptions and proper requirement checks, similar to addOption()
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/55287
|