X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrefreshLinks.php;h=3f48abbb8ef05edfe627cebf6cc327850c3f3732;hb=f1f9006707a2324505a9d97b32f07bf5a28aa37e;hp=9ca4e986c8a7b817167d46355fc1aeb6dda859d7;hpb=84fa176c9c14cca4dee674c284deb6e6796d928a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 9ca4e986c8..3f48abbb8e 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -22,6 +22,7 @@ */ use MediaWiki\MediaWikiServices; +use MediaWiki\Storage\RevisionRecord; use Wikimedia\Rdbms\IDatabase; require_once __DIR__ . '/Maintenance.php'; @@ -231,7 +232,7 @@ class RefreshLinks extends Maintenance { } $rt = null; - $content = $page->getContent( Revision::RAW ); + $content = $page->getContent( RevisionRecord::RAW ); if ( $content !== null ) { $rt = $content->getUltimateRedirectTarget(); } @@ -268,17 +269,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(); } /**