本文整理汇总了PHP中FileHandler::removeDir方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::removeDir方法的具体用法?PHP FileHandler::removeDir怎么用?PHP FileHandler::removeDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHandler
的用法示例。
在下文中一共展示了FileHandler::removeDir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: deleteMenu
function deleteMenu($menu_srl)
{
// 캐시 파일 삭제
$cache_list = FileHandler::readDir("./files/cache/menu", "", false, true);
if (count($cache_list)) {
foreach ($cache_list as $cache_file) {
$pos = strpos($cache_file, $menu_srl . '_');
if ($pos > 0) {
FileHandler::removeFile($cache_file);
}
}
}
// 이미지 버튼 모두 삭제
$image_path = sprintf('./files/attach/menu_button/%s', $menu_srl);
FileHandler::removeDir($image_path);
$args->menu_srl = $menu_srl;
// 메뉴 메뉴 삭제
$output = executeQuery("menu.deleteMenuItems", $args);
if (!$output->toBool()) {
return $output;
}
// 메뉴 삭제
$output = executeQuery("menu.deleteMenu", $args);
if (!$output->toBool()) {
return $output;
}
return new Object(0, 'success_deleted');
}
示例3: setUp
/**
* Prepare runtime context - tell DB class that current DB is CUBRID
*/
protected function setUp()
{
$this->markTestSkipped();
$oContext =& Context::getInstance();
$db_info->master_db = array('db_type' => 'cubrid', 'db_port' => '33000', 'db_hostname' => '10.0.0.206', 'db_userid' => 'dba', 'db_password' => 'arniarules', 'db_database' => 'xe15QA', 'db_table_prefix' => 'xe_');
$db_info->slave_db = array(array('db_type' => 'cubrid', 'db_port' => '33000', 'db_hostname' => '10.0.0.206', 'db_userid' => 'dba', 'db_password' => 'arniarules', 'db_database' => 'xe15QA', 'db_table_prefix' => 'xe_'));
$oContext->setDbInfo($db_info);
// remove cache dir
FileHandler::removeDir(_XE_PATH_ . 'files/cache');
DB::getParser(true);
}
示例4: procAdminRecompileCacheFile
/**
* Regenerate all cache files
* @return void
*/
function procAdminRecompileCacheFile()
{
// rename cache dir
$temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME'];
FileHandler::rename('./files/cache', $temp_cache_dir);
FileHandler::makeDir('./files/cache');
// remove debug files
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
$oModuleModel = getModel('module');
$module_list = $oModuleModel->getModuleList();
// call recompileCache for each module
foreach ($module_list as $module) {
$oModule = NULL;
$oModule = getClass($module->module);
if (method_exists($oModule, 'recompileCache')) {
$oModule->recompileCache();
}
}
// remove cache
$truncated = array();
$oObjectCacheHandler = CacheHandler::getInstance('object');
$oTemplateCacheHandler = CacheHandler::getInstance('template');
if ($oObjectCacheHandler->isSupport()) {
$truncated[] = $oObjectCacheHandler->truncate();
}
if ($oTemplateCacheHandler->isSupport()) {
$truncated[] = $oTemplateCacheHandler->truncate();
}
if (count($truncated) && in_array(FALSE, $truncated)) {
return new Object(-1, 'msg_self_restart_cache_engine');
}
// remove cache dir
$tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
if ($tmp_cache_list) {
foreach ($tmp_cache_list as $tmp_dir) {
if ($tmp_dir) {
FileHandler::removeDir('./files/' . $tmp_dir);
}
}
}
// remove duplicate indexes (only for CUBRID)
$db_type = Context::getDBType();
if ($db_type == 'cubrid') {
$db = DB::getInstance();
$db->deleteDuplicateIndexes();
}
// check autoinstall packages
$oAutoinstallAdminController = getAdminController('autoinstall');
$oAutoinstallAdminController->checkInstalled();
$this->setMessage('success_updated');
}
示例5: procTranslationAdminDeleteTranslation
function procTranslationAdminDeleteTranslation()
{
$module_srl = Context::get('module_srl');
if (!$module_srl) {
return new Object(-1, 'msg_invalid_request');
}
$obj->module_srl = $module_srl;
$output = executeQuery('translation.deleteProjectsByModule', $obj);
if (!$output->toBool()) {
return $output;
}
$output = executeQuery('translation.deleteFileByModule', $obj);
if (!$output->toBool()) {
return $output;
}
$output = executeQuery('translation.deleteContentByModule', $obj);
if (!$output->toBool()) {
return $output;
}
// delete module folder
$file_folder = './files/translation_files/' . $module_srl;
FileHandler::removeDir($file_folder);
// delete cache folder
$cache_folder = './files/cache/translation/' . $module_srl;
FileHandler::removeDir($cache_folder);
$oModuleController =& getController('module');
$output = $oModuleController->deleteModule($module_srl);
if (!$output->toBool()) {
return $output;
}
$this->add('module', 'translation');
$this->add('page', Context::get('page'));
$this->setMessage('success_deleted');
if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'module_srl', $output->get('module_srl'), 'act', 'dispTranslationAdminContent');
header('location:' . $returnUrl);
return;
}
}
示例6: 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;
}
示例7: procImporterAdminImport
/**
* Migrate data after completing xml file extraction
* @return void
*/
function procImporterAdminImport()
{
// Variable setting
$type = Context::get('type');
$total = Context::get('total');
$cur = Context::get('cur');
$key = Context::get('key');
$user_id = Context::get('user_id');
$target_module = Context::get('target_module');
$guestbook_target_module = Context::get('guestbook_target_module');
$this->unit_count = Context::get('unit_count');
// Check if an index file exists
$index_file = './files/cache/importer/' . $key . '/index';
if (!file_exists($index_file)) {
return new Object(-1, 'msg_invalid_xml_file');
}
switch ($type) {
case 'ttxml':
if (!$target_module) {
return new Object(-1, 'msg_invalid_request');
}
$oModuleModel = getModel('module');
$columnList = array('module_srl', 'module');
$target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList);
$ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php');
if ($ttimporter) {
require_once $ttimporter;
}
$oTT = new ttimport();
$cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module);
break;
case 'message':
$cur = $this->importMessage($key, $cur, $index_file);
break;
case 'member':
$cur = $this->importMember($key, $cur, $index_file);
break;
case 'module':
// Check if the target module exists
if (!$target_module) {
return new Object(-1, 'msg_invalid_request');
}
$cur = $this->importModule($key, $cur, $index_file, $target_module);
break;
}
// Notify that all data completely extracted
$this->add('type', $type);
$this->add('total', $total);
$this->add('cur', $cur);
$this->add('key', $key);
$this->add('target_module', $target_module);
// When completing, success message appears and remove the cache files
if ($total <= $cur) {
$this->setMessage(sprintf(Context::getLang('msg_import_finished'), $cur, $total));
FileHandler::removeDir('./files/cache/importer/' . $key);
} else {
$this->setMessage(sprintf(Context::getLang('msg_importing'), $total, $cur));
}
}
示例8: _removeDir_real
/**
* Remove directory
* @param string $path Path to remove
* @return Object
*/
function _removeDir_real($path)
{
if (substr($path, 0, 2) == "./") {
$path = substr($path, 2);
}
$target_path = FileHandler::getRealPath($path);
FileHandler::removeDir($target_path);
return new Object();
}
示例9: removeDir
/**
* @brief 지정된 디렉토리 이하 모두 파일을 삭제
**/
function removeDir($path)
{
$path = FileHandler::getRealPath($path);
if (!is_dir($path)) {
return;
}
$directory = dir($path);
while ($entry = $directory->read()) {
if ($entry != "." && $entry != "..") {
if (is_dir($path . "/" . $entry)) {
FileHandler::removeDir($path . "/" . $entry);
} else {
@unlink($path . "/" . $entry);
}
}
}
$directory->close();
@rmdir($path);
}
示例10: str_replace
}
$fileOutput = $oFileController->insertFile($file_info, $this->module_srl, $document_srl, 0, true);
$uploaded_filename = $fileOutput->get('uploaded_filename');
$source_filename = $fileOutput->get('source_filename');
$obj->content = str_replace($uploaded_target_path . $source_filename, sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl, 3), $uploaded_filename), $obj->content);
}
$obj->uploaded_count += $file_count;
}
}
$oDocumentController =& getController('document');
$output = $oDocumentController->updateDocument($oDocument, $obj);
if (!$output->toBool()) {
$content = getXmlRpcFailure(1, $output->getMessage());
} else {
$content = getXmlRpcResponse(true);
FileHandler::removeDir($tmp_uploaded_path);
}
printContent($content);
break;
// Delete the post
// Delete the post
case 'blogger.deletePost':
$tmp_val = $params[0]->value->string->body;
$tmp_arr = explode('/', $tmp_val);
$document_srl = array_pop($tmp_arr);
// Get a document
$oDocumentModel =& getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// If the document exists
if (!$oDocument->isExists()) {
$content = getXmlRpcFailure(1, 'not exists');
示例11: initTextyle
function initTextyle($site_srl)
{
$oCounterController =& getController('counter');
$oDocumentController =& getController('document');
$oCommentController =& getController('comment');
$oTagController =& getController('tag');
$oAddonController =& getController('addon');
$oEditorController =& getController('editor');
$oTrackbackController =& getController('trackback');
$oModuleModel =& getModel('module');
$oTextyleModel =& getModel('textyle');
$oMemberModel =& getModel('member');
$site_info = $oModuleModel->getSiteInfo($site_srl);
$module_srl = $site_info->index_module_srl;
$args->site_srl = $site_srl;
$oTextyle = new TextyleInfo($module_srl);
if ($oTextyle->module_srl != $module_srl) {
return new Object(-1, 'msg_invalid_request');
}
$oCounterController->deleteSiteCounterLogs($args->site_srl);
$oAddonController->removeAddonConfig($args->site_srl);
$args->module_srl = $module_srl;
$output = executeQuery('textyle.deleteTextyleFavorites', $args);
$output = executeQuery('textyle.deleteTextyleTags', $args);
$output = executeQuery('textyle.deleteTextyleVoteLogs', $args);
$output = executeQuery('textyle.deleteTextyleMemos', $args);
$output = executeQuery('textyle.deleteTextyleReferer', $args);
$output = executeQuery('textyle.deleteTextyleApis', $args);
$output = executeQuery('textyle.deleteTextyleGuestbook', $args);
$output = executeQuery('textyle.deleteTextyleSupporters', $args);
$output = executeQuery('textyle.deletePublishLogs', $args);
FileHandler::removeFile(sprintf("./files/cache/textyle/textyle_deny/%d.php", $module_srl));
FileHandler::removeDir($oTextyleModel->getTextylePath($module_srl));
// delete document comment tag
$output = $oDocumentController->triggerDeleteModuleDocuments($args);
$output = $oCommentController->triggerDeleteModuleComments($args);
$output = $oTagController->triggerDeleteModuleTags($args);
$output = $oTrackbackController->triggerDeleteModuleTrackbacks($args);
$args->module_srl = $args->module_srl * -1;
$output = $oDocumentController->triggerDeleteModuleDocuments($args);
$output = $oCommentController->triggerDeleteModuleComments($args);
$output = $oTagController->triggerDeleteModuleTags($args);
$args->module_srl = $args->module_srl * -1;
// set category
$obj->module_srl = $module_srl;
$obj->title = Context::getLang('init_category_title');
$oDocumentController->insertCategory($obj);
FileHandler::copyDir($this->module_path . 'skins/' . $this->skin, $oTextyleModel->getTextylePath($module_srl));
$langType = Context::getLangType();
$file = sprintf('%ssample/%s.html', $this->module_path, $langType);
if (!file_exists(FileHandler::getRealPath($file))) {
$file = sprintf('%ssample/ko.html', $this->module_path);
}
$member_info = $oMemberModel->getMemberInfoByEmailAddress($oTextyle->getUserId());
$doc->module_srl = $module_srl;
$doc->title = Context::getLang('sample_title');
$doc->tags = Context::getLang('sample_tags');
$doc->content = FileHandler::readFile($file);
$doc->member_srl = $member_info->member_srl;
$doc->user_id = $member_info->user_id;
$doc->user_name = $member_info->user_name;
$doc->nick_name = $member_info->nick_name;
$doc->email_address = $member_info->email_address;
$doc->homepage = $member_info->homepage;
$output = $oDocumentController->insertDocument($doc, true);
return new Object(1, 'success_textyle_init');
}
示例12: procLayoutAdminUserLayoutExport
/**
* export user layout
* @return void
*/
function procLayoutAdminUserLayoutExport()
{
$layout_srl = Context::get('layout_srl');
if (!$layout_srl) {
return new Object('-1', 'msg_invalid_request');
}
require_once _XE_PATH_ . 'libs/tar.class.php';
$oLayoutModel = getModel('layout');
// Copy files to temp path
$file_path = $oLayoutModel->getUserLayoutPath($layout_srl);
$target_path = $oLayoutModel->getUserLayoutPath(0);
FileHandler::copyDir($file_path, $target_path);
// replace path and ini config
$ini_config = $oLayoutModel->getUserLayoutIniConfig(0);
$file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);
unset($file_list[2]);
foreach ($file_list as $file) {
if (strncasecmp('images', $file, 6) === 0) {
continue;
}
// replace path
$file = $target_path . $file;
$content = FileHandler::readFile($file);
$pattern = '/(http:\\/\\/[^ ]+)?(\\.\\/)?' . str_replace('/', '\\/', str_replace('./', '', $file_path)) . '/';
if (basename($file) == 'faceoff.css' || basename($file) == 'layout.css') {
$content = preg_replace($pattern, '../', $content);
} else {
$content = preg_replace($pattern, './', $content);
}
// replace ini config
foreach ($ini_config as $key => $value) {
$content = str_replace('{$layout_info->faceoff_ini_config[\'' . $key . '\']}', $value, $content);
}
FileHandler::writeFile($file, $content);
}
// make info.xml
$info_file = $target_path . 'conf/info.xml';
FileHandler::copyFile('./modules/layout/faceoff/conf/info.xml', $info_file);
$content = FileHandler::readFile($info_file);
$content = str_replace('type="faceoff"', '', $content);
FileHandler::writeFile($info_file, $content);
$file_list[] = 'conf/info.xml';
// make css file
$css_file = $target_path . 'css/layout.css';
FileHandler::copyFile('./modules/layout/faceoff/css/layout.css', $css_file);
$content = FileHandler::readFile('./modules/layout/tpl/css/widget.css');
FileHandler::writeFile($css_file, "\n" . $content, 'a');
$content = FileHandler::readFile($target_path . 'faceoff.css');
FileHandler::writeFile($css_file, "\n" . $content, 'a');
$content = FileHandler::readFile($target_path . 'layout.css');
FileHandler::writeFile($css_file, "\n" . $content, 'a');
// css load
$content = FileHandler::readFile($target_path . 'layout.html');
$content = "<load target=\"css/layout.css\" />\n" . $content;
FileHandler::writeFile($target_path . 'layout.html', $content);
unset($file_list[3]);
unset($file_list[1]);
$file_list[] = 'css/layout.css';
// Compress the files
$tar = new tar();
$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath(0));
chdir($user_layout_path);
foreach ($file_list as $key => $file) {
$tar->addFile($file);
}
$stream = $tar->toTarStream();
$filename = 'faceoff_' . date('YmdHis') . '.tar';
header("Cache-Control: ");
header("Pragma: ");
header("Content-Type: application/x-compressed");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// header("Content-Length: " .strlen($stream)); ?? why??
header('Content-Disposition: attachment; filename="' . $filename . '"');
header("Content-Transfer-Encoding: binary\n");
echo $stream;
// Close Context and then exit
Context::close();
// delete temp path
FileHandler::removeDir($target_path);
exit;
}
示例13: deleteLayout
function deleteLayout($layout_srl)
{
$oLayoutModel =& getModel('layout');
$path = $oLayoutModel->getUserLayoutPath($layout_srl);
FileHandler::removeDir($path);
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_srl);
if (file_exists($layout_file)) {
FileHandler::removeFile($layout_file);
}
// 레이아웃 삭제
$args->layout_srl = $layout_srl;
$output = executeQuery("layout.deleteLayout", $args);
if (!$output->toBool()) {
return $output;
}
return new Object(0, 'success_deleted');
}
示例14: install
/**
* Install module.
*
* Download file and install module
*
* @return Object
*/
function install()
{
$this->_download();
$file_list = $this->_unPack();
$output = $this->_copyDir($file_list);
if (!$output->toBool()) {
FileHandler::removeDir($this->temp_dir);
return $output;
}
$this->installModule();
FileHandler::removeDir($this->temp_dir);
return new Object();
}
示例15: moveDocumentToTrash
/**
* Move the doc into the trash
* @param object $obj
* @return object
*/
function moveDocumentToTrash($obj)
{
$logged_info = Context::get('logged_info');
$trash_args = new stdClass();
// Get trash_srl if a given trash_srl doesn't exist
if (!$obj->trash_srl) {
$trash_args->trash_srl = getNextSequence();
} else {
$trash_args->trash_srl = $obj->trash_srl;
}
// Get its module_srl which the document belongs to
$oDocumentModel = getModel('document');
$oDocument = $oDocumentModel->getDocument($obj->document_srl);
$oMemberModel = getModel('member');
$member_info = $oMemberModel->getMemberInfoByMemberSrl($oDocument->get('member_srl'));
if ($member_info->is_admin == 'Y' && $logged_info->is_admin != 'Y') {
return new Object(-1, 'msg_admin_document_no_move_to_trash');
}
$trash_args->module_srl = $oDocument->get('module_srl');
$obj->module_srl = $oDocument->get('module_srl');
// Cannot throw data from the trash to the trash
if ($trash_args->module_srl == 0) {
return false;
}
// Data setting
$trash_args->document_srl = $obj->document_srl;
$trash_args->description = $obj->description;
// Insert member's information only if the member is logged-in and not manually registered.
if (Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
$trash_args->member_srl = $logged_info->member_srl;
// user_id, user_name and nick_name already encoded
$trash_args->user_id = htmlspecialchars_decode($logged_info->user_id);
$trash_args->user_name = htmlspecialchars_decode($logged_info->user_name);
$trash_args->nick_name = htmlspecialchars_decode($logged_info->nick_name);
}
// Date setting for updating documents
$document_args = new stdClass();
$document_args->module_srl = 0;
$document_args->document_srl = $obj->document_srl;
// begin transaction
$oDB =& DB::getInstance();
$oDB->begin();
/*$output = executeQuery('document.insertTrash', $trash_args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}*/
// new trash module
require_once _XE_PATH_ . 'modules/trash/model/TrashVO.php';
$oTrashVO = new TrashVO();
$oTrashVO->setTrashSrl(getNextSequence());
$oTrashVO->setTitle($oDocument->variables['title']);
$oTrashVO->setOriginModule('document');
$oTrashVO->setSerializedObject(serialize($oDocument->variables));
$oTrashVO->setDescription($obj->description);
$oTrashAdminController = getAdminController('trash');
$output = $oTrashAdminController->insertTrash($oTrashVO);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
$output = executeQuery('document.deleteDocument', $trash_args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
/*$output = executeQuery('document.updateDocument', $document_args);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}*/
// update category
if ($oDocument->get('category_srl')) {
$this->updateCategoryCount($oDocument->get('module_srl'), $oDocument->get('category_srl'));
}
// remove thumbnails
FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3)));
// Set the attachment to be invalid state
if ($oDocument->hasUploadedFiles()) {
$args = new stdClass();
$args->upload_target_srl = $oDocument->document_srl;
$args->isvalid = 'N';
executeQuery('file.updateFileValid', $args);
}
// Call a trigger (after)
ModuleHandler::triggerCall('document.moveDocumentToTrash', 'after', $obj);
// commit
$oDB->commit();
// Clear cache
Rhymix\Framework\Cache::delete('document_item:' . getNumberingPath($oDocument->document_srl) . $oDocument->document_srl);
return $output;
}