summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-26 16:42:25 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-26 16:42:25 +0100
commit571c46a701c6fafa865379a38ac4d93dbc50772b (patch)
treecd7783e1719c417be28178e17e41d5236ff0bcb1
parent1bf05079b9b82071405e108d29020c0b698cbe36 (diff)
downloadliberty-571c46a701c6fafa865379a38ac4d93dbc50772b.tar.gz
liberty-571c46a701c6fafa865379a38ac4d93dbc50772b.tar.bz2
liberty-571c46a701c6fafa865379a38ac4d93dbc50772b.zip
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 <noreply@anthropic.com>
-rwxr-xr-xincludes/classes/LibertyContent.php4
1 files changed, 4 insertions, 0 deletions
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 ] );