Commit graph

4 commits

Author SHA1 Message Date
Dreamy Jazz
e7393b3cc7 Exclude boilerplate maintenance code from code coverage reports
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
2024-08-27 13:22:29 +01:00
Kosta Harlan
20638462a7
[temp accounts] Make use of isKnown config flag
Why:

- A few places in core should check the isKnown
  flag (I4ce534a847461230f7fa276a565bdc1d6c9857e1) rather than isEnabled

What:

- Update ChangesListSpecialPage, UserGroupManager,
  UserSelectQueryBuilder, WatchedItemQueryService,
  ApiQuerySiteInfo, maintenance/expireTemporaryAccounts and
  maintenance/userOptions to used the isKnown() config check

Bug: T356524
Change-Id: I5a88808c7297752c60f6e7ffe16cf6543d783269
2024-06-14 17:26:30 +02:00
Bartosz Dziewoński
2cbc82edbb TempUserConfig: Deduplicate code generating match conditions
The idea is similar to the one behind TempUser\Pattern::toLikeValue(),
which has been effectively deprecated by allowing multiple patterns.

Change-Id: Iddb284bff21355deb8ceaa6925d3c2aea34d727e
2024-03-06 18:28:14 +01:00
Dreamy Jazz
6487791074 Add a maintenance script to populate user_is_temp column
Why:
* The user_is_temp column exists in the user table to allow finding
  temporary users when reading from the DB directly.
* This column was added in f283c0e990,
  but this was not written to until
  6e68107b3a which was several months
  later and after a release version was branched.
* As such, we need a maintenance script to populate the user_is_temp
  column for wikis that have enabled temporary account creation.

What:
* Add a maintenance script named populateUserIsTemp.php which
  populates the user_is_temp column by looking for rows in the
  user table that have user_is_temp as 0 and have user_name match
  at least one temporary account match pattern. These rows are then
  updated to have user_is_temp as 1.
* This script will be added to update.php in a future commit, so that
  betawikis can have this run manually.
* Create unit tests and an integration test for this maintenance
  script.

Bug: T355181
Change-Id: I6223496d7aee65e3ab207fe86e386b01bef8b388
2024-01-24 14:16:39 +00:00