jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/405660 )
Change subject: Fix to not delete data from "read-only" tables
......................................................................
Fix to not delete data from "read-only" tables
i.e., tables that have an existing "replacement table".
Change-Id: Ie0dc47b5e5b81aabbae68f2a50a2441dd1d2cfdf
---
M Cargo.hooks.php
1 file changed, 8 insertions(+), 1 deletion(-)
Approvals:
Yaron Koren: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Cargo.hooks.php b/Cargo.hooks.php
index e7ab103..58b7a9b 100644
--- a/Cargo.hooks.php
+++ b/Cargo.hooks.php
@@ -122,7 +122,9 @@
}
/**
- * Delete a page
+ * Deletes all Cargo data for a specific page - *except* data
+ * contained in Cargo tables which are read-only because their
+ * "replacement table" exists.
*
* @param int $pageID
* @TODO - move this to a different class, like CargoUtils?
@@ -142,6 +144,11 @@
while ( $row = $dbw->fetchRow( $res ) ) {
$curMainTable = $row['table_name'];
+ if ( $cdb->tableExists( $curMainTable . '__NEXT' ) ) {
+ // It's a "read-only" table - ignore.
+ continue;
+ }
+
// First, delete from the "field" tables.
$res2 = $dbw->select( 'cargo_tables', 'field_tables',
array( 'main_table' => $curMainTable ) );
$row2 = $dbw->fetchRow( $res2 );
--
To view, visit https://gerrit.wikimedia.org/r/405660
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie0dc47b5e5b81aabbae68f2a50a2441dd1d2cfdf
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits