]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #1419: Added remove_from_river_by_annotation(). Deleting annotations now delete...
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 27 Jan 2010 16:21:40 +0000 (16:21 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Wed, 27 Jan 2010 16:21:40 +0000 (16:21 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3850 36083f99-b078-4883-b0ff-0f9b5a30f544

CHANGES.txt
engine/lib/annotations.php
engine/lib/river2.php

index 17005f971ca341384795f3e5a98c5f845e0ab5dc..b5cb10a5ab426950fe158b1083751d5d54a52a1e 100644 (file)
@@ -29,6 +29,7 @@ http://code.elgg.org/elgg/.....
   * Deprecated get_entities_from_annotations().  Use elgg_get_entities_from_annotations().
   * Reorganized directory file path to rely on GUID instead of username.
   * annotation_id column added to the river database table.
+  * remove_from_river_by_annotation() added.
   * unregister_elgg_event_handler() and unregister_plugin_hook() added. #1465
 
  Services API:
index 2ca977a091bbb999fe87ff74519ceb9d79950954..6d5c0b46a73dca67543bfedfc2aa9d392e5ebb0a 100644 (file)
@@ -1136,10 +1136,11 @@ function delete_annotation($id) {
        $annotation = get_annotation($id);
 
        if (trigger_elgg_event('delete', 'annotation', $annotation)) {
-               return delete_data("DELETE from {$CONFIG->dbprefix}annotations  where id=$id and $access");
+               remove_from_river_by_annotation($id);
+               return delete_data("DELETE from {$CONFIG->dbprefix}annotations where id=$id and $access");
        }
 
-       return false;
+       return FALSE;
 }
 
 /**
@@ -1255,4 +1256,4 @@ function register_annotation_url_handler($function_name, $extender_name = "all")
 }
 
 /** Register the hook */
-register_plugin_hook("export", "all", "export_annotation_plugin_hook", 2);
\ No newline at end of file
+register_plugin_hook("export", "all", "export_annotation_plugin_hook", 2);
index 09a6b0cc743eb52c57298590011b5a8656de6a21..02a2a0732ecc527c21d26253f58cc07266c79d0c 100644 (file)
@@ -95,6 +95,23 @@ function remove_from_river_by_object($object_guid) {
        return delete_data("delete from {$CONFIG->dbprefix}river where object_guid = {$object_guid}");
 }
 
+/**
+ * Removes all items relating to a particular annotation being acted upon from the river
+ *
+ * @param int annotation_id The ID of the annotation
+ * @return true|false Depending on success
+ */
+function remove_from_river_by_annotation($annotation_id) {
+       // Sanitise
+       $annotation_id = (int) $annotation_id;
+
+       // Load config
+       global $CONFIG;
+
+       // Remove
+       return delete_data("delete from {$CONFIG->dbprefix}river where annotation_id = {$annotation_id}");
+}
+
 /**
  * Sets the access ID on river items for a particular object
  *
@@ -287,4 +304,4 @@ function elgg_view_river_items($subject_guid = 0, $object_guid = 0, $subject_rel
        }
 
        return '';
-}
\ No newline at end of file
+}