当前位置: 首页>>代码示例>>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;未经允许,请勿转载。