Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F76763098
0001-SECURITY-Correctly-support-new-file-tables-in-RevDel.patch
Zabe
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
Zabe
Apr 20 2026, 11:52 AM
2026-04-20 11:52:26 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
0001-SECURITY-Correctly-support-new-file-tables-in-RevDel.patch
View Options
From 4a2a8c4ccf9e209de35acb57f86bc6bc59d9653b Mon Sep 17 00:00:00 2001
From: Alexander Vorwerk <zabe@avorwerk.net>
Date: Sun, 19 Apr 2026 20:05:50 +0200
Subject: [PATCH] SECURITY: Correctly support new file tables in RevDelFileItem
Bug: T423812
Change-Id: I644214e65e39e35837011ca21219ad1c6acf6ef9
---
includes/RevisionDelete/RevDelFileItem.php | 34 ++++++++++++++++------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/includes/RevisionDelete/RevDelFileItem.php b/includes/RevisionDelete/RevDelFileItem.php
index fc1eeee8c27..be6fbf3fcc3 100644
--- a/includes/RevisionDelete/RevDelFileItem.php
+++ b/includes/RevisionDelete/RevDelFileItem.php
@@ -119,17 +119,33 @@ class RevDelFileItem extends RevDelItem {
$this->list->deleteBatch[] = [ $this->file->getRel(), $dstRel ];
}
- # Do the database operations
+ // Do the database operations
$dbw = $this->dbProvider->getPrimaryDatabase();
- $dbw->newUpdateQueryBuilder()
- ->update( 'oldimage' )
- ->set( [ 'oi_deleted' => $bits ] )
- ->where( [
- 'oi_name' => $this->row->oi_name,
- 'oi_timestamp' => $this->row->oi_timestamp,
- 'oi_deleted' => $this->getBits()
- ] )
+ $migrationStage = MediaWikiServices::getInstance()->getMainConfig()->get(
+ MainConfigNames::FileSchemaMigrationStage
+ );
+ if ( $migrationStage & SCHEMA_COMPAT_WRITE_OLD ) {
+ $dbw->newUpdateQueryBuilder()
+ ->update( 'oldimage' )
+ ->set( [ 'oi_deleted' => $bits ] )
+ ->where( [
+ 'oi_name' => $this->row->oi_name,
+ 'oi_timestamp' => $this->row->oi_timestamp,
+ 'oi_deleted' => $this->getBits()
+ ] )
->caller( __METHOD__ )->execute();
+ }
+ if ( $migrationStage & SCHEMA_COMPAT_WRITE_NEW ) {
+ $dbw->newUpdateQueryBuilder()
+ ->update( 'filerevision' )
+ ->set( [ 'fr_deleted' => $bits ] )
+ ->where( [
+ 'fr_name' => $this->row->oi_name,
+ 'fr_timestamp' => $this->row->oi_timestamp,
+ 'fr_deleted' => $this->getBits()
+ ] )
+ ->caller( __METHOD__ )->execute();
+ }
return (bool)$dbw->affectedRows();
}
--
2.43.0
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24332885
Default Alt Text
0001-SECURITY-Correctly-support-new-file-tables-in-RevDel.patch (2 KB)
Attached To
Mode
T423821: Revision deleting a file does not update fr_deleted
Attached
Detach File
Event Timeline
Log In to Comment