Commit graph

42 commits

Author SHA1 Message Date
Arlo Breault 8d49b68ba5 Move Database::updateStats to TotalsLookup
Database::updateStats moved to Database from RecordLintJob in
I2610b9b16d4032b0e18b3537cc9ed51bfdaff299 for reuse in Hooks but seems
better placed on TotalsLookup.

Change-Id: I600853e5cfc9e8abae9c6b07cee4c2adc37ef464
2024-04-02 17:12:24 -04: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
sbailey a3d0632c86 Update the namespace parameter name in the link in action=info pages
* url parameter 'namespace' changed to 'wpNamespaceRestrictions'

Bug: T231161
Change-Id: I904733ecb89fd855f7a338a6ef6d2a35a87c86d4
2023-11-07 19:04:45 +00:00
gerritbot e181c2ef66 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: Id325b25e154b8b2bbd1d0b1d7b1c7830b40873f6
2023-08-19 12:37:07 +00: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
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
sbailey abbcc17511 Fix linter table linter_params definition to not be nullable
* update all schema files to correct linter_params being set nullable by accident in
   2020 during abstract definition update

 * include hook to provide 3rd party support, use $updater->modifyExtensionField(

Bug: T327806
Change-Id: I7fea08280cf2fa7956e5b300dc3365dc3561ca52
2023-01-26 12:47:36 -08:00
Reedy 1c526b7443 Convert to HookHandler
Change-Id: Ib8ad9a58e781f7dad4b047d170a8f689802c4bad
2022-09-07 02:58:04 +01:00
Subramanya Sastry b08fd17186 Hooks.php: Check for non-array $tags
Bug: T302918
Change-Id: I96fdbbc443025d9461dc168e58164004a0f8d7ed
2022-03-02 15:40:05 -06:00
sbailey 6925519cb5 Delete lint errors when blank page saved while changing content type
* Add "mw-blank" as another tag value that erases all lint errors
   for a page as a blank page cannot have any lint errors.

Bug: T280193
Change-Id: Iaad8ce75950588b2676de5dfb5f5221d64231f0e
2022-02-28 15:03:16 -08:00
Arlo Breault 285838961b Account for all lintable contentmodels after contentmodel change
Change-Id: I54495ec01d4fc3b29f1c924f86be3bcd2ed94977
2022-02-25 17:46:56 -05: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
Alexander Vorwerk 8c7fa34662 Fix typo in patch file
Bug: T175177
Follow-Up: Iac22d99109bb1253f450a64254f50677e3cdefeb
Change-Id: I0c1ad29b67a732faa06add8faff4f70988b8613b
2022-02-07 20:47:53 +00:00
sbailey 56567da56f First phase of T175177 database alter table adds two fields
* Adds template and tag name fields to enable better search
   capability to the Linter extension

Bug: T175177
Change-Id: Iac22d99109bb1253f450a64254f50677e3cdefeb
2022-02-03 14:57:17 -08:00
sbailey 4544a9c7cc Add namespace column and new index to Linter table - part 1
* This patch contains the code needed to update the database with
   the addition Linter table column linter_namespace <int/null>
   and add an index with category and namespace for faster
   selection of linter records.

Bug: T299612
Change-Id: I05da381b9a74294b44d4aef968614277d601a176
2022-01-28 20:19:38 +00:00
jenkins-bot bd45eeda91 Merge "Replace deprecated JobQueueGroup::singleton()" 2022-01-23 21:39:36 +00:00
Umherirrender 354012f419 Replace deprecated JobQueueGroup::singleton()
Change-Id: Ib19314b8a8a4265daf67e31d50f1c61aec2edb8e
2022-01-21 17:22:20 +00:00
Arlo Breault fc8c39baa5 Fix lint error updating
The article id of the title is set to 0 when the page is deleted so,
although the lint job from the hook runs, it doesn't remove anything.

Reverts most of I06b821b65f65609ddac8ed4e7c662336082d8266

Bug: T298782
Bug: T170313
Change-Id: I2610b9b16d4032b0e18b3537cc9ed51bfdaff299
2022-01-10 16:24:00 -05:00
libraryupgrader 577a074b69 build: Updating composer dependencies
* mediawiki/mediawiki-codesniffer: 35.0.0 → 36.0.0
* php-parallel-lint/php-parallel-lint: 1.2.0 → 1.3.0

Change-Id: Ib1e2319da19d8c5589d1d41d3c0fe8f882792721
2021-05-05 06:09:03 +00:00
Reedy 3387c848d0 Convert Linter to abstract schema
Bug: T259374
Change-Id: Ida866d45bc3daca6ed763df2b8c38d2b27c809aa
2020-08-22 23:33:46 +01:00
Reedy 92f6f89df5 Fix class/function case mismatch
Bug: T253628
Change-Id: Id32777865a0135c39c19d5af2506ebd7e02fb2bb
2020-05-26 18:58:52 +01:00
libraryupgrader 210cada8e6 build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate

Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: Icdd0d0e60dd543921a5757162548ae149c3316ea
2020-01-10 10:06:28 +00:00
libraryupgrader 850a9cd523 build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Change-Id: I6d33f100be437e2ce8856ddecbcac56886a5d98a
2019-12-17 21:29:49 +00:00
jenkins-bot 12bd529229 Merge "Allow Parsoid to provide category ID hints" 2019-12-10 22:59:08 +00:00
C. Scott Ananian 551a1fb398 Allow Parsoid to provide category ID hints
This eases deployment dependencies by allowing Parsoid to supply an
appropriate database category ID so that new lint categories can be
appropriately stored during the interval between adding a new lint
category to Parsoid and deploying an Extension:Linter patch to
describe it.

Change-Id: Ib7b2342168fa53ca2abac7d5f54fe313be341eb7
2019-12-03 23:26:34 -05:00
C. Scott Ananian 8ff7599550 Don't crash RecordLintJob if the lint info doesn't contain params
We will crash trying to set `templateInfo` if it is present and `params`
is not.

On line 49 of RecordLintJob we're going to use `$errorInfo['params']`,
which will crash if `params` is not present.

Change-Id: I505c676cc0ccd8d54e44e65b04b10c2de03ee37c
2019-12-03 23:19:14 -05:00
Arlo Breault 40f0b3cef9 Implement ParserLogLinterData hook
Bug: T238456
Change-Id: I3e05d1c113b18c83db02c7e500d5834e931afb7f
2019-11-27 13:51:01 -05:00
Umherirrender e47e471799 Move sql file into own folder
Change-Id: I12ed78d755426644011fca7595dd82192825859f
2019-03-08 21:41:35 +01:00
Kunal Mehta a1421792e9 Use normal lint error updating logic for page deletions
Page deletions were bypassing the logic in RecordLintJob that
ensured the right category totals cache was cleared and the
statsd updates. Fix that by just using RecordLintJob directly.

Bug: T170313
Change-Id: I06b821b65f65609ddac8ed4e7c662336082d8266
2017-10-05 21:03:30 -07:00
Kunal Mehta f2a516582d build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public

Change-Id: I96e32df48d13040893bfd1be6d90d0db4f7c7d0a
2017-06-20 00:10:41 -07:00
Subramanya Sastry 0f3c66418a Organize lint categories by priority
Displaying categories by priority provides editors with better
guidance about what to spend time on. The Linter help page provides
more information about why the specific priorities have been chosen.

Change-Id: If6f28570189e24a67b4380f666f4cd64a2296989
2017-04-28 10:42:47 -05:00
Kunal Mehta 9c65d786e2 Support new wikitext editor for edit helper
Register a hook for when VE is finished initializing to select the error
section, just like the textbox-based editor.

Use the BeforePageDisplay hook so it runs on VE page loads too.

Bug: T160102
Change-Id: I59a7e0a3e8be32e4689cbf41c4904970902c4dff
2017-04-25 15:21:13 +01:00
Legoktm 379137df59 Revert "Expose category totals in API response"
API meta=siteinfo is a frequently called API query
and the category totals database query is not
sufficiently fast enough to be part of this by default.

This reverts commit 45b4bf6382.

Change-Id: Ia5bf97855d48955ce53c3679c4d138fabafae8b7
2017-04-16 07:36:32 +00:00
Kunal Mehta 45b4bf6382 Expose category totals in API response
Instead of just including the error category names, include the number
of errors each category has, to make it easier to collect aggregate
stats.

This changes the structure from an array to an object, in JSON, but I'm
not aware of any clients using these specific fields yet.

Change-Id: Iaf942b923a0f4047721055ad9cb48aacc5aa6784
2017-03-20 14:14:22 -07:00
Kunal Mehta 5c606fca03 Display count of lint errors on ?action=info
Change-Id: Ifcdfcb365e5ff6106b521d58a06df8c006772473
2017-01-20 11:26:44 -08:00
Kunal Mehta 8b8c50e9d8 Add Linter categories to action=query&meta=siteinfo
Bug: T153056
Change-Id: Ieed01741d31c9e268a8769a5bc5d566d8020e760
2017-01-20 11:26:21 -08:00
Kunal Mehta b201a3122c Add __METHOD__ to MWCallableUpdate
For stats and debugging purposes.

Change-Id: I5acd7fad0a9f09519595c2fa1f6232bb2624a713
2016-12-14 19:46:18 -08:00
Kunal Mehta 70cc3ac190 Delete linter rows when pages are deleted
Bug: T151281
Change-Id: I3b113d0729b288683d9bc6c2f552b99ed2890f5c
2016-11-22 18:31:21 -08:00
Kunal Mehta b41e74ce8b Hardcode category ids
Instead of having a complex auto-increment category manager that had
additional caching, just hardcode the (currently 6) ids for each
category, which allows us to simplify a lot of code.

If Parsoid sends a lint error in a category that we don't know about, it
is silently dropped.

Bug: T151287
Change-Id: Ice6edf1b7985390aa0c1c410d357bc565bb69108
2016-11-22 18:31:17 -08:00
Kunal Mehta ec6f4722aa Store linter_cat names in a separate table
linter_cat is now an int ID that points to a row in the new
lint_categories table.

The mapping between category names and ids is all handled in PHP, and
cached in APC.

Note that you will need to drop the `linter` table manually and re-run
update.php for this to take effect.

Change-Id: I369d9b4d8d08289b4a20d1cd29a2e327bad28ef8
2016-11-03 14:51:10 -07:00
Kunal Mehta bce5b31616 Initial commit
This configures a MediaWiki extension to recieve Parsoid's lint errors
and expose them to users.

Change-Id: Ie0776aecf145eb1c87c2a539ddf3ea8d35a899f5
2016-10-17 16:02:53 -07:00