Commit graph

184 commits

Author SHA1 Message Date
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
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
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
James D. Forrester 1f119cd5b1 ApiQueryLinterStats: Change the 'ls' prefix to 'lntrst' to avoid conflict
In practice this isn't a breaking change as no-one has any params to
re-name in callers.

Bug: T319202
Change-Id: Ic925e258ad3c2e194fd9f04f8afd255a9aa99e45
2022-10-03 12:06:55 -04:00
Reedy 1c526b7443 Convert to HookHandler
Change-Id: Ib8ad9a58e781f7dad4b047d170a8f689802c4bad
2022-09-07 02:58:04 +01:00
Reedy 89d3f6152b Minor cleanup
Change-Id: I0b8abdbeaece73fe8759ee220b9a3aefce240e68
2022-09-07 02:48:18 +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
Arlo Breault f6607e8818 Stop using wfGetDB
This is pulled out of I59be7cabb80ace98da3c7f6f36a0d3d4f6b17d23

Change-Id: Iab6a47320995e9adb1666cd0bb728f516a2fde69
2022-08-02 14:40:30 -04:00
Kunal Mehta faf474e139 Only call getRequest()/getOutput() once in same function
Change-Id: I17b90a7d9f65dda563daa9cb09b40b965f3c49d3
2022-07-02 15:00:46 -07:00
Kunal Mehta be6c6a4eb0 Treat empty titlecategorysearch parameter same as not being present
The form will automatically add an empty &titlecategorysearch= parameter,
so treat the parameter being absent the same as empty string.

Bug: T311202
Change-Id: I377c55a59ce60f81532ae7effba60fbe29da609b
2022-07-02 14:57:43 -07:00
sbailey e306f5f681 Add namespace column and new index to Linter table - part 2
* Writes namespaceID to new "linter_namespace" field if global
   "wgLinterWriteNamespaceColumnStage" is present

Bug: T299612
Change-Id: If908c4dc99c966cde2981f9a03be38a577406a4e
2022-07-01 06:51:29 -07:00
DannyS712 c97d9e329d Start catch blocks on the same line as the preceding }
Change-Id: Idafe486275588e20846f7b3fd03adc97744d83b8
2022-06-23 00:27:00 +00:00
sbailey 79e825a466 Provide search by title prefix for any category of lint error
Bug: T185685
Change-Id: Ib667fcf5b2b1e752fde297b32b8bbe37dceabc5a
2022-06-16 13:27:14 -07:00
gerritbot 044ba77182 Fix usage of ApiBase::PARAM_* deprecated constants
The ones that are replaced with ParamValidator

Bug: T275455
Change-Id: I773e3ec3072bb25c455c080b8cd5870b3b27d23e
2022-04-04 00:37:17 +00:00
gerritbot e7dccae886 Replace deprecated ApiBase::PARAM_ with IntegerDef ones
The rest of ApiBase::PARAM_  will be done in separate patches

Bug: T275455
Change-Id: I491d4306611f53ed19aa92e119de7b386ef6bda4
2022-04-03 22:15:33 +02:00