本文整理匯總了PHP中FileHelper::deleteDir方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileHelper::deleteDir方法的具體用法?PHP FileHelper::deleteDir怎麽用?PHP FileHelper::deleteDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FileHelper
的用法示例。
在下文中一共展示了FileHelper::deleteDir方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Database
$database = new Database(HOST, DBNAME, DBUSER, DBPASS);
// Posted data
$posted_date = date('Y-m-d H:i:s');
// Insert into database
$varObject->description = str_replace("'", "\\'", $varObject->description);
$create_package_record = array('uid' => $_SESSION['uid'], 'midparent' => $varObject->midparent, 'm_name' => $varObject->name, 'm_file_name' => $varObject->filename, 'version' => $varObject->version, 'jversion' => $varObject->jversion, 'brversion' => $varObject->brversion, 'description' => $varObject->description, 'license' => $varObject->license, 'copyright' => $varObject->copyright, 'author' => $varObject->author, 'author_email' => $varObject->author_email, 'author_url' => $varObject->author_url, 'date_created' => $posted_date, 'filesize' => $bytes, 'lines_created' => $totallinescalculated, 'files_created' => $filecreatedcount, 'minutes_saved' => $totaltimesaved, 'download_count' => 1);
$mid = $database->insert('br_modules', $create_package_record);
$filesize = FileHelper::formatBytes($bytes);
// Move to user folder from tmp
$userfolder = $folderusersmodules . $mid . DS;
FileHelper::foldercheck($userfolder);
FileHelper::createfile($userfolder . $indexfile, $indexlines);
FileHelper::copyToLocation($folderusersmodulestmp . $packagename, $userfolder . $packagename);
$filecreatedpath = BASE_URL . 'users' . DS . $_SESSION['uid'] . DS . 'modules' . DS . $mid . DS . $packagename;
// Clean up tmp folder now that zip has been created
FileHelper::deleteDir($folderusersmodulestmp);
// account for hours in display..
if ($totaltimesaved > 60) {
}
// Set permissions of paths
chmod($folderusersmodules, 0777);
chmod($userfolder, 0777);
// Call header
$pageTitle = 'Module Created | Free | Joomla 2.5 & Joomla 3.0';
$pageActive = 'modules';
$pageActiveBreadcrumb = '<li class="active">Module Created</li>';
include 'template/header.php';
?>
<div id="section-container">
<div class="container">
<div class="row">
示例2: deleteDir
function deleteDir($dir)
{
if (substr($dir, strlen($dir) - 1, 1) != '/') {
$dir .= '/';
}
if ($handle = opendir($dir)) {
while ($obj = readdir($handle)) {
if ($obj != '.' && $obj != '..') {
if (is_dir($dir . $obj)) {
if (!FileHelper::deleteDir($dir . $obj)) {
return false;
}
} elseif (is_file($dir . $obj)) {
if (!unlink($dir . $obj)) {
return false;
}
}
}
}
closedir($handle);
if (!@rmdir($dir)) {
return false;
}
return true;
}
return false;
}
示例3: while
// Check to make sure it is a directory
if (is_dir($dir)) {
// Can we open the directory?
if ($dh = opendir($dir)) {
// Filter through the directory
while (($file = readdir($dh)) !== false) {
// Get type of file
$typedir = filetype($dir . $file);
// Check the type is a folder (directory)
if ($typedir == 'dir' && $file != '.' && $file != '..') {
$foldertocheck = explode('-', $file);
$daycreated = $foldertocheck[0];
// Is the folder a day old or more? Then delete it off the server
if (strtotime($daycreated) < strtotime('-1 days')) {
$dirpath = $dir . $file;
FileHelper::deleteDir($dirpath);
}
}
}
closedir($dh);
}
}
/*
* Create Task
*/
if ($task == 'create') {
/*
* Check to make sure there are fields filled out, if not redirect with message.
*/
if (empty($post['componentname'])) {
header('location:index.php?msg=1');
示例4: executeDelfolder
function executeDelfolder()
{
global $controller, $DocumentDir, $ClassDir, $i18n, $AddIP, $userid, $group_ids, $logger, $user_name;
require_once $ClassDir . "FileHelper.class.php";
$apf_folders = DB_DataObject::factory('ApfFolders');
$apf_folders->get($apf_folders->escape($controller->getID()));
$apf_folders->find();
$apf_folders->fetch();
$foldername = $apf_folders->getDirpath();
$real_folder_path = $DocumentDir . $foldername;
$this->delFolderAndFileByFID($controller->getID());
$apf_folders->delete();
$apf_files = DB_DataObject::factory('ApfFiles');
$apf_files->setParent($apf_folders->escape($controller->getID()));
$apf_files->find();
while ($apf_files->fetch()) {
$filename = $apf_files->getFilename();
$apf_files->delete();
$log_string = $i18n->_("Delete") . $i18n->_("File") . "\t{$foldername}";
logFileString($log_string);
}
FileHelper::deleteDir($real_folder_path);
$log_string = $i18n->_("Delete") . $i18n->_("Folder") . "\t{$foldername}";
logFileString($log_string);
$this->forward("document/apf_folders/list/" . $apf_folders->getParent());
}