Commit graph

33 commits

Author SHA1 Message Date
Sergio Gimeno 152db8a06f Replace deprecated usage of wfGetDB
Bug: T330641
Change-Id: I863dc67e3196ea20c4f6145c5d3bb68b445b5195
2024-02-13 20:22:33 +01:00
Umherirrender a0ca1d89c6 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statements done manually

Change-Id: Iad87245bf8082193be72f7e482f29e9f1bad11fc
2023-12-11 16:39:00 +01:00
Fomafix 829003cabf Use $this->getServiceContainer() in maintenance and tests
Use
	$this->getServiceContainer()
instead of
	MediaWikiServices::getInstance()
in maintenance and tests.

Change-Id: I845e8f083b19da093166d6551683f2013eec7bb1
2023-11-09 20:18:48 +00:00
Reedy b003945c34 Namespace a few more classes
Change-Id: Ie233a4c8291432da3bd25d29337db52a2e97b540
2023-08-18 21:48:15 +01:00
Reedy 1bc5b6daf8 Namespace classes that need aliases
Change-Id: Ieeeaf80d04b060d6dbca1959d5e66f4c69c5a7f2
2023-08-18 19:00:41 +01:00
gerritbot fd6bdf95af Update moved class WikiMap
See T321882. Moved in I60cf4b9ef02b9d5

Bug: T321681
Change-Id: Icf209fddd9367540352d935557881d7e6e5a1e4c
2023-04-25 09:53:21 +00:00
Aaron Schulz c408c0ffa8 Remove MWEchoDBFactory::waitForReplicas()
Switch the callers to the standard Maintenance::waitForReplication() method.

Avoid using LoadBalancer::waitFor(), which will made internal soon.

Bug: T326274
Change-Id: Idf0562eb33d90ff70eb3a7d5d7f54da944423d27
2023-01-05 13:14:56 -08:00
Umherirrender ffeee975a4 Replace deprecated User::newFromIdentity with UserFactory
Moved the factory deeper into the code right before the one usage it
still needed a full user object

Narrow done method arguments from User to UserIdentity
and use the identity directly

Change-Id: Ic118f23ef504c7fda892480df61ea68c10915f78
2022-02-11 20:35:49 +00:00
Alexander Vorwerk ce7532b212 Replace usages of deprecated wfWikiID()
The global function wfWikiID() is deprecated since 1.35 and it's usages
should be replaced with WikiMap::getCurrentWikiId().

Bug: T298059
Change-Id: Ia8cbc992eb80ee6d531cf11bdf2bc06181bce8b0
2021-12-21 02:01:11 +00:00
Petr Pchelko a10b0b07c8 Use CentralIdLookupFactory and pass UserIdentity
Change-Id: I44144df7cf244eb867c1b261c10cc29b020f8409
2021-07-21 19:23:42 -07:00
Bartosz Dziewoński 8823aa15cd Fix Phan failure in backfillUnreadWikis
Phan says:
maintenance/backfillUnreadWikis.php:51 PhanTypeMismatchArgumentNullable Argument 1 ($userIdentity) is $lookup->localUserFromCentralId($row->euw_user, CentralIdLookup::AUDIENCE_RAW) of type ?\MediaWiki\DAO\WikiAwareEntity|?\MediaWiki\User\UserIdentity but \MediaWiki\User\UserFactory::newFromUserIdentity() takes \MediaWiki\User\UserIdentity defined at ../../includes/user/UserFactory.php:166 (expected type to be non-nullable)

Follow-up to 64531785a6.

Change-Id: I261e87d16bc23e9f1b5d3385553c5899632c9127
2021-07-21 21:04:47 +02:00
Petr Pchelko 64531785a6 Prepare for CentralIdLookup returning UserIdentity
Needed-By: I67bf4f2442269b8aa1002868ede9a71a5ca43a84
Change-Id: I4c2170a25ea8b1cf5410a4648ebec66a3ab253f3
2021-07-02 09:12:20 -07:00
Umherirrender ceac7e38d7 Use Maintenance::set/getBatchSize in maintenance scripts
No need to define own class property

Change-Id: I9c71eaee6086b3d079648ee8dba41b7600c464a1
2020-12-18 00:28:32 +01:00
Reedy 257de880c1 Make use of BatchRow(Iterator|Writer)::setCaller
Bug: T261014
Change-Id: I51df93a9ed998c25e632c35b0fcc531615ddfb80
2020-09-05 03:45:55 +00:00
Umherirrender 3c53d6acb9 phpcs: Break long lines
Use the codesniffer default of length = 120

Change-Id: Ifbfd56b20432e54805d3a9bce22cda888c1fc74d
2020-06-27 12:05:03 +02:00
Reedy aa702c1471 s/slave/replica/
Bug: T254646
Change-Id: I4de3985fd8568ce07919623efe2981bc0b6c54e5
2020-06-09 02:09:44 +01:00
Max Semenik f055f30f86 Use addDescription() instead of accessing guts directly
Change-Id: I767cbb9969c90b645e6a94ee49b2fe2352001fd8
2019-03-26 22:07:48 -07:00
Umherirrender 42f153caf5 Use ::class for class name resolution
Available since php5.5

Change-Id: I8ea594e59784bfe68911fb0b138f359a0e6b4d54
2019-03-03 15:14:15 +01:00
Roan Kattouw d0714b2928 NotifUser: Simplify function signatures for getNotificationCount() and friends
The $cached and $dbSource parameters are now unused, so remove them.
This affects get{Notification,Alert,Message}Count and
getLastUnread{Notification,Alert,Message}Time.

There are some callers in other extensions and in skins, but none of
them pass any parameters (except one, which I fixed in Ice42930280da).

Change-Id: If6f10c4f163ecb1def5a150656a60d1ab5f44d52
2018-06-05 01:07:23 +00:00
Umherirrender b2b6d8b420 Change DO_MAINTENANCE to RUN_MAINTENANCE_IF_MAIN
As suggested in 26505b170adb24a6ae68945920db322c9382e470 for better
readability. Also the sniff now knows about the maintenance script

Change-Id: If3ab122c1fc12fcfbce777881ca21ecd99fb2a70
2018-03-17 21:55:20 +01:00
Brad Jorsch 93136b71ac Update for deprecation of selectFields() methods
Various selectFields() methods were deprecated in MediaWiki core change
Idcfd1556, replaced with getQueryInfo() methods.

Change-Id: I5d62ad76fdb64a9c6efd228f27e9b5f512f17d5e
Depends-On: Idcfd15568489d9f03a7ba4460e96610d33bc4089
2017-10-12 16:04:15 -04:00
libraryupgrader 7a23ddf4b0 build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I7b19fab3b1100c4973600ec95ee24160e141c5ac
2017-09-24 09:49:43 +00:00
Kunal Mehta aaf061c725 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.ExtraParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I8401abf121a7413fa191d7bc535e0ddd6cf8c3f7
2017-06-22 14:13:28 +00:00
James D. Forrester 8c810dff48 build: Update mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: I25cb61b3b92798f1259d1575a336e2b056d5764f
2016-12-05 15:54:30 -08:00
Justin Du a0fe35a95d Update Maintenance scripts to use $this->requireExtension()
* Also added $this->mDescription to removeInvalidNotification

Bug: T152139
Change-Id: I146405a3b6e81680b0ee1fb081486170d914a2b1
2016-12-05 15:54:30 -08:00
Matthew Flaschen ed626af0ad backfillUnreadWikis: Skip updateCount if race condition detected
Related doc fixes

Change-Id: I1b7545d2f86ec87e9701811ac5f4db0fec690681
2016-07-18 20:58:48 -04:00
Matthias Mullie 620d50f23f Change wfWikiId (lowercase d) to wfWikiID (uppercase D)
PHP can handle incorrect capitalization, but we should use the correct function
name.

Change-Id: I6db9bb90a8573f65cde503b771c9539faf38e75e
2016-06-29 15:11:21 +02:00
Roan Kattouw 1d05d9298c backfillUnreadWikis.php: Add rebuild mode
In rebuild mode, we only process users who already have
a row in the euw table. This reduces the number of users
we have to process significantly. Thanks to Stephane
for this idea.

Also, don't force a recache of the alert and message counts,
it's OK to fetch them from cache. We also don't need to invalidate
any caches in this script, because the transition flag from
Ibcc8ac102 will ensure that the cached global counts are
correct.

Change-Id: I69c54cac47468647df2778b2d82f1b5dd9e574d3
2016-06-17 16:02:01 +01:00
Catrope 2771b94af7 Revert "Implement backfillUnreadWikis.php in terms of resetNotificationCount()"
Better idea: invalidate caches in this script, and write
a separate script to recompute existing euw rows.

This reverts commit c83af257d2.

Change-Id: I57bccfb726eada646cb318206d9091a20d59dcf5
2016-06-17 13:43:29 +00:00
Roan Kattouw c83af257d2 Implement backfillUnreadWikis.php in terms of resetNotificationCount()
This causes it to update the notification count cache as well.
Should we perhaps rename it to recacheNotificationCounts.php?

Bug: T132954
Change-Id: I540c4296f4fbadcf2267d77b53f71ee5c2eb8b52
2016-06-08 16:16:37 +02:00
Roan Kattouw 0807c3c5ad NotifUser: Refactor getNotificationCount() and friends, add caching for global counts
Previously, getNotificationCount() only looked at local notifications,
and foreign notifications were added in separately by getMessageCount()
and getAlertCount(). This didn't make any sense and resulted in
counter-intuitive things like I4d49b543.

Instead, add a $global flag to getNotificationCount(). If $global=false,
the local count is returned as before, but if $global=true, the
global count (=local+foreign) is returned. If $global is omitted,
the user's cross-wiki notification preference determines which is returned.

Update getLastUnreadNotificationCount() in the same way, since it had
the same issues.

Also add caching for global counts and timestamps, using a global
memc key.

Bug: T133623
Change-Id: If78bfc710acd91a075771b565cc99f4c302a104d
2016-05-02 16:16:57 -07:00
Roan Kattouw 9f7fba935f Add progress markers to backfillUnreadWikis.php
Change-Id: I43fe3d9998b5ebf3ddbec9ced0394c70293b6f18
2016-01-18 19:14:34 -08:00
Matthias Mullie ecd150888e Backfill echo_unread_wikis table
Bug: T119523
Change-Id: I13a7d349e7e3a66eb4e9ea3b26578fdd877e83a6
2015-12-16 19:52:16 +01:00