X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27user%27%2C%20userid=session.user.id%29%20%7D%7D?a=blobdiff_plain;f=maintenance%2FmigrateArchiveText.php;h=7bbf3d0905299037a69a47647f710db75f7d8f18;hb=eda773a437933f2126d84a23c71b177820be3e32;hp=b2b14cbdc4c389e153c2eed34f379e3611a712a2;hpb=925c20a9ca669c67cc44f4468d0e0f3b33b94213;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/migrateArchiveText.php b/maintenance/migrateArchiveText.php index b2b14cbdc4..7bbf3d0905 100644 --- a/maintenance/migrateArchiveText.php +++ b/maintenance/migrateArchiveText.php @@ -21,6 +21,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -55,9 +57,12 @@ class MigrateArchiveText extends LoggedUpdateMaintenance { } protected function doDBUpdates() { - global $wgDefaultExternalStore; - $replaceMissing = $this->hasOption( 'replace-missing' ); + $defaultExternalStore = $this->getConfig()->get( 'DefaultExternalStore' ); + // @phan-suppress-next-line PhanAccessMethodInternal + $blobStore = MediaWikiServices::getInstance() + ->getBlobStoreFactory() + ->newSqlBlobStore(); $batchSize = $this->getBatchSize(); $dbr = $this->getDB( DB_REPLICA, [ 'vslow' ] ); @@ -91,16 +96,14 @@ class MigrateArchiveText extends LoggedUpdateMaintenance { // Recompress the text (and store in external storage, if // applicable) if it's not already in external storage. - if ( !in_array( 'external', explode( ',', $row->ar_flags ), true ) ) { - $data = Revision::getRevisionText( $row, 'ar_' ); + $arFlags = explode( ',', $row->ar_flags ); + if ( !in_array( 'external', $arFlags, true ) ) { + $data = $blobStore->decompressData( $row->ar_text, $arFlags ); if ( $data !== false ) { $flags = Revision::compressRevisionText( $data ); - if ( $wgDefaultExternalStore ) { + if ( $defaultExternalStore ) { $data = ExternalStore::insertToDefault( $data ); - if ( !$data ) { - throw new MWException( "Unable to store text to external storage" ); - } if ( $flags ) { $flags .= ','; }