dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Add attributes parameter to ShowSearchHitTitle"
[lhc/web/wiklou.git]
/
includes
/
deferred
/
LinksUpdate.php
diff --git
a/includes/deferred/LinksUpdate.php
b/includes/deferred/LinksUpdate.php
index
33d4e70
..
c27826d
100644
(file)
--- a/
includes/deferred/LinksUpdate.php
+++ b/
includes/deferred/LinksUpdate.php
@@
-306,10
+306,13
@@
class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
* using the job queue.
*/
protected function queueRecursiveJobs() {
* using the job queue.
*/
protected function queueRecursiveJobs() {
- self::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks' );
+ $action = $this->getCauseAction();
+ $agent = $this->getCauseAgent();
+
+ self::queueRecursiveJobsForTable( $this->mTitle, 'templatelinks', $action, $agent );
if ( $this->mTitle->getNamespace() == NS_FILE ) {
// Process imagelinks in case the title is or was a redirect
if ( $this->mTitle->getNamespace() == NS_FILE ) {
// Process imagelinks in case the title is or was a redirect
- self::queueRecursiveJobsForTable( $this->mTitle, 'imagelinks' );
+ self::queueRecursiveJobsForTable( $this->mTitle, 'imagelinks'
, $action, $agent
);
}
$bc = $this->mTitle->getBacklinkCache();
}
$bc = $this->mTitle->getBacklinkCache();
@@
-320,7
+323,13
@@
class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
// Which ever runs first generally no-ops the other one.
$jobs = [];
foreach ( $bc->getCascadeProtectedLinks() as $title ) {
// Which ever runs first generally no-ops the other one.
$jobs = [];
foreach ( $bc->getCascadeProtectedLinks() as $title ) {
- $jobs[] = RefreshLinksJob::newPrioritized( $title, [] );
+ $jobs[] = RefreshLinksJob::newPrioritized(
+ $title,
+ [
+ 'causeAction' => $action,
+ 'causeAgent' => $agent
+ ]
+ );
}
JobQueueGroup::singleton()->push( $jobs );
}
}
JobQueueGroup::singleton()->push( $jobs );
}
@@
-330,8
+339,12
@@
class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
*
* @param Title $title Title to do job for
* @param string $table Table to use (e.g. 'templatelinks')
*
* @param Title $title Title to do job for
* @param string $table Table to use (e.g. 'templatelinks')
+ * @param string $action Triggering action
+ * @param string $userName Triggering user name
*/
*/
- public static function queueRecursiveJobsForTable( Title $title, $table ) {
+ public static function queueRecursiveJobsForTable(
+ Title $title, $table, $action = 'unknown', $userName = 'unknown'
+ ) {
if ( $title->getBacklinkCache()->hasLinks( $table ) ) {
$job = new RefreshLinksJob(
$title,
if ( $title->getBacklinkCache()->hasLinks( $table ) ) {
$job = new RefreshLinksJob(
$title,
@@
-340,7
+353,7
@@
class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
'recursive' => true,
] + Job::newRootJobParams( // "overall" refresh links job info
"refreshlinks:{$table}:{$title->getPrefixedText()}"
'recursive' => true,
] + Job::newRootJobParams( // "overall" refresh links job info
"refreshlinks:{$table}:{$title->getPrefixedText()}"
- )
+ )
+ [ 'causeAction' => $action, 'causeAgent' => $userName ]
);
JobQueueGroup::singleton()->push( $job );
);
JobQueueGroup::singleton()->push( $job );
@@
-366,20
+379,22
@@
class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
return;
}
return;
}
- $
wikiId = $this->getDB()->getWiki
ID();
+ $
domainId = $this->getDB()->getDomain
ID();
$wp = WikiPage::factory( $this->mTitle );
$lbf = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
// T163801: try to release any row locks to reduce contention
$wp = WikiPage::factory( $this->mTitle );
$lbf = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
// T163801: try to release any row locks to reduce contention
- $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ '
wiki' => $wiki
Id ] );
+ $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ '
domain' => $domain
Id ] );
foreach ( array_chunk( array_keys( $added ), $wgUpdateRowsPerQuery ) as $addBatch ) {
$wp->updateCategoryCounts( $addBatch, [], $this->mId );
foreach ( array_chunk( array_keys( $added ), $wgUpdateRowsPerQuery ) as $addBatch ) {
$wp->updateCategoryCounts( $addBatch, [], $this->mId );
- $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $wikiId ] );
+ $lbf->commitAndWaitForReplication(
+ __METHOD__, $this->ticket, [ 'domain' => $domainId ] );
}
foreach ( array_chunk( array_keys( $deleted ), $wgUpdateRowsPerQuery ) as $deleteBatch ) {
$wp->updateCategoryCounts( [], $deleteBatch, $this->mId );
}
foreach ( array_chunk( array_keys( $deleted ), $wgUpdateRowsPerQuery ) as $deleteBatch ) {
$wp->updateCategoryCounts( [], $deleteBatch, $this->mId );
- $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $wikiId ] );
+ $lbf->commitAndWaitForReplication(
+ __METHOD__, $this->ticket, [ 'domain' => $domainId ] );
}
}
}
}
@@
-450,10
+465,12
@@
class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
}
}
}
}
+ $domainId = $this->getDB()->getDomainID();
+
foreach ( $deleteWheres as $deleteWhere ) {
$this->getDB()->delete( $table, $deleteWhere, __METHOD__ );
$lbf->commitAndWaitForReplication(
foreach ( $deleteWheres as $deleteWhere ) {
$this->getDB()->delete( $table, $deleteWhere, __METHOD__ );
$lbf->commitAndWaitForReplication(
- __METHOD__, $this->ticket, [ '
wiki' => $this->getDB()->getWikiID()
]
+ __METHOD__, $this->ticket, [ '
domain' => $domainId
]
);
}
);
}
@@
-461,7
+478,7
@@
class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
foreach ( $insertBatches as $insertBatch ) {
$this->getDB()->insert( $table, $insertBatch, __METHOD__, 'IGNORE' );
$lbf->commitAndWaitForReplication(
foreach ( $insertBatches as $insertBatch ) {
$this->getDB()->insert( $table, $insertBatch, __METHOD__, 'IGNORE' );
$lbf->commitAndWaitForReplication(
- __METHOD__, $this->ticket, [ '
wiki' => $this->getDB()->getWikiID()
]
+ __METHOD__, $this->ticket, [ '
domain' => $domainId
]
);
}
);
}
@@
-1143,7
+1160,7
@@
class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
}
return [
}
return [
- 'wiki' =>
$this->getDB()->getWikiID(
),
+ 'wiki' =>
WikiMap::getWikiIdFromDomain( $this->getDB()->getDomainID()
),
'job' => new JobSpecification(
'refreshLinksPrioritized',
[
'job' => new JobSpecification(
'refreshLinksPrioritized',
[
@@
-1152,6
+1169,8
@@
class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate {
'useRecursiveLinksUpdate' => $this->mRecursive,
'triggeringUser' => $userInfo,
'triggeringRevisionId' => $triggeringRevisionId,
'useRecursiveLinksUpdate' => $this->mRecursive,
'triggeringUser' => $userInfo,
'triggeringRevisionId' => $triggeringRevisionId,
+ 'causeAction' => $this->getCauseAction(),
+ 'causeAgent' => $this->getCauseAgent()
],
[ 'removeDuplicates' => true ],
$this->getTitle()
],
[ 'removeDuplicates' => true ],
$this->getTitle()