Commit graph

203 commits

Author SHA1 Message Date
Arlo Breault 22c1bfb865 Omit lints in hidden categories from search results
Presumably it would be better if category priorities lived in their own
table so that we could do a join rather than an ever growing where in
clause.  That would help Quarry users as well.

Bug: T334527
Change-Id: Ibd535a54565f6f474346c44ad7597fa0532faf6c
2024-04-18 20:23:32 -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
Arlo Breault c04b075858 Stop constructing Database with a page id
Instead, pass the page id when using methods for a page.  The change
avoids constructing Database a dummy page id when those methods aren't
going to be used.

getFromId doesn't seem like it needs a page id, since the linter id is
the primary key.

Also, a namespace id should no longer optional to setForPage.  The
LinterWriteNamespaceColumnStage option already gates whether to include
it in the row.

Follows-Up: I9fd6e7724dcf33be0b1feb19ec8eb448738cab09
Change-Id: Ib3d3622144b670ebe1a4ce04e6db6811584d42c8
2024-04-10 21:07:08 -04:00
Arlo Breault 1c53684200 Construct services with ServiceOptions
And addresses some other cleanup from review comments.

Follows-Up: I9fd6e7724dcf33be0b1feb19ec8eb448738cab09
Change-Id: If87b0bf91930f0f8d89ed046d18aadb8f346f9aa
2024-04-10 12:34:05 -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
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 6304fc5e08 Stop exposing hidden categories in siteinfo
Suppresses them from ?action=query&meta=siteinfo

Bug: T334527
Change-Id: I325e78e438a8385948071d2b4ba8a8c4407d5fc4
2024-04-04 16:04:39 -04:00
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
Arlo Breault 397b36e8e3 Don't include hidden category counts in page info
Bug: T337275
Bug: T334527
Change-Id: I6439df894c06fc5592422e72dac04150591f4033
2024-04-02 15:12:19 -04:00
Arlo Breault d6514cfa3b Fix invisible categories in ApiQueryLintErrors
Invisible categories are permitted as categories, just not part of the
default set.  'invisible-categories' is removed, since it never worked.

Bug: T360064
Bug: T334527
Change-Id: Ie6b7a6d83349cbd2899e78bc18cc1629d710c6f0
2024-04-01 21:43:24 -04:00
Umherirrender 91848725e7 Replace isset() with null check in HtmlTags
Found usage of isset() on expression self::$allowedHtmlTags that appears
to be always set. isset() should only be used to suppress errors. Check
whether the expression is null instead.
See https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#isset

Change-Id: I21483aab05292cfb802ff6a5e63013ecc02f5c13
2024-04-01 13:47:54 +02:00
Tim Starling 4dd75df2e8 Fix index usage when searching for page titles
When searching for a specific page title, it's necessary to specify
page_namespace, not just linter_namespace, so that the relevant index in
the page table can be used.

Submitting the form with an empty namespace box led to a search for
namespace zero, because getCheck() returns true for an empty string.
It's not easy to search for a title part in all namespaces. So drop
that hidden feature and interpret a title part with a missing namespace
as being a search for namespace 0.

It's possible to search for a category with an empty title and zero or
more namespaces. Implement the namespace filter in this case using the
linter_namespace field. But ignore the namespace filter if there is no
category, since there is no index on linter_namespace alone.

Bug: T360865
Change-Id: I00934eaaf1a99e4098f177166b43069d33d9f137
2024-03-27 11:44:59 +11:00
Arlo Breault c90267575c Update lint category help links
Bug: T360793
Change-Id: I4a7b0d0200d2af5c6768db91d0883c7fc483d8dc
2024-03-22 14:14:38 -04:00
Umherirrender 9555edce6c build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: I0a022343428d4b41d2c3c00a6f48eeb237c76fac
2024-03-11 20:44:04 +01:00
jenkins-bot c1cf86af3b Merge "Use OutputPage::setPageTitleMsg() instead of ::setPageTitle()" 2024-02-17 02:36:03 +00:00
Bartosz Dziewoński 8fe89c1c35 Use OutputPage::setPageTitleMsg() instead of ::setPageTitle()
Bug: T343994
Change-Id: Icf148a1a9b10e568f48d0ef478f781d243a9345a
2024-02-17 02:58:49 +01:00
libraryupgrader fa24bc16e1 build: Updating dependencies
composer:
* mediawiki/mediawiki-phan-config: 0.12.1 → 0.14.0

npm:
* grunt-banana-checker: 0.11.0 → 0.11.1

Change-Id: I7dbb4861df50848b803babe3dab10811adc3faae
2024-02-10 22:20:52 +00: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
Reedy 2276363a99 Cleanup SchemaHooks and SQL files
* Move MySQL files into subfolder
* Simplify onLoadExtensionSchemaUpdates hook by using variable for dbType
* Document what MW version patches were added

Bug: T353922
Change-Id: I4b87481163121047619d173675747feef4d8ede1
2023-12-22 02:13:52 +00:00
Bartosz Dziewoński 46e44bc694 Ignore "exact match" title when the title is not given
Restore a check removed in 3b3729ad4d.

Bug: T353860
Change-Id: I4722596433247a751d736ae35d9e3af9ac9d94cb
2023-12-21 11:35:17 +01:00
Isabelle Hurbain-Palatin 24155905cd Migrate Database.php to use QueryBuilders everywhere
Bug: T350977
Change-Id: I864c1e4880876b329ba0e8102e6c0f335a149491
2023-12-15 16:04:37 +01:00
jenkins-bot 91ff1af06b Merge "Replace addQuotes in ApiQueryLintErrors by expression builder" 2023-12-14 19:52:11 +00:00
Isabelle Hurbain-Palatin e3555039a0 Replace addQuotes in ApiQueryLintErrors by expression builder
Bug: T350977
Change-Id: I2ab0b83ed727a10861c4cfcf7d65142fc559e4af
2023-12-14 17:40:53 +01:00
jenkins-bot 846b2066de Merge "Update LintErrorPager to expression builder" 2023-12-14 15:07:14 +00:00
Isabelle Hurbain-Palatin 3b3729ad4d Update LintErrorPager to expression builder
Bug: T350977
Change-Id: Iee1726c93028219f9d360c5a485eb39f8c0a49ed
2023-12-14 14:43:41 +01:00
Umherirrender c730c0a9c8 Use ! condition instead of compare with false
Change-Id: I0f032169697b0227ade9644f754086f8bb4b9596
2023-12-12 16:38:17 +01:00
Reedy 76634af5b0 SpecialLintErrors: Minor cleanup
* Collapse a nested conditional
* Minor copy editing

Change-Id: I2875ec0dd9c44c896cad916feb8ed1f2bd514479
2023-11-26 21:34:26 +00: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
sbailey dd0836d232 Implement multiple namespace selection for Linter filters
* Using namespacesmultiselect type in HTMLForm element to
   provide multiple namespace selection criteria in reports.

 * New namespace URL encoding implemented which matches namespace
   parameters against active namespaces to ensure parameter
   security and validation.

 * Test system updated to use new URL namespace encoding

Bug: T231161
Change-Id: Ic3190cffe259aecdea429c10e35122eabdbe10d4
2023-10-26 10:39:57 -07:00
Arlo Breault e978607d56 Remove ParserMigration association
Bug: T333179
Change-Id: Ifc6676c3f873aeb1655f3cb1b549a5dd55bc4d85
2023-10-13 12:33:26 -04: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
gerritbot f6f734ef42 Migrate ILB::getConnectionRef() calls to ILB::getConnection()
Deprecated since 1.39 (I6e7544763bd)

Bug: T343277
Change-Id: I6921060a38a1956c198f7a1316bed45c0eafa307
2023-08-04 13:03:06 +00:00
Umherirrender 7009ca8390 Use a maintenance database connection to call fieldExists
IndexPager::$mDb is documented as IDatabase, that interface does not
implement fieldExists. To use the correct static types get a
IMaintainableDatabase instead from the load balancer and call
fieldExists

Bug: T343495
Change-Id: I6a07ff2115de781e26f272126a72a9fbdef30223
2023-08-04 11:56:02 +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
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 bef1042e69 Replace use of select or selectRow with QueryBuilder
* All database methods using old access methods converted to use
   queryBuilder except row counters

Bug: T312434
Change-Id: I8796adf63179c4505fbb76ab6fd71cf3775c9b89
2023-03-25 15:13:59 +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
jenkins-bot f82904c185 Merge "Link to detailed Special:LintErrors from action=info" 2023-02-10 02:10:20 +00:00
jenkins-bot 107b89a901 Merge "Move LoadExtensionSchemaUpdatesHook handler to separate class" 2023-02-10 02:10:19 +00:00
sbailey 2768a70218 Fix migrate data error when params has excessively long strings
* The linter migrate code for linter_tag field and linter_template
   field are constrained by the database schema to 32 characters
   for the tag field and 255 characters for the template field.
   In some anomalous circumstances parsoid can report tag and or
   template fields in the linter_params object that exceed those
   character limits. This code truncates these excessively long
   strings to protect the database migrate update code from a
   length exceeded error.

Bug: T329113
Change-Id: I8af7c44759f172eae77d3519a6eac47110e9b1e7
2023-02-09 18:20:46 +00:00
sbailey 07046457f0 Fix write error when linter_params has excessively long strings
* The linter write code for linter_tag field and linter_template
   field are constrained by the database schema to 32 characters
   for the tag field and 255 characters for the template field.
   In some anomalous circumstances parsoid can report tag and or
   template fields in the linter_params object that exceed those
   character limits. This code truncates these anomalous strings
   to protect the database update code from a length exceeded
   error.

Bug: T328979
Change-Id: I057ae2e32a9e1a7735b5300409e5693e8db5c764
2023-02-08 10:40:12 -08:00