aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-02-01 23:14:42 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-02-01 23:14:42 +0000
commit222cc0e52f45e31083bdcc3efe6916c62b9d4609 (patch)
tree643c7db88fe312f5421317161fe55babaee99ec2
parent5d7f4aa72a9ef2f09acc426d4a5729698f56da79 (diff)
downloadelgg-222cc0e52f45e31083bdcc3efe6916c62b9d4609.tar.gz
elgg-222cc0e52f45e31083bdcc3efe6916c62b9d4609.tar.bz2
Added error checking to clear_metadata_by_owner().
git-svn-id: http://code.elgg.org/elgg/trunk@3897 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/metadata.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 17835e07e..e867311ae 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -977,10 +977,12 @@ function clear_metadata_by_owner($owner_guid) {
$metas = get_data("SELECT id from {$CONFIG->dbprefix}metadata WHERE owner_guid=$owner_guid");
$deleted = 0;
- foreach ($metas as $id) {
- // Is this the best way?
- if (delete_metadata($id->id)) {
- $deleted++;
+ if (is_array($metas)) {
+ foreach ($metas as $id) {
+ // Is this the best way?
+ if (delete_metadata($id->id)) {
+ $deleted++;
+ }
}
}