/**
  * Delete the annotation.
  *
  * @return bool
  */
 public function delete()
 {
     $result = _elgg_delete_metastring_based_object_by_id($this->id, 'annotation');
     if ($result) {
         elgg_delete_river(array('annotation_id' => $this->id));
     }
     return $result;
 }
Example #2
0
 /**
  * Delete the metadata
  *
  * @return bool
  */
 public function delete()
 {
     $success = _elgg_delete_metastring_based_object_by_id($this->id, 'metadata');
     if ($success) {
         _elgg_services()->metadataCache->clear($this->entity_guid);
     }
     return $success;
 }
 public function testEnableDisableByID()
 {
     $db_prefix = elgg_get_config('dbprefix');
     $annotation = $this->createAnnotations(1);
     $metadata = $this->createMetadata(1);
     foreach ($this->metastringTypes as $type) {
         $id = ${$type}[0];
         $table = $db_prefix . $this->metastringTables[$type];
         $q = "SELECT * FROM {$table} WHERE id = {$id}";
         $test = get_data($q);
         // disable
         $this->assertEqual($test[0]->enabled, 'yes');
         $this->assertTrue(_elgg_set_metastring_based_object_enabled_by_id($id, 'no', $type));
         $test = get_data($q);
         $this->assertEqual($test[0]->enabled, 'no');
         // enable
         $ashe = access_get_show_hidden_status();
         access_show_hidden_entities(true);
         $this->assertTrue(_elgg_set_metastring_based_object_enabled_by_id($id, 'yes', $type));
         $test = get_data($q);
         $this->assertEqual($test[0]->enabled, 'yes');
         access_show_hidden_entities($ashe);
         $this->assertTrue(_elgg_delete_metastring_based_object_by_id($id, $type));
     }
 }
Example #4
0
 /**
  * Delete the metadata
  *
  * @return bool
  */
 public function delete()
 {
     $success = _elgg_delete_metastring_based_object_by_id($this->id, 'metadata');
     if ($success) {
         // we mark unknown here because this deletes only one value
         // under this name, and there may be others remaining.
         _elgg_get_metadata_cache()->markUnknown($this->entity_guid, $this->name);
     }
     return $success;
 }