aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/metadata.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/metadata.php')
-rw-r--r--engine/lib/metadata.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 3decc1461..57987107c 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -730,6 +730,27 @@
return delete_data("DELETE from {$CONFIG->dbprefix}metadata where entity_guid={$entity_guid}");
}
return false;
+ }
+
+ /**
+ * Clear all annotations belonging to a given owner_guid
+ *
+ * @param int $owner_guid The owner
+ */
+ function clear_metadata_by_owner($owner_guid)
+ {
+ $owner_guid = (int)$owner_guid;
+
+ $metas = get_data("SELECT id from {$CONFIG->dbprefix}metadata WHERE owner_guid=$owner_guid");
+ $deleted = 0;
+
+ foreach ($metas as $id)
+ {
+ if (delete_metadata($id)) // Is this the best way?
+ $deleted++;
+ }
+
+ return $deleted;
}
/**