From c1f9b1f7b1b77776192048005dcc66dcf3df2bfb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 27 Dec 2014 15:41:37 +0100 Subject: Update to MediaWiki 1.24.1 --- includes/revisiondelete/RevDelFileList.php | 128 +++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 includes/revisiondelete/RevDelFileList.php (limited to 'includes/revisiondelete/RevDelFileList.php') diff --git a/includes/revisiondelete/RevDelFileList.php b/includes/revisiondelete/RevDelFileList.php new file mode 100644 index 00000000..57e15d81 --- /dev/null +++ b/includes/revisiondelete/RevDelFileList.php @@ -0,0 +1,128 @@ +ids as $timestamp ) { + $archiveNames[] = $timestamp . '!' . $this->title->getDBkey(); + } + + return $db->select( + 'oldimage', + OldLocalFile::selectFields(), + array( + 'oi_name' => $this->title->getDBkey(), + 'oi_archive_name' => $archiveNames + ), + __METHOD__, + array( 'ORDER BY' => 'oi_timestamp DESC' ) + ); + } + + public function newItem( $row ) { + return new RevDelFileItem( $this, $row ); + } + + public function clearFileOps() { + $this->deleteBatch = array(); + $this->storeBatch = array(); + $this->cleanupBatch = array(); + } + + public function doPreCommitUpdates() { + $status = Status::newGood(); + $repo = RepoGroup::singleton()->getLocalRepo(); + if ( $this->storeBatch ) { + $status->merge( $repo->storeBatch( $this->storeBatch, FileRepo::OVERWRITE_SAME ) ); + } + if ( !$status->isOK() ) { + return $status; + } + if ( $this->deleteBatch ) { + $status->merge( $repo->deleteBatch( $this->deleteBatch ) ); + } + if ( !$status->isOK() ) { + // Running cleanupDeletedBatch() after a failed storeBatch() with the DB already + // modified (but destined for rollback) causes data loss + return $status; + } + if ( $this->cleanupBatch ) { + $status->merge( $repo->cleanupDeletedBatch( $this->cleanupBatch ) ); + } + + return $status; + } + + public function doPostCommitUpdates() { + $file = wfLocalFile( $this->title ); + $file->purgeCache(); + $file->purgeDescription(); + $purgeUrls = array(); + foreach ( $this->ids as $timestamp ) { + $archiveName = $timestamp . '!' . $this->title->getDBkey(); + $file->purgeOldThumbnails( $archiveName ); + $purgeUrls[] = $file->getArchiveUrl( $archiveName ); + } + if ( $this->getConfig()->get( 'UseSquid' ) ) { + // purge full images from cache + SquidUpdate::purge( $purgeUrls ); + } + + return Status::newGood(); + } + + public function getSuppressBit() { + return File::DELETED_RESTRICTED; + } +} -- cgit v1.2.3-54-g00ecf