Commit graph

3 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
Timo Tijhof
91f0237cfa recentchanges: Improve docs, fix file headers, fix doc groups
* Define "RecentChanges" doc group and add all classes in changes/
  and rcfeed/ to the group, as well as a few obvious classes
  that we (currently) maintain in vertical buckets: maintenance,
  api, specials.

* Doc group "Change tagging" was invalid because a group identifier
  must be a single word, and this was thus passing an unexpected
  second argument to the `ingroup` Doxygen command.
  As such, it was missing on
  https://doc.wikimedia.org/mediawiki-core/master/php/

  Define "ChangeTags" properly and fix/add classes in this component.

* Add missing `ingroup` to class blocks (and remove from any file blocks)
  as otherwise the file is indexed twice (e.g. in Doxygen) which makes
  navigation on doc.wikimedia.org rather messy.

  Remove duplicate descriptions from file blocks in favour of class
  doc blocks. This reduces needless duplication and was often
  incorrect or outdated, and helps make file headers more consistently
  (visually) ignorable.

  Ref https://gerrit.wikimedia.org/r/q/message:ingroup+is:merged

* Minor improvements to class descriptions here and there.

Test plan:
* `php maintenance/mwdocgen.php --file includes/changes,includes/changetags,includes/rcfeed`
  (This will emits harmless warnings about undefined "Hooks" group,
  because it's referenced but not included in this fast subset.)
* open docs/html/index.html

Bug: T364652
Change-Id: Ifac20da51f7e809f1a9ccbfac3bf50e739a083ea
2024-08-22 23:30:55 +01:00
Dreamy Jazz
fc5798668d Create a maintenance script to purge expired rows in recentchanges
Why:
* In the CheckUser extension, a maintenance script named
  'purgeOldData.php' purges data from the recentchanges table.
* This script is run on WMF production daily to ensure private
  data is purged.
* This should instead be in core, so that the functionality can
  be used when CheckUser is not installed and also not duplicate
  existing code used for the job that purges the table.

What:
* Create purgeRecentChanges.php which purges expired rows in the
  recentchanges table by running the code in the
  RecentChangesUpdateJob directly (without using the job queue,
  as there is no need to do that because we are in a maintenance
  script context).
* Add a test for this maintenance script
* Test the purging features of the existing job to ensure that
  this code is reliable.

Bug: T373032
Change-Id: Id32780c00b053d7fec94a00812f8d40a6bf2e40c
2024-08-21 17:18:11 +01:00