Commit graph

465 commits

Author SHA1 Message Date
jenkins-bot
347275f940 Merge "Add configuration for write both on templatelinks table" 2022-03-08 16:15:57 +00:00
Umherirrender
7b091a2a49 deferred: Improve port handling in CdnCacheUpdate::naivePurge
Avoid null on php internal and cast to int

Found by phan strict checks

Change-Id: Ifb874b366d88cde51960004e5489a9c57ca9c4c6
2022-03-03 21:23:38 +01:00
Amir Sarabadani
f7298b59b8 Add configuration for write both on templatelinks table
Bug: T299419
Change-Id: Ic288ba021eecbed438e9337e52a41c59a89b6a9b
2022-03-03 08:48:13 +01:00
Matthias Mullie
b0bd09c939 Remove change tags for media additions/removals
This reverts commit dab7b16741.

Reason for revert: This was inaccurate/incomplete &
looks like we will not need this after all

Bug: T286362
Change-Id: I6d63d69f180d193f99986ce6878617d63cfb2b6d
2022-02-28 11:08:09 +01:00
Tim Starling
a7df0148d8 LinksTable: Cast all array keys to string
When fetching a key from an array, PHP converts numeric strings to
integers. This led to an incorrect category update query.

So:

* In LinksTable subclasses, cast all string-like array keys to string.
* Add a unit test which confirms that no integers leak into link IDs.
* Add a fully integrated regression test for T301433.

The integration test and 7 of the link ID cases are confirmed to fail
if Amir's patch is reverted.

Bug: T301433
Change-Id: I8d19443607121b3efcafb82096bcff18c41035df
2022-02-14 15:56:34 +11:00
jenkins-bot
5a2b4acdae Merge "Add hook UserEditCountUpdate" 2022-02-01 20:13:15 +00:00
jenkins-bot
aaea327efb Merge "Avoid unneeded category count updates on moves" 2022-02-01 03:33:43 +00:00
jenkins-bot
49b0a82e67 Merge "Fix page_props DELETE/INSERT on null edit" 2022-01-31 14:54:15 +00:00
Tim Starling
960a7925ae Add hook UserEditCountUpdate
Add a hook which runs at the end of UserEditCountUpdate. The idea is to
allow CentralAuth to keep its own similar edit count. There's no
other hook appropriate for this purpose since
UserEditTracker::incrementUserEditCount() has multiple callers.

Convert the private associative array in UserEditCountUpdate to a class.
Instances of the class are passed to the new hook. A class is better
suited to a public interface.

Bug: T300075
Change-Id: I16a92e6a6e9faf1be4c7fbe25354a08559df163d
2022-01-31 17:00:49 +11:00
Tim Starling
c11954c036 Fix page_props DELETE/INSERT on null edit
* In PagePropsTable, compare values after converting to string. In the
  old code this was implicitly done by array_diff_assoc().
* Also convert to string before inserting, since
  ParserOutput::setPageProperty() is documented as allowing null, but
  the field is not nullable, so the query failed.
* Add a regression test which confirms that no write queries are done on
  the second invocation of LinksUpdate.

Bug: T299662
Change-Id: I3f7d5800bf27a47cb57be80bdba13792fe3caae6
2022-01-31 15:59:28 +11:00
jenkins-bot
e1e4f7514f Merge "Convert various callers to LoadBalancer::getConnectionRef()" 2022-01-27 23:34:39 +00:00
Umherirrender
68808e5832 Replace deprecated JobQueueGroup::singleton()
Change-Id: Icdb301d352d302f70fefba9b40df2368cb217fd2
2022-01-27 21:37:50 +01:00
Aaron Schulz
c433c15087 Convert various callers to LoadBalancer::getConnectionRef()
Bug: T193565
Change-Id: I2e2ef6a1d841c632d1f3e53ca3f82a720af15d47
2022-01-27 01:02:44 +00:00
jenkins-bot
2d92617fe0 Merge "Fix deprecation warning from LinksUpdate::getImages()" 2022-01-19 04:35:27 +00:00
Tim Starling
238d2a34e8 Fix deprecation warning from LinksUpdate::getImages()
This access to mImages was unintentionally left in after the property
was deprecated.

Bug: T299472
Change-Id: Icd7f8db4d100ddc0ce30399be1f8d5e625523730
2022-01-19 15:10:47 +11:00
Umherirrender
146b581f47 Avoid unneeded category count updates on moves
Running cat_pages + 1 and cat_pages - 1 for the same rows/categories is
uneeded.
Cannot skip the whole update on move, because by use of parser functions
there could be new categories after cross namespace page moves.

Follow-Up: Ifaa4051a736b01cda82fbd890325e0751ce041f8
Change-Id: I188d0224f1a1d43746f657159e0ed8c80b8646cd
2022-01-17 19:50:40 +01:00
jenkins-bot
499a40ea06 Merge "Adjust il_from_namespace on cross namespace moves" 2022-01-17 17:22:29 +00:00
Tim Starling
84f0876b83 Add regression test for LinksDeletionUpdate loss of page_id
Bug: T299244
Change-Id: Ica31000df693ff6a4ab2c54c88b6cbdc7e70d6d0
2022-01-17 12:10:57 +11:00
Umherirrender
6b8211a811 Use immutable page identity in LinksDeletionUpdate
The page identity given the parent LinksUpdate is a mutable Title object
and the page id is refreshed after the real deletion of the page table.
When LinksUpdate is running after that is using 0 to select from link
tables and to refresh category counters.

Bug: T299244
Change-Id: I9c1da630211ad678a4e12acf437d356e1c088d7f
2022-01-17 11:48:18 +11:00
Umherirrender
6be659e0fb Adjust il_from_namespace on cross namespace moves
Bug: T299275
Follow-Up: Ifaa4051a736b01cda82fbd890325e0751ce041f8
Change-Id: I4efdceb794e8c4321e42bf13546b0854a1fb1c43
2022-01-15 14:09:43 +01:00
Tim Starling
e5a7f8f5aa LinksUpdate deprecations
Bug: T296895
Depends-On: I7c8e8cb258c3ff445457747cb761820991da6022
Change-Id: I69f4367e3cc3ef2e975d02f73f1e7199a124fe58
2022-01-14 12:57:51 +11:00
jenkins-bot
057d6f4392 Merge "Refactor global variables to use MediaWikiServices instead" 2022-01-10 20:22:20 +00:00
TChin
47adb6d65a Refactor global variables to use MediaWikiServices instead
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.

Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228

* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.

A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki

Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
2022-01-10 13:55:53 -05:00
Tim Starling
682aad7557 Move LinksUpdate and LinksDeletionUpdate into the new namespace
Change-Id: I5cf7a08324d08aa89c23540222ba8eddc1ae2647
2022-01-04 15:35:57 +11:00
Tim Starling
1aecb692f6 Write to multiple categorylinks tables on update
Add $wgTempCategoryCollations which tells LinksUpdate to write to
additional tables similar to categorylinks, except that the additional
tables have a custom collation.

This is supposed to be used with RemoteIcuCollation to ease migration to
a different version of ICU.

Bug: T263437
Change-Id: Id340d2213cc22115eda5d26f010b5287bd3796cf
2022-01-04 15:35:57 +11:00
Tim Starling
87d8ccbd3e Move the link updates from moveUnsafe() to LinksUpdate
Since LinksUpdate was already run after a page move, it was just a
matter of propagating a move flag down to it, and resolving the
differences between the move case and the edit case.

This should be faster since it avoids writing to the links tables twice
on a page move.

Change-Id: Ifaa4051a736b01cda82fbd890325e0751ce041f8
2022-01-04 15:35:57 +11:00
Tim Starling
d3b2b80067 LinksUpdate refactor
* In LinksUpdate, put each table in its own class, so that the
  special code for each table has a more elegant place to go.
* Use generators to abstract and flatten out the underlying ParserOutput
  data structures, without requiring the data to be copied. This allows
  the incremental logic which was previously duplicated for each table,
  i.e. computing insertions and deletions from the old and new state,
  to be factored out. The per-table batch classes act as container
  abstractions for the underlying data.

Bug: T263437
Depends-On: I472f4a023969bfde6298eb56112c16d2ae842199
Change-Id: Id40be19a8caa7b4669911927964cfd6755c25238
2022-01-04 15:35:57 +11:00
Thiemo Kreuz
b4c63c64ae Remove some more comments that literally repeat the code
Nothing to learn from these.

You can find a longer explanation in the comments in I93751e6.

Change-Id: I195aae70fc282b58be5b18160783f27d38605d15
2021-12-09 19:01:36 +01:00
Tim Starling
9496e37ac7 Additional tests for LinksUpdate and LinksDeletionUpdate
Each table at least needs an added, deleted and unmodified link in order
to fully exercise the incremental update code.

Disable INSERT IGNORE during testing, since this can hide an omitted
delete query.

Change-Id: Iaa9f32ea5171da4f983379d7ff313bfdf1cb0b2f
2021-12-09 12:32:06 +11:00
Tim Starling
afecf46c23 Add LinksUpdate::getPageId()
As an alternative to public property access. In LinksUpdateComplete,
$this->mId will always be set and will be more reliable than the Title
property.

Change-Id: Id046cff59c5c1fbc9a6a7fd196c4446e1234278f
2021-12-08 11:10:07 +11:00
Reedy
2a2bb1e9bd Remove or replace usages of "sane"
Bug: T254646
Change-Id: I096b2cf738a1395a14f1d47bcbed0c2c686c2581
2021-11-22 13:35:17 +00:00
jenkins-bot
ca45a3b28e Merge "Remove or replace usages of "sanity"" 2021-11-21 14:21:54 +00:00
Reedy
7bf779524a Remove or replace usages of "sanity"
Bug: T254646
Change-Id: I2b120f0b9c9e1dc1a6c216bfefa3f2463efe1001
2021-11-19 23:19:42 +00:00
Aaron Schulz
672c646d22 deferred: make DeferredUpdates::run() logic more readable
Change-Id: I620895d6f21d8e84b74ed4ad268a668cc0ac9c4b
2021-11-17 16:39:34 -08:00
Umherirrender
b1e1a11ca6 Replace deprecated JobQueueGroup::singleton in JobQueueEnqueueUpdate
Fix documentation and type hint in JobQueueEnqueueUpdate

Change-Id: I68487d0c44ed4f3064455f79f36ce896e8eff143
2021-10-19 20:09:02 +00:00
C. Scott Ananian
af5d13c5de Rename ParserOutput::{get,set,unset}Property to {get,set,unset}PageProperty
The ::getProperty() naming is too generic and doesn't clearly indicate
that these are "page properties" (which have their own table in the DB).
As part of refactoring a clean API out of ParserOutput which can be used
by Parsoid, clean up the naming here.

Soft-deprecation in this patch, there are a handful of external users
which need to be cleaned up before we hard-deprecate.

Bug: T287216
Change-Id: Ie963eea5aa0f0e984ced7c4dfa0fd65d57313cfa
2021-10-08 10:07:17 -04:00
TChin
fd5915823f Update callers of deprecated BacklinkCache methods
Bug: T290015
Change-Id: I73a111d064f7778bbeb90fd4ea85d8bec201427b
2021-09-29 18:56:17 +00:00
Alexander Vorwerk
4cf2895914 Remove the deprecated IP class
Bug: T291008
Change-Id: I83a0ad6543384be71fa8d057932f8331cc0fdc4f
2021-09-26 13:58:28 +02:00
Petr Pchelko
35f38e995b Remove User from LinksUpdate
This does a breaking change, but all (2) known usages
of the LinksUpdate::getTriggeringUser are satisfied
by UserIdentity.

Change-Id: I682ee65f7b3d30fe6c0fe76d5106857ddfa6da5d
2021-09-13 09:40:24 -07:00
Derick Alangi
db43511e6a Title: Make use of BacklinkCacheFactory service
Change-Id: I48161585de6f329ec4037156234e0b07b3b837e6
2021-09-09 14:04:02 +01:00
jenkins-bot
233fff3423 Merge "MWExceptionHandler: Rename rollbackMasterChangesAndLog to rollbackPrimaryChangesAndLog" 2021-09-07 16:31:08 +00:00
Umherirrender
5b3d3ef802 collation: Create CollationFactory service
Use ObjectFactory specs for collation classes
Avoid the language construction in the factory class,
make it a detail of the implementation of each class

Follow-Up of Ifc96f851e6091ce834dbaf0e91695c648a42169c

Bug: T286079
Change-Id: Ib581f64aec8619986fb8dd49ceee0524d59a1b84
2021-09-04 02:46:06 +02:00
James D. Forrester
3407458ea0 MWExceptionHandler: Rename rollbackMasterChangesAndLog to rollbackPrimaryChangesAndLog
Change-Id: I9a90b4f74eb65cd9e20ae9faa6d1949be96543c0
2021-09-03 17:36:34 -07:00
James D. Forrester
8426aacd96 ILoadBalancer: Rename waitForMasterPos to waitForPrimaryPos
Hard-deprecating immediately as no known users in git outside of this repo.

Bug: T282894
Change-Id: I5fa312ae89660a9c6de3c24e13d48de92893e5b0
2021-09-03 20:11:05 +00:00
James D. Forrester
3983572c49 ILoadBalancer: Rename forEachOpenMasterConnection to forEachOpenPrimaryConnection
Bug: T282894
Change-Id: I4892084aba6c7fdfbeccec42de88b9f23490b61c
2021-09-03 13:05:23 -07:00
James D. Forrester
10324c232a ILoadBalancer/ILBFactory: Rename rollbackMasterChanges to rollbackPrimaryChanges
Bug: T282894
Change-Id: I31794e052d71160195dd3b6c29fea24bc98b356b
2021-09-02 12:50:52 -07:00
jenkins-bot
9957bc2f84 Merge "ILoadBalancer/ILBFactory: Rename commitMasterChanges() to commitPrimaryChanges()" 2021-09-02 18:50:43 +00:00
jenkins-bot
5f30d77f4d Merge "ILoadBalancer/ILBFactory: Rename beginMasterChanges() to beginPrimaryChanges()" 2021-09-02 18:30:07 +00:00
James D. Forrester
5ad7ca7eba ILoadBalancer/ILBFactory: Rename commitMasterChanges() to commitPrimaryChanges()
Bug: T282894
Change-Id: I0d80be56e683924254c4e38d05e1109ea74eeab5
2021-09-02 11:27:10 -07:00
James D. Forrester
577e1c3710 ILoadBalancer/ILBFactory: Rename beginMasterChanges() to beginPrimaryChanges()
Bug: T282894
Change-Id: I10e607215e6772c48670659719948f7135472a7f
2021-09-01 22:15:45 +00:00