From 571c46a701c6fafa865379a38ac4d93dbc50772b Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Tue, 26 May 2026 16:42:25 +0100 Subject: Add liberty_xref cleanup to LibertyContent::expunge() liberty_xref rows are owned by content_id but were never deleted during expunge, leaving orphaned xref records whenever any content type was deleted. Co-Authored-By: Claude Sonnet 4.6 --- includes/classes/LibertyContent.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/classes/LibertyContent.php b/includes/classes/LibertyContent.php index f823236..99659e0 100755 --- a/includes/classes/LibertyContent.php +++ b/includes/classes/LibertyContent.php @@ -496,6 +496,10 @@ class LibertyContent extends LibertyBase implements BitCacheable { $query = "DELETE FROM `".BIT_DB_PREFIX."liberty_content_links` WHERE `to_content_id` = ? or `from_content_id` = ?"; $result = $this->mDb->query( $query, [ $this->mContentId, $this->mContentId ] ); + // Remove xref records owned by this content + $query = "DELETE FROM `".BIT_DB_PREFIX."liberty_xref` WHERE `content_id` = ?"; + $result = $this->mDb->query( $query, [ $this->mContentId ] ); + // Remove content $query = "DELETE FROM `".BIT_DB_PREFIX."liberty_content` WHERE `content_id` = ?"; $result = $this->mDb->query( $query, [ $this->mContentId ] ); -- cgit v1.3