aboutsummaryrefslogtreecommitdiffstats
path: root/includes/deferred
Commit message (Collapse)AuthorAgeFilesLines
...
* Move array destructuring into foreachUmherirrender2023-07-081-2/+1
| | | | Change-Id: I54c98085b21f1fe48ccf575d1b9dd60d3b855c58
* Replace IDatabase::delete with DeleteQueryBuilderUmherirrender2023-06-212-9/+16
| | | | Change-Id: Ie0c1c955ca1a7028f75f24563fdeb9f94285af30
* Merge "Migrate more usages of Database::update() to UpdateQueryBuilder"jenkins-bot2023-06-091-5/+5
|\
| * Migrate more usages of Database::update() to UpdateQueryBuilderAlexander Vorwerk2023-06-091-5/+5
| | | | | | | | | | Bug: T330640 Change-Id: I094eea810886b13d832be575d9b9df8f8e4a77ea
* | Replace some more usages of deprecated MWExceptionDaimona Eaytoy2023-06-091-3/+2
|/ | | | | Bug: T328220 Change-Id: I3c36835fbd90acc301731e2b33ae4815cd4b0cc5
* Migrate Database::update() to UpdateQueryBuilderAmir Sarabadani2023-06-082-13/+15
| | | | | | | | I did this using a script written on top of antlr4 parser so it doesn't have some clean ups a human would do but it's pretty nice already. Bug: T330640 Change-Id: I608566700c6d737ee986bf47dda87effc69614d6
* Replace some deprecated wfExpandUrl calls with UrlUtils::expandJames D. Forrester2023-05-301-1/+1
| | | | | Bug: T319340 Change-Id: I2d81c2d7fd31bb07a2d2057361f1670cdeb8b8d0
* Injecting dependencies into DeferredUpdatesManagerDannyS7122023-05-291-38/+66
| | | | | | | | | | | - StatsdDataFactoryInterface - LBFactory - LoggerInterface - $wgCommandLineMode - JobQueueGroupFactory Bug: T265749 Change-Id: I98af8e28e2be33a24a453586ec010a27c5bb5f38
* Add DeferredUpdatesManager service to replace DeferredUpdatesDannyS7122023-05-292-268/+556
| | | | | | | | | | | | | | | | | | | This patch doesn't deal with the injection of dependencies and removal of the global state, but rather moves the code from DeferredUpdates to the new service essentially as-is, to simplify review. The changes to inject the various services needed and make DeferredUpdatesManager a proper service will be done in follow-ups, to make them easier to follow. While almost everything is changed from static to non-static, DeferredUpdates::$scopeStack remains static as DeferredUpdatesManager::$scopeStack, just in case multiple versions of the service are created, to ensure that no updates are missed. Bug: T265749 Change-Id: I7f07eddf2fc399b15db4fe9be4c792ef8eb0747b
* Reorg: Move SiteStats*.php to SiteStats/Amir Sarabadani2023-04-271-0/+1
| | | | | | | | | | It's going to be a bit small and narrow but it's better than sitting in the root of includes/ plus I hope we can hollow out SiteStatsUpdate class into the third one and or move this under a better directory in the future. Bug: T321882 Change-Id: Ia503b53b31ca00600f8c18b61a2652c3e146494e
* Fix Phan suppressions related to Title::castFrom*() and friendsBartosz Dziewoński2023-04-222-7/+3
| | | | | | | | | | | | | | | | | | | | | There is no way to express that Title::castFromPageIdentity(), Title::castFromPageReference() and Title::castFromLinkTarget() can only return null when the parameter is null. We need to add Phan suppressions or explicit types almost everywhere that these methods are used with parameters that are known to not be null. Instead, introduce new methods Title::newFromPageIdentity() and Title::newFromPageReference() (Title::newFromLinkTarget() already exists), without the null-coalescing behavior, and use them when the parameter is not null. This lets static analysis tools, and humans, easily understand where nulls can't appear. Do the same with the corresponding TitleFactory methods. Change the obvious uses of castFrom*() to newFrom*() (if there is a Phan suppression, a type check, or a method call on the result). Change-Id: Ida4da75953cf3bca372a40dc88022443109ca0cb
* Just another 80 or so PHPStorm inspection fixes (#4)Tim Starling2023-03-251-1/+1
| | | | | | | | | | | | | * Unnecessary regex modifier. I agree with this inspection which flags /s modifiers on regexes that don't use a dot. * Property declared dynamically. * Unused local variable. But it's acceptable for an unused local variable to take the return value of a method under test, when it is being tested for its side-effects. And it's acceptable for an unused local variable to document unused list expansion elements, or the nature of array keys in a foreach. Change-Id: I067b5b45dd1138c00e7269b66d3d1385f202fe7f
* Fix some typosMatěj Suchánek2023-03-211-1/+1
| | | | | Bug: T201491 Change-Id: I5c9408c262f09c936525f35abfacfa92a193b791
* Merge "Reorg: Move LinkFilter to ExternalLinks"jenkins-bot2023-03-031-1/+1
|\
| * Reorg: Move LinkFilter to ExternalLinksAmir Sarabadani2023-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | It's one-class namespace and I know it's not great but: - I hope to add more classes with the redesign of externallinks table - It's not named very well either, it's a collection of URL-related functionalities - Making it clear LinkFilter is about external links, not internal or interwiki or templatelinks etc. Bug: T321882 Change-Id: I0dd530237f45e4fec786178ec03ee941c6bcd982
* | Reorg: Namespace the Title classJames D. Forrester2023-03-025-5/+5
|/ | | | | | | | | | | | | | | | | | | This is moderately messy. Process was principally: * xargs rg --files-with-matches '^use Title;' | grep 'php$' | \ xargs -P 1 -n 1 sed -i -z 's/use Title;/use MediaWiki\\Title\\Title;/1' * rg --files-without-match 'MediaWiki\\Title\\Title;' . | grep 'php$' | \ xargs rg --files-with-matches 'Title\b' | \ xargs -P 1 -n 1 sed -i -z 's/\nuse /\nuse MediaWiki\\Title\\Title;\nuse /1' * composer fix Then manual fix-ups for a few files that don't have any use statements. Bug: T166010 Follows-Up: Ia5d8cb759dc3bc9e9bbe217d0fb109e2f8c4101a Change-Id: If8fc9d0d95fc1a114021e282a706fc3e7da3524b
* Switch some simple use of LoadBalancer to use new LBFactory methodsAmir Sarabadani2023-02-231-1/+1
| | | | | Bug: T326274 Change-Id: I837f7a7b0fad4353dbd670eec609fedfd0603af1
* LinksUpdate: Use DB key for category links tableFunc2023-02-101-1/+3
| | | | | | | | | | | | | | | The first parameter returned from findVariantLink() is not the DB key, which whitespaces should be replaced with underscores. Also: 1. Replaced Title::makeTitleSafe with Title::makeTitle, invalid links would be treated as plain text by the parser and can never hit this code path. And the makeTitle function below is also using Title::makeTitle. 2. Updated the document of findVariantLink(). Bug: T328477 Change-Id: I2b08edd90666e0fa4eafe91444a58806909b02d6
* Reorg: Move category-related classes from includes/ to Category/Amir Sarabadani2023-02-091-1/+1
| | | | | Bug: T321882 Change-Id: I0b86acfdeaa3a2a0a14b7763fd088122820bafdc
* Select recent changes for deletion only by page idMatěj Suchánek2023-02-011-13/+2
| | | | | | | | | | | | | | | | | | | The problem this patch fixes: - Step 1: Move an existing page A to a new title B. - Step 2: Delete the redirect at the old title A. - What happened: All the edits made to the page prior to the move are gone from recent changes. - What should have happened: all the edits made to the page prior to the move are still in recent changes under the (now redlinked) title A. Contrary to that, moving a page with redirect suppression would preserve the changes. Bug: T140960 Bug: T307865 Change-Id: Ib52a9c657620275388012a778bc9d839dd740624
* deferred: Make use of ServiceOptionsDerick Alangi2023-01-272-2/+18
| | | | | | | This is to ensure that the configs being used are those explicitly specified by constructor options. Change-Id: I1ed3814f37ca74efc11c3984f5d18c717ee5de6b
* deferred,jobqueue,rdbms: Change logger->notice to info or warningTimo Tijhof2023-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | MediaWiki generally only uses four levels: * 'debug': Verbose information, e.g. during local dev, CI, and in "Verbose" mode in production via WikimediaDebug. * 'info': Diagnostics. Enabled for most channels even for production traffic, though typically hidden in Logstash along with 'debug', and instead reviewed in combination with other messages from the same request when the request is investigated for a different reason. * 'warning': Diagnostics,. Typically hidden in Logstash, except for dashboards for component's own maintainers, to assess system health. Warnings are rare but expected to some degree at scale. * 'error': Something has gone wrong that should in theory not happen. Typically included even in system-wide dashboards and sometimes used for alerting. Afaik we have no meaning associated with 'notice'. At WMF I found no dashboards selecting it, no alerts using it, and no channels used it as the threshold for including or discarding messages. Instead, lower them to info(), or raise them to warning(). Change-Id: Ie927643d774ba696ec33c7e6b7023b1a1b831d12
* deferred: Remove internal DeferredUpdates::doUpdates parameterTimo Tijhof2023-01-061-3/+2
| | | | | | Unused as of June 2022 with e802062e11 (I0089fa01524924). Change-Id: I51a30d7bc1550880cd44c1f1d4e104d0e9e7c2c0
* refreshlinks: skip replica wait checks for single-batch link updatesAaron Schulz2023-01-022-11/+20
| | | | | | | | It is not worth breaking atomicity and delaying execution just to wait for a few rows to replicate. This is similar to existing logic in LinksDeletionUpdate. Change-Id: I353dab14a439f93279d0dc7f4628eddf2fcde810
* Drop unused deprecated hooksAmir Sarabadani2022-11-285-75/+2
| | | | | | | | Part one, none of these hooks are used in extensions deployed in production. I skipped any hook that has silenced its deprecation warnings. Change-Id: Idf1fd12cc61ca30867dc9f8aeb1701fe035fc5ff
* Remove unused variable from unpacking arraysUmherirrender2022-11-222-2/+2
| | | | Change-Id: Iac27cb4aa936cb494b3e491ce22c88c7fad375a1
* Track reason for rendering in more detail.daniel2022-11-151-1/+1
| | | | | | | | | | When setting causeAgent for jobs, be specific. When creating parserOptions, call setRenderReason. This allows us to capture statistics on what actions cause jobs, renders, and cache writes. Change-Id: Iaef64beadce1489bebb6bb00855c3ba6013a29d8
* Remove some deprecated methods from deferred updatesMatěj Suchánek2022-11-093-38/+0
| | | | | | They have already been deprecated and are unused. Change-Id: I0d1a45df6b6cf6b144492e51cf6368d25c72565e
* Remove HTMLCacheUpdateMatěj Suchánek2022-11-081-61/+0
| | | | | | It has been deprecated since 1.34 and it is unused. Change-Id: Id2042eb7c2077c650c42aef9484ca31117a4ad0b
* objectcache: Remove WANObjectCacheReaper featureTimo Tijhof2022-10-251-137/+0
| | | | | | | | | | Introduced in 2017 with I7f14b9ca2533032 (2e5eb693) but remains unused at WMF, and disabled by default. Follows-up I62107789fa (9e49260fc958) which added reap to LinkCache test cases in 2021. Change-Id: I0654c29a671467dd6b366f462d1c09b90a273413
* Externallinks: Add ability to write to the new fieldsAmir Sarabadani2022-10-252-6/+22
| | | | | | | | | This only supports WRITE_BOTH for now, the rest will be implemented. Tested locally, works fine. Bug: T318606 Change-Id: I6f898aa89f7d36f3f8a4eb8c23706c64a90896b0
* Use short array destructuring instead of list()Tim Starling2022-10-212-4/+4
| | | | | | | | Introduced in PHP 7.1. Because it's shorter and looks nice. I used regex replacement. Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
* Merge "Replace trivial usages of code in strings with concatenation"jenkins-bot2022-08-261-1/+1
|\
| * Replace trivial usages of code in strings with concatenationThiemo Kreuz2022-08-261-1/+1
| | | | | | | | | | | | | | This is really hard to read. What is code, what is string? These places are so simple, they really don't need the "{$var}" syntax. Change-Id: I589dedb8c0193eec4eef500bbb896b5b790b727b
* | SiteStats: Make sure initSiteStats.php re-distribute valuesAmir Sarabadani2022-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | When the setting for sharding is on, the script actually flush all values to the first row. Since this is being ran regularly in production, it has been causing drifts between values and reality. Tested locally, works fine. Bug: T315693 Change-Id: Id9fe16eecd153b4ba2b7d28baadec3a9a44b4ee1
* | Merge "Log a debug message when a search update is ignored..."jenkins-bot2022-08-161-0/+3
|\ \ | |/ |/|
| * Log a debug message when a search update is ignored...David Causse2022-06-241-0/+3
| | | | | | | | | | | | ...because search updates are disabled by config. Change-Id: Ie128a5e669a933c9f6c7356839fcbb05e30bfe64
* | LinksUpdate: Last pieces of templatelinks migrationAmir Sarabadani2022-07-251-6/+38
| | | | | | | | | | | | | | | | I dropped the columns and these paths started to fatal. Nothing super complicated. Bug: T312865 Change-Id: Ic44edc5b4a2d8da924ba6176b619715e4780bddd
* | Merge "Add support for write new for templatelinks migration"jenkins-bot2022-07-121-2/+4
|\ \
| * | Add support for write new for templatelinks migrationAmir Sarabadani2022-07-121-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - schema change to allow tl_namespace and tl_title being empty This is done by removing them from primary key. They don't need to be nullable as they have default value. - Make sure with WRITE_NEW, updater avoids writing to the old columns Bug: T306674 Change-Id: I2b8a29043e952060e7a79b6a7a3d647d48cd16fb
* | | Hard deprecate HTMLCacheUpdateMatěj Suchánek2022-07-111-1/+3
| | | | | | | | | | | | | | | | | | The class has been deprecated since 1.34 and it is unused. Change-Id: If62eb4d7526f0238a5ddbeb650396ce604799d20
* | | Hard deprecate CdnCacheUpdate::newFromTitlesMatěj Suchánek2022-07-101-1/+2
| | | | | | | | | | | | | | | | | | It has been deprecated since 1.35 and it is unused. Change-Id: I2d5cf9e8a7401d7126e9deed20b3d071ca3998f6
* | | Hard deprecate DataUpdate::runUpdatesMatěj Suchánek2022-07-101-1/+2
|/ / | | | | | | | | | | It has been deprecated since 1.28 and it is unused. Change-Id: I68ade12cf81d0097079b70ea6526d32cb2dda8bc
* | deferred: Remove unused $mode and jobify() from internal doUpdatesTimo Tijhof2022-06-211-63/+7
| | | | | | | | | | | | | | Keep the $unused for now since, while it is internal, there are actually callers in test suites of various extensions. Change-Id: Ib56298c98b26b22568abcd71bc844651b120fe01
* | deferred: Remove unused $mode of internal tryOpportunisticExecuteTimo Tijhof2022-06-171-9/+4
| | | | | | | | | | | | Has not been used for a while. Change-Id: I0089fa01524924a092a616ebfa190a360ff957b3
* | Allow sharding in site_stats updateAmir Sarabadani2022-05-301-2/+27
| | | | | | | | | | | | | | | | This would be useful in cases that lots of edits happen at the same time and this would reduce the time waiting to get the row lock. Bug: T306589 Change-Id: I3b869e3b85dfd66575390ef4247f2f81f19c878e
* | Merge "Use User::isRegistered for readability instead of ::getId falsy check"jenkins-bot2022-05-231-2/+2
|\ \ | |/ |/|
| * Use User::isRegistered for readability instead of ::getId falsy checkUmherirrender2022-04-291-2/+2
| | | | | | | | Change-Id: I42aab149559e3e899cde6c77af76c66936ed0ef0
* | Replace LoadBalancer/LBFactory callback iteration with generatorsTim Starling2022-04-291-10/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Callback style iteration made sense before generators existed, but generators make for simpler code. The "call method" variants made sense before closures existed but defeat static analysis. So, in LBFactory: * Add ILBFactory::getAllLBs() * Deprecate ILBFactory::forEachLB() * Remove LBFactory::forEachLBCallMethod(), was protected. * Add LBFactory::getLBsForOwner(), which is protected and has the internal interface in @return. Adding a new abstract method breaks Wikibase tests despite LBFactory not being stable to extend. * Migrate callers. Generators allow you to return/break from the middle of the loop, which implies a little rearrangement for some callers. In LoadBalancer, connections supposedly of type IDatabase were routinely type-hinted as Database in closure parameters so that methods could be called that were not in the interface. So it's convenient to get rid of public iteration methods entirely in favour of private methods returning Database[]. * Hard-deprecate ILoadBalancerForOwner::forEachOpenConnection() and replace it with a private generator method since nothing called it externally except for core tests. * Hard-deprecate ILoadBalancerForOwner::forEachOpenPrimaryConnection() and replace it with a private generator. DeferredUpdates needed it for iterating over IDatabase::explicitTrxActive(), so add ILoadBalancer::explicitTrxActive() as a replacement. * Replace private method LoadBalancer::forEachOpenReplicaConnection() with a generator. Depends-On: If0b382231e27d6d1197fb7b6aef6ab50335df4e5 Change-Id: I64514e77b9bfe737be5b12e1d3c9c49976bb522f
* Use MainConfigNames instead of string literals, #4Aryeh Gregor2022-04-267-13/+20
| | | | | | | | | | | | | | | | | | | | | Now largely automated: VARS=$(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | \ tr "\n" '|' | sed "s/|$/\n/;s/'//g") sed -i -E "s/'($VARS)'/MainConfigNames::\1/g" \ $(grep -ERIl "'($VARS)'" includes/) Then git add -p with lots of error-prone manual checking. Then semi-manually add all the necessary "use" lines: vim $(grep -L 'use MediaWiki\\MainConfigNames;' \ $(git diff --cached --name-only --diff-filter=M HEAD^)) I didn't bother fixing lines that were over 100 characters unless they were over 120 and triggered phpcs. Bug: T305805 Change-Id: I74e0ab511abecb276717ad4276a124760a268147