diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/metadata.php | 20 |
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;
}
|