public function delete_uploaddir() { $this->delete_thumbnaildir(); $uploaddir = SlideshowJedoGallery::uploads_slideshowjedogallery_path(); if (file_exists($uploaddir)) { @chmod($uploaddir, 0777); //삭제하려는 폴더의 퍼미션을 777로 재 지정 $directory = dir($uploaddir); while ($entry = $directory->read()) { if ($entry != "." && $entry != "..") { if (is_dir($uploaddir . "/" . $entry)) { //삭제하려는 폴더안에 서브 폴더가 있을경우 재루프 //@chmod($uploaddir."/".$entry,0777);//삭제하려는 폴더의 퍼미션을 777로 재 지정 delete_dir($uploaddir . "/" . $entry); } else { @chmod($uploaddir . "/" . $entry, 0777); //삭제하려는 폴더안에 파일일 경우 파일 퍼미션을 777로 재지정 @UnLink($uploaddir . "/" . $entry); } } } $directory->close(); @rmdir($uploaddir); } return false; }
public function delete($id) { global $wpdb; $datas = $this->select(array('id' => $id)); if (empty($datas)) { throw new Exception(__CLASS__ . " delete[id:" . $id . "] select empty"); } $data = $datas[0]; try { $options = json_decode($data->options); if ($options->type == 'file') { try { $full_file_name = SlideshowJedoGallery::uploads_slideshowjedogallery_path() . $options->image_name; if (is_file($full_file_name)) { unlink($full_file_name); } } catch (Excepton $e1) { } try { $full_thumbnails_name = SlideshowJedoGallery::thumbnails_slideshowjedogallery_path() . $options->image_name; if (is_file($full_thumbnails_name)) { unlink($full_thumbnails_name); } } catch (Excepton $e1) { } } $this->oPlugin->oGallerySlideDBHelper->delete_from_slide($id); $wpdb->delete($this->tableName, array('id' => $id)); } catch (Excepton $e) { throw new Exception(__CLASS__ . " delete[id:" . $id . "]:" + $e->getMessage()); } }