From 4669a3e824915d3c8418de1f6b17a6811441c617 Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 31 Oct 2008 10:33:20 +0000 Subject: Closes #493: Moved database queries out of module and in to core in line with best practice. git-svn-id: https://code.elgg.org/elgg/trunk@2369 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/metastrings.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'engine/lib/metastrings.php') 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 -- cgit v1.2.3