aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/metastrings.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/metastrings.php')
-rw-r--r--engine/lib/metastrings.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php
index b6e3b431d..786e343ce 100644
--- a/engine/lib/metastrings.php
+++ b/engine/lib/metastrings.php
@@ -115,4 +115,25 @@
return $result;
}
+ /**
+ * Delete any orphaned entries in metastrings. This is run by the garbage collector.
+ *
+ */
+ function delete_orphaned_metastrings()
+ {
+ global $CONFIG;
+
+ $query = "
+ DELETE
+ from {$CONFIG->dbprefix}metastrings where
+ (
+ (id not in (select name_id from {$CONFIG->dbprefix}metadata)) AND
+ (id not in (select value_id from {$CONFIG->dbprefix}metadata)) AND
+ (id not in (select name_id from {$CONFIG->dbprefix}annotations)) AND
+ (id not in (select value_id from {$CONFIG->dbprefix}annotations))
+ )";
+
+ return delete_data($query);
+ }
+
?> \ No newline at end of file