aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-07-01 11:43:16 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-07-01 11:43:16 +0000
commite7439554222b46912702ad6041b2767c9411770b (patch)
tree18878c99c36bb00e7b03ff4f8a01985eef9f4d39 /engine/lib
parent7b11e8a255ca690c4842c760123662a2afb788f2 (diff)
downloadelgg-e7439554222b46912702ad6041b2767c9411770b.tar.gz
elgg-e7439554222b46912702ad6041b2767c9411770b.tar.bz2
Metadata delete now passing correct object, also handles missing metadata entity.
git-svn-id: https://code.elgg.org/elgg/trunk@3372 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/metadata.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 79a5faacf..063188a47 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -355,15 +355,17 @@
$id = (int)$id;
$metadata = get_metadata($id);
-
- // Tidy up if memcache is enabled.
- static $metabyname_memcache;
- if ((!$metabyname_memcache) && (is_memcache_available()))
- $metabyname_memcache = new ElggMemcache('metabyname_memcache');
- if ($metabyname_memcache) $metabyname_memcache->delete("{$metadata->entity_guid}:{$metadata->name_id}");
-
- if (($metadata->canEdit()) && (trigger_elgg_event('delete', 'metadata', $obj)))
- return delete_data("DELETE from {$CONFIG->dbprefix}metadata where id=$id");
+
+ if ($metadata) {
+ // Tidy up if memcache is enabled.
+ static $metabyname_memcache;
+ if ((!$metabyname_memcache) && (is_memcache_available()))
+ $metabyname_memcache = new ElggMemcache('metabyname_memcache');
+ if ($metabyname_memcache) $metabyname_memcache->delete("{$metadata->entity_guid}:{$metadata->name_id}");
+
+ if (($metadata->canEdit()) && (trigger_elgg_event('delete', 'metadata', $metadata)))
+ return delete_data("DELETE from {$CONFIG->dbprefix}metadata where id=$id");
+ }
return false;
}