X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=includes%2Fpage%2FPageArchive.php;h=19e417abe466f17223424f4c694633715fe88ded;hb=35da1bbd7cb8b4414c4fbcf331473f1024bc638d;hp=e843cf38da25143a1265452785b9a6b0d5b314f4;hpb=69d27cc0b6d779af8d870fd0e8ccb5cd41f887ab;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/PageArchive.php b/includes/page/PageArchive.php index e843cf38da..19e417abe4 100644 --- a/includes/page/PageArchive.php +++ b/includes/page/PageArchive.php @@ -21,7 +21,6 @@ use MediaWiki\MediaWikiServices; use MediaWiki\Revision\RevisionRecord; use MediaWiki\Revision\RevisionStore; -use MediaWiki\Storage\SqlBlobStore; use Wikimedia\Assert\Assert; use Wikimedia\Rdbms\IResultWrapper; use Wikimedia\Rdbms\IDatabase; @@ -69,23 +68,6 @@ class PageArchive { return true; } - /** - * List all deleted pages recorded in the archive table. Returns result - * wrapper with (ar_namespace, ar_title, count) fields, ordered by page - * namespace/title. - * - * @deprecated since 1.32. - * - * @return IResultWrapper - */ - public static function listAllPages() { - wfDeprecated( __METHOD__, '1.32' ); - - $dbr = wfGetDB( DB_REPLICA ); - - return self::listPages( $dbr, '' ); - } - /** * List deleted pages recorded in the archive matching the * given term, using search engine archive. @@ -370,59 +352,6 @@ class PageArchive { return $rec; } - /** - * Get the text from an archive row containing ar_text_id. - * - * @deprecated since 1.32. In the MCR schema, ar_text_id no longer exists. - * Calling code should switch to getArchiveRevision(). - * - * @todo remove in 1.33 - * - * @param object $row Database row - * @return string - */ - public function getTextFromRow( $row ) { - wfDeprecated( __METHOD__, '1.32' ); - - if ( empty( $row->ar_text_id ) ) { - throw new InvalidArgumentException( '$row->ar_text_id must be set and not empty!' ); - } - - $address = SqlBlobStore::makeAddressFromTextId( $row->ar_text_id ); - $blobStore = MediaWikiServices::getInstance()->getBlobStore(); - - return $blobStore->getBlob( $address ); - } - - /** - * Fetch (and decompress if necessary) the stored text of the most - * recently edited deleted revision of the page. - * - * If there are no archived revisions for the page, returns NULL. - * - * @note this bypasses any audience checks. - * - * @deprecated since 1.32. For compatibility with the MCR schema, - * calling code should switch to getLastRevisionId() and getArchiveRevision(). - * - * @todo remove in 1.33 - * - * @return string|null - */ - public function getLastRevisionText() { - wfDeprecated( __METHOD__, '1.32' ); - - $revId = $this->getLastRevisionId(); - - if ( $revId ) { - $rev = $this->getArchivedRevision( $revId ); - $content = $rev->getContent( RevisionRecord::RAW ); - return $content->serialize(); - } - - return null; - } - /** * Returns the ID of the latest deleted revision. * @@ -477,8 +406,8 @@ class PageArchive { * @param User|null $user User performing the action, or null to use $wgUser * @param string|string[]|null $tags Change tags to add to log entry * ($user should be able to add the specified tags before this is called) - * @return array|bool array(number of file revisions restored, number of image revisions - * restored, log message) on success, false on failure. + * @return array|bool [ number of file revisions restored, number of image revisions + * restored, log message ] on success, false on failure. */ public function undelete( $timestamps, $comment = '', $fileVersions = [], $unsuppress = false, User $user = null, $tags = null @@ -491,7 +420,9 @@ class PageArchive { $restoreFiles = $restoreAll || !empty( $fileVersions ); if ( $restoreFiles && $this->title->getNamespace() == NS_FILE ) { - $img = wfLocalFile( $this->title ); + /** @var LocalFile $img */ + $img = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo() + ->newFile( $this->title ); $img->load( File::READ_LATEST ); $this->fileStatus = $img->restore( $fileVersions, $unsuppress ); if ( !$this->fileStatus->isOK() ) { @@ -825,10 +756,14 @@ class PageArchive { Hooks::run( 'ArticleUndelete', [ &$this->title, $created, $comment, $oldPageId, $restoredPages ] ); + if ( $this->title->getNamespace() == NS_FILE ) { - DeferredUpdates::addUpdate( - new HTMLCacheUpdate( $this->title, 'imagelinks', 'file-restore' ) + $job = HTMLCacheUpdateJob::newForBacklinks( + $this->title, + 'imagelinks', + [ 'causeAction' => 'imagelinks', 'causeAgent' => 'file-restore' ] ); + JobQueueGroup::singleton()->lazyPush( $job ); } }