Add doc-typehints to class properties found by the PropertyDocumentation
sniff to improve the documentation.
Once the sniff is enabled it avoids that new code is missing type
declarations. This is focused on documentation and does not change code.
Change-Id: I7dec01892a987a87b1b79374a1c28f97d055e8fa
Why:
* The logging table on en.wikipedia.org contains an entry from
2005 which is an unblock of an autoblock. However, the log_title
contains the namespace, which makes the code that looks for
logs which target an autoblock fail (because it checks for the
first character being '#').
* Fixing the log_title to remove the 'User:' prefix from rows which
are autoblocks (i.e. searching for log_titles which start with
'User:#') should address the exceptions seen on Special:Log for
these rows.
** The search can be limited to rows which have the 'unblock'
log_action, as this has only been seen for this type of log.
What:
* Create fixAutoblockLogTitles.php which searches for the entries
and then updates the log_title value to no longer include the
'User:' prefix
** The queries to search are split, such that the expensive LIKE
query is performed on batches of row IDs. If the LIKE query is
applied directly to all rows in the table, the query takes 30s
to run on WMF production.
* Add this maintenance script to update.php. It will be run once
as the class extends LoggedUpdateMaintenance.
* Test the newly added maintenance script to ensure it works.
Bug: T373929
Change-Id: Ia62db56eda456bb764303b5f4b5a29be8f2d8fff
Improve maintainability of update-keys.sql by moving the list from an
SQL file to a PHP array in the same file as the updates it is disabling.
It was apparently an SQL file for the convenience of third parties
wishing to install MediaWiki by manually sourcing tables.sql. Support
this use case by adding an option to update.php which inserts the update
keys. Users should source tables-generated.sql and then run
update.php --initial
The array is the same for each DB type, but it's correct for it to have
the same scope as getCoreUpdateList(). Factoring out common parts of
getCoreUpdateList() and this new array is a separate project.
Bug: T167924
Change-Id: I404ee29aadcc2f3f24f78d1111090395129cd021
Why:
* The deleteSelfExternals.php maintenance script is broken on
my local wiki as the SQL generated by the script errors out
when run on MariaDB.
* This script should be fixed, updated to use the query builders,
and tested to ensure that any future breakages do not go
unnoticed.
What:
* Fix the deleteSelfExternals.php script to use a DELETE query
that works, by generating it using the query builder.
* Create DeleteSelfExternalsTest to test that the script now
works.
Bug: T371167
Change-Id: Id423fa5c1bfe666f57a38e733334342ac1ad2cea
This is the fourth patch of a series of patches to remove
ParserOutput::getText() calls from core. This series of patches should
be functionally equivalent to I2b4bcddb234f10fd8592570cb0496adf3271328e.
Here we replace calls to getText where a ContentRenderer is available
close by by temporary ParserOutput::runOutputPipeline that will
eventually be replaced by a call to (probably) ContentRenderer
(T371004). Doing this work in stages allows us to separate the work of
"bring ParserOptions to the call site" from the work of "bringing
ContentRenderer(ish) to the call site", since both need to be done for
to make ParserOutput a value object (T293512).
Change-Id: Ib4f9357293dc230df6e0ca2379a1e2a4cc1b91b7
Bug: T293512
wfGetServerUrl is deprecated since 1.39, let's remove the
only use and turn it into a hard deprecation.
Change-Id: I82be851fe411cd002c9c5847fe3924a6c0a4ba50
Why:
* The Maintenance::runChild method is named in a way which makes
it easy to assume that calling the method will directly
execute the passed maintenance script
** The documentation does not help either, with it also implying
that the script will be run once the method is called.
* Instead callers are expected to run the maintenance script by
calling ::execute on the returned object
* The method name should be changed to make this clearer and
the documentation improved.
What:
* Rename Maintenance::runChild to ::createChild, which makes it
clearer that the maintenance script has not been run
** Leave ::runChild as an alias to ::createChild, as ::runChild
was marked as stable to override.
* Improve the documentation for Maintenance::createChild to
make it clear that callers need to call ::execute on the returned
Maintenance object.
Bug: T371789
Change-Id: I7d0914ebaaa3ff5da05bccebb57cc76aad120dd5
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs
What:
* Fix grep.php to batch requests for rows from the page table,
as it currently selects all rows in one go.
** Doing this on large wikis would result in millions of rows
being returned in one query.
* Create GrepPagesTest
Bug: T371167
Change-Id: I4c9a55257ee64609fece776ca15c4219764d5266
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs
What:
* Create UserOptionsMaintenanceTest which starts on tests for this
script.
Bug: T371167
Change-Id: I51374a96a0dd73f5a155278f5a48c5b59c44d055
Why:
* The FakeMaintenance class contains no code execept for an
empty definition of ::execute
* Testing this class would therefore only involve checking that
constructing it and calling ::execute does nothing
* Instead, ignoring the file for test coverage should be
sufficent.
What:
* Mark FakeMaintenance as excluded for test coverage.
Bug: T371167
Change-Id: I7da4791d231fa7e2c4f514d3cf6ca7c492594f25
It's possible for multiple invalid titles to normalize to the same
title. The script tries to catch this, but it uses a replica database
for it, which might not have picked up an earlier change in the same
maintenance script. This caused the cleanupTitles run on ptwiki to crash
(and somehow escaped notice until now)
Bug: T195546
Change-Id: I2a4a34ce99067986d7c44605c796323c4d77dc4e
Why:
* Maintenance scripts in core are mostly untested and testing them
will help to avoid regressions.
What:
* Create CommandLineInstallerTest.
Bug: T371167
Change-Id: Ia9ef03326d7c25b7eb310c191034932fffcbff8c
Why:
* Maintenance scripts in core have low test coverage
* Improving this will reduce the chances of regressions and bugs
What:
* Create CreateBotPasswordTest which fully tests
createBotPassword.php maintenance script.
* While doing this, address a PHP warning that appears when the
user does not specify the 'grants' option.
Bug: T371167
Change-Id: I8256c278b8397de896906e5714d478883b518ba0
Why:
* Maintenance scripts in core are mostly untested and testing them
will help to avoid regressions.
What:
* Create JSParseHelperTest that fully tests the associated
maintenance script.
Bug: T371167
Change-Id: I6ae5d9722169518dd19fd5136b12b7ecd6a22798
Why:
* Maintenance scripts in core are mostly untested and testing them
will help to avoid regressions.
What:
* Create MoveBatchTest that fully tests the associated maintenance
script.
Bug: T371167
Change-Id: I2244f46e34e81c98a2647e00b229ca68bc3d3568
Why:
* Maintenance scripts in core are mostly untested and testing them
will help to avoid regressions.
* Doing this for frequently run scripts is important, as they
may fail in ways not caught by running them in CI.
What:
* Create CheckComposerLockUpToDateTest that fully tests the
associated maintenance script.
** Move test case composer JSON files used by the LockFileCheckerTest
class into the 'phpunit/data' folder instead of placing them
in the same directory to allow the new test class to use these
files too.
Bug: T371167
Change-Id: Id473ef440c6b7f8ecbb1c869f9cc0cf98705a0e9
Why:
* Maintenance scripts in core are mostly untested and testing them
will help to avoid regressions.
** For example, in testing the script a bug is found where the
Maintenance::purgeRedundantText method will throw an
unexpected exception if no valid rows exist in the
content_address table.
What:
* Create DeleteOldRevisionsTest that fully tests the associated
maintenance script.
* Update Maintenance::purgeRedundantText to not attempt to
use an empty list as the value provided to
IReadableDatabase::getExpr.
** Add a regression test for this.
Bug: T371167
Change-Id: Id0c3c5d6fe56bc9fe5d5347c82dab9ab61137f58
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
This environment variable is already checked in TestSetup.php for
PHPUnit runs by Quibble, when the job is running for a patch to
the mediawiki/vendor repository.
Right now, Quibble sets this var, but then has to separately pass
`--skip-external-dependencies` to update.php as well.
Remove the need for that by supporting the same environment variable
so that Quibble can set it once for that run, and naturally applies
by any commands where it makes sense.
Bug: T370380
Change-Id: Iad7c8d4be9e81af0a0de11019a98804b232efa8b
Why:
* The fixDefaultJsonContentPages.php maintenance script was added
in 2986d47c90 which was MW 1.27
* Per the version policy, wikis wishing to upgrade to MW 1.43
should upgrade via 1.35 or 1.39 before moving to 1.43.
* As such, this script will have been already run for any wiki
upgrading to 1.43 and therefore this script is unused.
* Removing the script is useful to reduce the amount of untested
code in the maintenance directory and reducing unnecessary
maintenance on now unused code.
What:
* Remove fixDefaultJsonContentPages.php
Bug: T373335
Change-Id: Ie20f55c6a8723573aa7e9acd67766af9dfb67269
Why:
* The populatePPSortKey.php maintenance script was added in
993ce4d411 which was in at
least MW 1.34.
* Per the version policy, wikis wishing to upgrade to MW 1.43
should upgrade via 1.35 or 1.39 before moving to 1.43.
* As such, this script will have been already run for any wiki
upgrading to 1.43 and therefore this script is unused.
* Removing the script is useful to reduce the amount of untested
code in the maintenance directory and reducing unnecessary
maintenance on now unused code.
What:
* Remove populatePPSortKey.php
Bug: T373334
Change-Id: Iaa86bb193bf8feae9f5e2fe33255182e864d2e4f
Why:
* The populateBacklinkNamespace.php maintenance script was
added to update.php in MW 1.24 in
b8c038f678
* Per the version policy, wikis wishing to upgrade to MW 1.43
should upgrade via 1.35 or 1.39 before moving to 1.43.
* As such, this script will have been already run for any wiki
upgrading to 1.43 and therefore this script is unused.
* Removing the script is useful to reduce the amount of untested
code in the maintenance directory and reducing unnecessary
maintenance on now unused code.
What:
* Remove populateBacklinkNamespace.php
Bug: T373333
Change-Id: Ia70fdd5c5ae087d7f5bdf4499185701bbb106c1f
Why:
* The addRFCandPMIDInterwiki.php maintenance script last had
it's update key modified in MW 1.23 in commit
bd38435848.
* Per the version policy, wikis wishing to upgrade to MW 1.43
should upgrade via 1.35 or 1.39 before moving to 1.43.
* As such, this script will have been already run for any wiki
upgrading to 1.43 and therefore this script is unused.
* Removing the script is useful to reduce the amount of untested
code in the maintenance directory and reducing unnecessary
maintenance on now unused code.
What:
* Remove addRFCandPMIDInterwiki.php
Bug: T373331
Change-Id: Ie6791c0cc2cfab5e09aa0b1c7ddcea1099cd1f79