X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrefreshLinks.php;h=8306243c082ecadafc49e6a77dc97a13f692fb74;hb=e90012d5581801045910f31ddefa9aee52e39d39;hp=49f1cd12f67225fa9cc07b644288a41abb9420f6;hpb=d47071884ca1bfb5f24befb3231d948a05f29d3a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 49f1cd12f6..8306243c08 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -21,6 +21,7 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\IDatabase; require_once __DIR__ . '/Maintenance.php'; @@ -258,7 +259,7 @@ class RefreshLinks extends Maintenance { public static function fixLinksFromArticle( $id, $ns = false ) { $page = WikiPage::newFromID( $id ); - LinkCache::singleton()->clear(); + MediaWikiServices::getInstance()->getLinkCache()->clear(); if ( $page === null ) { return; @@ -267,17 +268,14 @@ class RefreshLinks extends Maintenance { return; } - $content = $page->getContent( Revision::RAW ); - if ( $content === null ) { - return; - } - - $updates = $content->getSecondaryDataUpdates( - $page->getTitle(), /* $old = */ null, /* $recursive = */ false ); - foreach ( $updates as $update ) { - DeferredUpdates::addUpdate( $update ); - DeferredUpdates::doUpdates(); - } + // Defer updates to post-send but then immediately execute deferred updates; + // this is the simplest way to run all updates immediately (including updates + // scheduled by other updates). + $page->doSecondaryDataUpdates( [ + 'defer' => DeferredUpdates::POSTSEND, + 'recursive' => false, + ] ); + DeferredUpdates::doUpdates(); } /**