本文整理汇总了PHP中FileHandler::removeBlankDir方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::removeBlankDir方法的具体用法?PHP FileHandler::removeBlankDir怎么用?PHP FileHandler::removeBlankDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHandler
的用法示例。
在下文中一共展示了FileHandler::removeBlankDir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteModuleFiles
/**
* @brief 특정 모두의 첨부파일 모두 삭제
**/
function deleteModuleFiles($module_srl)
{
// 전체 첨부파일 목록을 구함
$args->module_srl = $module_srl;
$output = executeQueryArray('file.getModuleFiles', $args);
if (!$output) {
return $output;
}
$files = $output->data;
// DB에서 삭제
$args->module_srl = $module_srl;
$output = executeQuery('file.deleteModuleFiles', $args);
if (!$output->toBool()) {
return $output;
}
// 실제 파일 삭제 (일단 약속에 따라서 한번에 삭제)
FileHandler::removeDir(sprintf("./files/attach/images/%s/", $module_srl));
FileHandler::removeDir(sprintf("./files/attach/binaries/%s/", $module_srl));
// DB에서 구한 파일 목록을 삭제
$path = array();
$cnt = count($files);
for ($i = 0; $i < $cnt; $i++) {
$uploaded_filename = $files[$i]->uploaded_filename;
FileHandler::removeFile($uploaded_filename);
$path_info = pathinfo($uploaded_filename);
if (!in_array($path_info['dirname'], $path)) {
$path[] = $path_info['dirname'];
}
}
// 해당 글의 첨부파일 디렉토리 삭제
for ($i = 0; $i < count($path); $i++) {
FileHandler::removeBlankDir($path[$i]);
}
return $output;
}
示例2: deleteModuleFiles
/**
* Delete the attachment of a particular module
*
* @param int $module_srl Sequence of module to delete files
* @return Object
*/
function deleteModuleFiles($module_srl)
{
// Get a full list of attachments
$args = new stdClass();
$args->module_srl = $module_srl;
$columnList = array('file_srl', 'uploaded_filename');
$output = executeQueryArray('file.getModuleFiles', $args, $columnList);
if (!$output) {
return $output;
}
$files = $output->data;
// Remove from the DB
$args->module_srl = $module_srl;
$output = executeQuery('file.deleteModuleFiles', $args);
if (!$output->toBool()) {
return $output;
}
// Remove the file
FileHandler::removeDir(sprintf("./files/attach/images/%s/", $module_srl));
FileHandler::removeDir(sprintf("./files/attach/binaries/%s/", $module_srl));
// Remove the file list obtained from the DB
$path = array();
$cnt = count($files);
for ($i = 0; $i < $cnt; $i++) {
$uploaded_filename = $files[$i]->uploaded_filename;
FileHandler::removeFile($uploaded_filename);
$path_info = pathinfo($uploaded_filename);
if (!in_array($path_info['dirname'], $path)) {
$path[] = $path_info['dirname'];
}
}
// Remove a file directory of the document
for ($i = 0; $i < count($path); $i++) {
FileHandler::removeBlankDir($path[$i]);
}
return $output;
}
示例3: removeBlankDir
/**
* @brief 지정된 디렉토리에 내용이 없으면 삭제
**/
function removeBlankDir($path)
{
$item_cnt = 0;
$path = FileHandler::getRealPath($path);
if (!is_dir($path)) {
return;
}
$directory = dir($path);
while ($entry = $directory->read()) {
if ($entry == "." || $entry == "..") {
continue;
}
if (is_dir($path . "/" . $entry)) {
$item_cnt = FileHandler::removeBlankDir($path . '/' . $entry);
}
}
$directory->close();
if ($item_cnt < 1) {
@rmdir($path);
}
}
示例4: deleteFiles
/**
* Delete all attachments of a particular document
*
* @param int $upload_target_srl Upload target srl to delete files
* @return Object
**/
function deleteFiles($upload_target_srl)
{
// Get a list of attachements
$oFileModel =& getModel('file');
$columnList = array('uploaded_filename', 'module_srl');
$file_list = $oFileModel->getFiles($upload_target_srl, $columnList);
// Success returned if no attachement exists
if (!is_array($file_list) || !count($file_list)) {
return new Object();
}
// Remove from the DB
$args->upload_target_srl = $upload_target_srl;
$output = executeQuery('file.deleteFiles', $args);
if (!$output->toBool()) {
return $output;
}
// Delete the file
$path = array();
$file_count = count($file_list);
for ($i = 0; $i < $file_count; $i++) {
$uploaded_filename = $file_list[$i]->uploaded_filename;
FileHandler::removeFile($uploaded_filename);
$module_srl = $file_list[$i]->module_srl;
$path_info = pathinfo($uploaded_filename);
if (!in_array($path_info['dirname'], $path)) {
$path[] = $path_info['dirname'];
}
}
// Remove a file directory of the document
for ($i = 0; $i < count($path); $i++) {
FileHandler::removeBlankDir($path[$i]);
}
return $output;
}
示例5: deleteFiles
/**
* @brief 특정 문서의 첨부파일을 모두 삭제
**/
function deleteFiles($upload_target_srl)
{
// 첨부파일 목록을 받음
$oFileModel =& getModel('file');
$file_list = $oFileModel->getFiles($upload_target_srl);
// 첨부파일이 없으면 성공 return
if (!is_array($file_list) || !count($file_list)) {
return new Object();
}
// DB에서 삭제
$args->upload_target_srl = $upload_target_srl;
$output = executeQuery('file.deleteFiles', $args);
if (!$output->toBool()) {
return $output;
}
// 실제 파일 삭제
$path = array();
$file_count = count($file_list);
for ($i = 0; $i < $file_count; $i++) {
$uploaded_filename = $file_list[$i]->uploaded_filename;
FileHandler::removeFile($uploaded_filename);
$module_srl = $file_list[$i]->module_srl;
$path_info = pathinfo($uploaded_filename);
if (!in_array($path_info['dirname'], $path)) {
$path[] = $path_info['dirname'];
}
}
// 해당 글의 첨부파일 디렉토리 삭제
for ($i = 0; $i < count($path); $i++) {
FileHandler::removeBlankDir($path[$i]);
}
return $output;
}