diff options
author | Cash Costello <cash.costello@gmail.com> | 2010-10-23 12:53:41 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2010-10-23 12:53:41 +0000 |
commit | cee2276dc0bd37f7981e885f9dd32cd0e113c1cc (patch) | |
tree | 011d6c966680d2c7b03f03f3d2e90f6ea12eb555 /actions | |
parent | e8fafaca927a17a6badad86e9a0c6ad4c911b8f1 (diff) | |
download | elgg-cee2276dc0bd37f7981e885f9dd32cd0e113c1cc.tar.gz elgg-cee2276dc0bd37f7981e885f9dd32cd0e113c1cc.tar.bz2 |
updating album image list when a photo is deleted
Diffstat (limited to 'actions')
-rw-r--r-- | actions/admin/upgrade.php | 2 | ||||
-rw-r--r-- | actions/delete.php | 21 |
2 files changed, 13 insertions, 10 deletions
diff --git a/actions/admin/upgrade.php b/actions/admin/upgrade.php index 9c4aef1cf..334e9588e 100644 --- a/actions/admin/upgrade.php +++ b/actions/admin/upgrade.php @@ -11,6 +11,8 @@ if ($version <= $local_version) { forward($_SERVER['HTTP_REFERER']); } +set_time_limit(0); + $base_dir = $CONFIG->pluginspath . 'tidypics/upgrades'; // taken from engine/lib/version.php diff --git a/actions/delete.php b/actions/delete.php index c1e0ed59e..9b8c6ac6f 100644 --- a/actions/delete.php +++ b/actions/delete.php @@ -53,7 +53,7 @@ $image_repo_size_md = get_metadata_byname($owner_guid, "image_repo_size"); $image_repo_size = (int)$image_repo_size_md->value; //loop through all images and delete them -foreach($images as $im) { +foreach ($images as $im) { $thumbnail = $im->thumbnail; $smallthumb = $im->smallthumb; $largethumb = $im->largethumb; @@ -76,16 +76,17 @@ foreach($images as $im) { $delfile->setFilename($largethumb); $delfile->delete(); } - if ($im) { //delete actual image file - $delfile = new ElggFile($im->getGUID()); - $delfile->owner_guid = $im->getOwner(); - //$delfile->setFilename($im->originalfilename); - $image_repo_size -= $delfile->size(); + if ($im) { + $image_repo_size -= $im->size(); - if (!$delfile->delete()) { - if ($subtype=='image') register_error(elgg_echo("tidypics:deletefailed")); //unable to delete object + if (!$im->delete()) { + if ($subtype=='image') { + register_error(elgg_echo("tidypics:deletefailed")); //unable to delete object + } } else { - if ($subtype=='image') system_message(elgg_echo("tidypics:deleted")); //successfully deleted object + if ($subtype=='image') { + system_message(elgg_echo("tidypics:deleted")); //successfully deleted object + } } } //end delete actual image file } //end looping through each image to delete it @@ -107,7 +108,7 @@ if ($subtype == 'album') { rmdir($albumdir); } - //delete object from database + //delete album object from database if (!$entity->delete()) { register_error(elgg_echo("tidypics:deletefailed")); //unable to delete object } else { |