Commit graph

79 commits

Author SHA1 Message Date
daniel 8b22ad5d78 Trigger Parsoid run when page metadata is being updated
When RESTBase is turned off, Parsoid runs will no longer be triggered
on template changes. This creates a new mechanism to do that, based on
the RevisionDataUpdates hook called by DerivedPageDataUpdater. The new
behavior is controlled by a feature flag, LinterParseOnDerivedDataUpdate,
which is enabled per default. In WMF production, this should be
turned off as long as we are still triggering Parsoid parses through
the pregeneration mechanism in RESTBase.

Note that this will not write ParserOutput to the ParserCache. On edits,
pages will get parsed with Parsoid twice, once to trigger the lint data
update, and once by ParsoidCachePrewarmJob to populate the ParserCache.
Both parses will trigger the ParserLogLinterData hook, the lint data
from the second parse is redundant.

However, while ParsoidCachePrewarmJob and RevisionDataUpdates get
triggered together on edits, they also get triggered separately:
ParsoidCachePrewarmJob by page views with parser cache misses; and
RevisionDataUpdates when pages get invalidated due to template changes.

Because ParsoidCachePrewarmJob and RevisionDataUpdates generally get
triggered in different situations, it seems cleaner to keep the two
mechanisms independent of each other, and live with the duplicate parse
on edit.

Bug: T361013
Change-Id: If53841ee583ce240dd245d640b9ea9c97e1eaa55
2024-06-03 16:50:17 -05:00
Brooke Vibber ea186c1cee Add hidden lint missing-image-alt-text
Add support for new parsoid lint, missing-image-alt-text
Matches on images that don't have an alt text attribute at all
(empty alt attributes count as present).

Intended to make it easier to put workflows around these images,
including streamlined workflows for "microcontributions" in the
mobile apps.

As this has some impedence mismatch with usage of Special:LintErrors
this is marked as hidden (priority=none) so will not be displayed by
default, but has an enum value reserved for it and can be queried
explicitly.

Bug: T344378
Change-Id: I38cc1abbece3cca8155bec1f071b854027be0966
2024-05-29 19:03:41 -04:00
Arlo Breault 261339c2a3 Inject Database into TotalsLookup
Change-Id: I01e6b89b4ce9b1cea241bba9cad7ef6673803166
2024-04-11 12:24:42 -04:00
Arlo Breault ffc266eae6 Drop DatabaseFactory, just have Database as the service
Change-Id: Id25271c82bc7ba833d32dff3fb11d3dfe15a3f02
2024-04-10 21:21:40 -04:00
C. Scott Ananian 4f991b5d0c [DI] Clean up LintErrorsPager
Inject the services required by LintErrorsPager from the SpecialLintErrors
class.

Change-Id: Ie20e00cccef895fbad8536a94dfc1978f20c4220
2024-04-09 18:35:34 -04:00
C. Scott Ananian 633d6024a4 [DI] Make TotalsLookup an injectable service
Change-Id: I71d41ca5b0a901afd59950b3539d8e19c4cead5f
2024-04-09 18:35:32 -04:00
C. Scott Ananian 24f771a6a3 [DI] Make CategoryManager and Database injectable services
Change-Id: I9fd6e7724dcf33be0b1feb19ec8eb448738cab09
2024-04-09 18:33:13 -04:00
jenkins-bot 2d46c8195c Merge "[DI] Use dependency injection for RecordLintJob" 2024-04-05 19:20:41 +00:00
jenkins-bot 94ef8d8ea4 Merge "night-mode-unaware-background-color doesn't emit params" 2024-04-05 15:21:22 +00:00
C. Scott Ananian fde916fff5 [DI] Use dependency injection for RecordLintJob
Change-Id: I3b8cd95e075af92c77a7dec4f12a0a81eab3ae4b
2024-04-04 21:42:10 -04:00
C. Scott Ananian c983a822e3 [DI] Use dependency injection for Hooks
Change-Id: I23f56b0a3df1ef206ec160453294349d2482435f
2024-04-04 18:43:13 -04:00
C. Scott Ananian d71a297781 [DI] Use dependency injection for ApiQueryLinterStats
Change-Id: I5f5d3a226a9f7b733a6f07200216a1192115b102
2024-04-04 18:43:13 -04:00
C. Scott Ananian d8970278d1 [DI] Use dependency injection for SpecialLintErrors
Change-Id: I211d70d5fb4a321cf302cc10f6e160480468a347
2024-04-04 18:43:10 -04:00
Arlo Breault 0a5700fa39 night-mode-unaware-background-color doesn't emit params
Change-Id: Id65e19266cfc7de095ee621fe28c35639a9f73b1
2024-04-04 18:22:46 -04:00
C. Scott Ananian 24ef2e9cdb Revert "Revert "Add inline background color""
This reverts commit e2c7746818.

Reason for revert: Culprit is actually on the Parsoid side (reporting a new linter type before the Linter extension knows about it, transiently during deploy) and this revert makes that problem worse not better.

Change-Id: Ib0c1fab8b8e9536e90591a58da673931f5bddf4c
2024-03-20 19:43:10 +00:00
Jdrewniak e2c7746818 Revert "Add inline background color"
This reverts commit d08fb459c0.

Reason for revert: Might have caused T360565

Change-Id: I408d6eeb2a2789a284d45f879c77ea1e9936ff7c
Bug: T360565
2024-03-20 19:18:54 +00:00
ksarabia d08fb459c0 Add inline background color
*This adds inline background color linter

Bug: T359205
Change-Id: Ic0a66bdd8ae784c8e048cdba60bcfa11e3f96d20
2024-03-07 17:55:07 +00:00
jenkins-bot af48028cca Merge "Enable "missing end tag in heading" error in LintErrors" 2024-01-09 20:17:34 +00:00
sbailey 8bac609d00 Enable "missing end tag in heading" error in LintErrors
* Seems reasoable to enable this category, it has been in the
   database and accessible through Quarry reports for months.

Bug: T341369
Change-Id: Id80a0c02b5948ba9bdc56e762b781d764844afcb
2024-01-09 15:13:32 -05:00
Umherirrender 6c10926920 Use namespaced classes
This requires 1.42 for some new names

Done automatically via script

Change-Id: Idaad9e8d165a6bd202b96bbb657deb710cca4c54
2024-01-06 17:03:30 +01:00
Arlo Breault e978607d56 Remove ParserMigration association
Bug: T333179
Change-Id: Ifc6676c3f873aeb1655f3cb1b549a5dd55bc4d85
2023-10-13 12:33:26 -04:00
James D. Forrester e143c30341 build: Update MediaWiki requirement to 1.41
All extensions in the MediaWiki tarball are expected to track MediaWiki's release directly.

Change-Id: I69d58367c129625a0b1159e92b4b30ec7b892a78
2023-08-19 13:29:08 +08:00
Moh'd Khier Abualruz b9f1d478e2 Unclosed tags in article headings
- divide the 'missing-end-tag' into 2 categories:
 * 'missing-end-tag': kept the same ( minus the new category results)
 * 'missing-end-tag-in-heading': high priority

depends-on: I8397a24e85ca9f5a9ce6413dec5efa8c401a9960

Bug: T308398
Change-Id: I5738abd522bf5248e4b7b1255920055182e6261f
2023-05-05 12:57:21 +02:00
Moh'd Khier Abualruz d543552be9 Allow registration of hidden lint rules
Adding support for categories non, allowing access to category page without showing it in listing, in categories in teh special page

Bug: T334527
Change-Id: I8397a24e85ca9f5a9ce6413dec5efa8c401a9960
2023-05-04 10:41:05 -07:00
Moh'd Khier Abualruz 53918dd364 Create linting rule for large tables
depends-on: Ic25c50caf15423179e32ab1b4c0f0ab9f6c71cb3

Bug: T334528
Change-Id: I691a265aa1c3914c8cd9f3a63c2e8f8bfe92af0f
2023-05-02 19:21:10 +02:00
gerritbot e1542b880a Update moved class WikiMap
See T321882. Moved in I60cf4b9ef02b9d5

Bug: T321681
Change-Id: I2d9e34bf9849c3ae05761f83031c806987b5991f
2023-04-25 09:54:08 +00:00
sbailey 6aa4cdeba9 Linter Tag and Template search feature, UI and report code
* Tag and Template search is enabled using config variable
   'LinterUserInterfaceTagAndTemplateStage' and also checks for
   the linter table column 'linter_tag' to exist to protect the
   report code from error if the column is absent. As the linter
   table alter maintenance added both the linter_tag and
   linter_template at the same time, there is no reason to check
   both. The user interface code does not check for the field
   presence only the config variable.

 * This code depends on the recordLintJob code writing the tag
   and template data which is enabled by the config variable
   'LinterWriteTagAndTemplateColumnsStage' and also assumes the
   data migration maintenance script migrateTagTemplate.php has
   been run to populate linter error records created prior to
   the table alter and the write code being enabled.

Bug: T175177
Change-Id: I2f951dfcd34e3dc6ca17e8754cfaeba8baa3e835
2023-02-27 06:55:06 -08:00
sbailey 499a1c3796 Use new linter_namespace column and index in the Linter table
* This performance improvement patch uses the namespace from the
   new field 'linter_namespace' in the linter table instead of
   the 'page_namespace' in the page table. It checks for and
   requires the presence of the linter_namespace field in the
   linter table, as well as the config variable
   'LinterUseNamaspaceColumnStage' being set true.

 * If the linter_namespace field is present and aforementioned
   config variable is true, the code assumes that the config
   variable 'LinterWriteNamespaceColumnStage' is set true and
   recording the linter_namespace for new lint errors is
   active and the migrateNamespace.php migrate code has been
   run to migrate the page_namespace data into existing linter
   records that were created before the linter_namespace column
   existed and were left NULL during the table alter maintenance
   operation.

 * A follow on patch should remove the configuration variables and
   conditional code producing the final, refactored code dependent
   on the new namespace column index.

Bug: T299612
Change-Id: I4a1497d9e4dcd6a9a7befdaccf3e34c61694365d
2023-02-24 06:54:08 -08:00
Kunal Mehta eaf2d26db8 Remove API action=record-lint
The action=record-lint was a hack that allowed Parsoid/JS to send data
to MediaWiki to be stored in the linter database. Thankfully we no
longer need it in the glorious Parsoid/PHP world because it can write
directly to the database.

The API module, i18n messages and $wgLinterSubmitterWhitelist are all
removed.

Bug: T329992
Change-Id: Iba70e05a2e28f4ecd02101cff51993ebe65f19d0
2023-02-20 20:44:00 -05:00
sbailey d12bf639f6 Change linter maintenance scripts to use existing config varaibles
* Having separate config variables to enable the maintenance
   migrateNamespace and migrateTagTemplate scripts is duplicitous
   and should be shared with the write enable config variables.

Bug: T329342
Change-Id: I4cb453fc0678b065cb42a2ca59863da1ab9cdbe4
2023-02-14 09:43:54 -08:00
Kunal Mehta cb84f3a872 Link to detailed Special:LintErrors from action=info
action=info has a summary table of number of lint errors by category,
but we have richer information available via Special:LintErrors. If
there is a "Lint errors" section, provide a link below the table to
Special:LintErrors for the errors on this page.

Update ApiRecordLint for the new Hooks constructor and leave a FIXME
to eliminate the coupling.

Bug: T301374
Change-Id: Ic1fcf42b50d1392ac53201ceb256691133cf62ff
2023-02-06 20:41:45 -05:00
Kunal Mehta b5a7aaf7e0 Move LoadExtensionSchemaUpdatesHook handler to separate class
This hook is not allowed to have a service, so before we can add
services to the main Hooks class, it needs to be split out.

Change-Id: Ia7b4b8bf7c91ebb851c5de9f0f54f56b0993bf83
2023-02-06 20:36:45 -05:00
Umherirrender eb31c6c4dc Replace deprecated HTMLForm::addHeaderText
Bug: T325474
Change-Id: If1a4b14b6cec480f600065c913cb1f27260fbc5f
2022-12-27 12:48:42 +01:00
sbailey 350d677c5b Phase 3 of T175177: Migrate linter_params into new fields
* The migrate code is designed to perform a one-time update of
   linter_params JSON encoded template and tag information into
   the new discrete template and tag text fields for use as
   additional search criteria. The function can be restarted if
   it is interrupted.
 * It now uses configurable batching and sleep times between
   batches to allow the database to do other work and replication
   to occur without stressing infrastructure.
 * The migrate code is only called by test code and needs to be
   called one-time from a maintenance script.

Bug: T175177
Change-Id: Idc4ca88d4762bc7a3bcbc4e66c0f275562083867
2022-12-09 12:01:06 -08:00
sbailey 702ce215d0 Phase 3 migrate code for namespace column add to Linter table
* Migrates namespace info from the page tables page_namespace field
   to the new linter table field linter_namespace. This duplication
   of the namespace value was requested to greatly reduce the amount
   of database activity required by the linter search and reporting
   code.

 * This patch has been prepared as a dark launch patch enabled with
   config value LinterMigrateNamespaceStage and assumes that the
   Linter table has had the linter_namespace column added to it,
   and recording of the namespace field is already enabled and is
   populating the namespace column.

 * The migrate code now runnable from Linter/maintenance directory,
   using migrateNamespace.php, which will be deployed in a separate
   patch. The maintenance code creates an appropriate environment
   to call migrateNamespace( in Database.php.

Bug: T299612
Change-Id: I73cb80729d6a5a8716fe93164ad1e42e6958d672
2022-11-28 08:07:54 -08:00
Reedy 1c526b7443 Convert to HookHandler
Change-Id: Ib8ad9a58e781f7dad4b047d170a8f689802c4bad
2022-09-07 02:58:04 +01:00
sbailey b358b20dca Second phase of T175177: Adds template and tag to RecordLintJob
Bug: T175177
Change-Id: I59be7cabb80ace98da3c7f6f36a0d3d4f6b17d23
2022-08-22 12:47:01 -07:00
Arlo Breault 0f46ed3dbc Get config from services, not globals
If908c4dc99c966cde2981f9a03be38a577406a4e introduced the
wgLinterWriteNamespaceColumnStage global but didn't add it to the
extension.json

Change-Id: I8ee5849f67ddfd894a25425582b59404eb52aef2
2022-08-03 13:01:42 -04:00
sbailey 0e56c22277 Delete lint error records when content model changes from wikitext
* Determines if new content type is not wikitext and if so
   deletes all existing lint error records for that pageID.

Bug: T298343
Change-Id: I20fac9a0c901f3e7a5cc898566a4487fbe70798f
2022-02-25 13:22:10 -08:00
Arlo Breault 6898415d8d Disable "inline-media-caption" category
Note that this only removes the category from the special page and the
lints will still show up by page.  Those need purging separately or more
code to filter out disabled categories from the results.

Bug: T297443
Change-Id: Idfcf5ee5d69f5dc65100229aacb22137be475866
2022-01-16 12:25:28 -05:00
Arlo Breault e8a1b8218c Add linter category for "inline-media-caption"
Bug: T297443
Depends-On: I4cdbfe46bce7556d2187a5f1c908b3538d1185fb
Change-Id: I83d51c40b3c4c1f3e5de327aba6f05e65d9814c7
2021-12-15 17:27:52 -05:00
Arlo Breault 2fa7a30f14 Remove hardcoded list of categories with no parameters
Change-Id: Ic8b9ced613c873cada0a9909ed0d3799160504a1
2021-12-15 17:27:36 -05:00
DannyS712 830f879e22 Convert LintErrorTest to pure unit tests
No integration needed.

Requires bumping minimum version of mediawiki to when
MediaWikiUnitTestCase was introduced in 1.34.

Change-Id: Ibc0a1028cc61a7bdc149081aeaa1109de18ee119
2021-03-27 02:28:25 +00:00
Reedy b1c9ff6ee9 Convert to manifest_version 2
Bug: T252470
Change-Id: I1926592da8774feddbe44d541b4fe68beb080e44
2020-05-12 01:53:32 +01:00
Arlo Breault 40f0b3cef9 Implement ParserLogLinterData hook
Bug: T238456
Change-Id: I3e05d1c113b18c83db02c7e500d5834e931afb7f
2019-11-27 13:51:01 -05:00
Amir Aharoni 243604ffc6 Split apihelp messages to a separate file
Bug: T189982
Change-Id: Ie06eb176da9257816057d2a9af2a793dfe169689
2019-07-04 15:38:00 +03:00
SFarida 0f37222bbb Add new Linter category wikilink-in-extlink
Add the category in extension.json and descriptions
of the category in qqq.json and en.json

Bug: T202905
Change-Id: Ie2e76c653ac9aa80bc7c32f3227323225a0cd8e5
2019-02-19 10:53:43 -08:00
C. Scott Ananian b1b4cc8ca7 Add IPv6 localhost to default whitelist along with IPv4 localhost
Change-Id: I970b91539606305da9afa6d3e40d66885385615e
2018-05-01 20:18:06 +00:00
Kunal Mehta 34b160621c Use SPDX 3.0 license identifier
SPDX released version 3 of their license list (<https://spdx.org/licenses/>),
which changed the FSF licenses to explicitly end in -only or -or-later
instead of relying on an easy to miss + symbol.

Bug: T183858
Change-Id: Iecbc1b73bf7a4f3e52f8a4ed4aba9442707516ab
2018-01-04 01:32:59 +00:00
Umherirrender f3166dee38 Require MediaWiki 1.31 in extension.json for AutoloadNamespaces
AutoloadNamespaces is a new feature in 1.31

Change-Id: If877db9d628598f3d91a55b767be421cfa8a50b1
2017-12-31 14:05:31 +01:00