本文整理汇总了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;
}