當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PhocaGalleryFile::deleteFile方法代碼示例

本文整理匯總了PHP中PhocaGalleryFile::deleteFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP PhocaGalleryFile::deleteFile方法的具體用法?PHP PhocaGalleryFile::deleteFile怎麽用?PHP PhocaGalleryFile::deleteFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PhocaGalleryFile的用法示例。


在下文中一共展示了PhocaGalleryFile::deleteFile方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: delete

 function delete($id = 0)
 {
     // Get all filenames we want to delete from database, we delete all thumbnails from server of this file
     $queryd = 'SELECT filename as filename FROM #__phocagallery WHERE id =' . (int) $id;
     $this->_db->setQuery($queryd);
     $file_object = $this->_db->loadObjectList();
     $query = 'DELETE FROM #__phocagallery' . ' WHERE id =' . (int) $id;
     $this->_db->setQuery($query);
     if (!$this->_db->query()) {
         $this->setError('Database Error 2');
         return false;
     }
     // Delete thumbnails - medium and large, small from server
     // All id we want to delete - gel all filenames
     foreach ($file_object as $key => $value) {
         //The file can be stored in other category - don't delete it from server because other category use it
         $querys = "SELECT id as id FROM #__phocagallery WHERE filename='" . $value->filename . "' ";
         $this->_db->setQuery($queryd);
         $same_file_object = $this->_db->loadObject();
         //same file in other category doesn't exist - we can delete it
         if (!$same_file_object) {
             //Delete all thumbnail files but not original
             PhocaGalleryFileThumbnail::deleteFileThumbnail($value->filename, 1, 1, 1);
             PhocaGalleryFile::deleteFile($value->filename);
         }
     }
     return true;
 }
開發者ID:optimosolution,項目名稱:marhk,代碼行數:28,代碼來源:category.php


注:本文中的PhocaGalleryFile::deleteFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。