diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-26 16:42:25 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-26 16:42:25 +0100 |
| commit | 571c46a701c6fafa865379a38ac4d93dbc50772b (patch) | |
| tree | cd7783e1719c417be28178e17e41d5236ff0bcb1 | |
| parent | 1bf05079b9b82071405e108d29020c0b698cbe36 (diff) | |
| download | liberty-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-x | includes/classes/LibertyContent.php | 4 |
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 ] ); |
