本文整理汇总了PHP中rmdir_r函数的典型用法代码示例。如果您正苦于以下问题:PHP rmdir_r函数的具体用法?PHP rmdir_r怎么用?PHP rmdir_r使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rmdir_r函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: rmdir_r
function rmdir_r($path)
{
if (!is_dir($path)) {
return false;
}
if (!preg_match("/\\/\$/", $path)) {
$path .= '/';
}
$dh = opendir($path);
while (($file = readdir($dh)) !== false) {
if ($file == '.' || $file == '..') {
continue;
}
if (is_dir($path . $file)) {
rmdir_r($path . $file);
} else {
if (is_file($path . $file)) {
unlink($path . $file);
}
}
}
closedir($dh);
rmdir($path);
return true;
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:25,代码来源:nivoslider4wp.php
示例2: plug_erase
function plug_erase($del, $dir)
{
//$del='';
//$dir='';
if ($_SESSION['auth'] < 6) {
return 'no';
}
echo $del . '-' . $dir . '-';
if ($del) {
unlink($del);
} elseif ($dir && strpos($dir, '/') != false) {
rmdir_r($dir);
}
//$func='rmdir_r';
//$r=explore($dir); explode_dir($r,$dir,$func?$func:"removef"); p($r);
//walk_dir($dir,"removef");
//rmdir($dir);
//chmod($dir,0777);
if ($del) {
return $del;
}
if ($dir) {
return $dir;
}
return lkc('', '/plug/erase.php?del=', 'del file');
}
开发者ID:philum,项目名称:cms,代码行数:26,代码来源:erase.php
示例3: ifrgz
function ifrgz($dr)
{
$r = explore($dr);
$f = 'users/public/ifr' . date('ymd') . '.tar';
if (!is_file($f)) {
$ret = plugin('tar', $f, $dr);
}
rmdir_r($dr);
return $ret;
}
开发者ID:philum,项目名称:cms,代码行数:10,代码来源:ifrm.php
示例4: rmdir_r
function rmdir_r($dir, $DeleteMe = TRUE)
{
if (!($dh = @opendir($dir))) {
return;
}
while (false !== ($obj = readdir($dh))) {
if ($obj == '.' || $obj == '..') {
continue;
}
if (!@unlink($dir . '/' . $obj)) {
rmdir_r($dir . '/' . $obj, true);
}
}
closedir($dh);
if ($DeleteMe) {
@rmdir($dir);
}
}
开发者ID:CHILMEX,项目名称:amocasion,代码行数:18,代码来源:index.php
示例5: delj
function delj($p, $o, $res)
{
$f = ajxg($res);
if (!auth(7)) {
return 'no';
}
if ($p == 'file') {
if (is_file($f)) {
unlink($f);
} else {
return 'error';
}
}
if ($p == 'dir' && $f && strpos($f, '/') != false) {
echo $f;
if (is_dir($f)) {
rmdir_r($f);
} else {
return 'error';
}
}
return btn('txtyl', $p . ' ' . $f . ': deleted');
}
开发者ID:philum,项目名称:cms,代码行数:23,代码来源:del.php
示例6: db_delete_where
/**
* Delete those users from the database which corresponds to the given condition or to the given ids array
* Note: the delete cascade arrays are handled!
*
* @param string the name of this class
* Note: This is required until min phpversion will be 5.3. Since PHP 5.3 we can use static::function_name to achieve late static bindings
* @param string where condition
* @param array object ids
* @return mixed # of rows affected or false if error
*/
static function db_delete_where($class_name, $sql_where, $object_ids = NULL, $params = NULL)
{
global $DB;
$DB->begin();
if (!empty($sql_where)) {
$object_ids = $DB->get_col('SELECT user_ID FROM T_users WHERE ' . $sql_where);
}
if (!$object_ids) {
// There is no user to delete
$DB->commit();
return;
}
// Delete orphan threads per users
$result = delete_orphan_threads($object_ids);
// Remove deleted user(s) from posts where it was as last edit user
$user_ids = implode(',', $object_ids);
$result = $result && $DB->query('UPDATE T_items__item
SET post_lastedit_user_ID = NULL
WHERE post_lastedit_user_ID IN ( ' . $user_ids . ' )') !== false;
$result = $result && $DB->query('UPDATE T_items__version
SET iver_edit_user_ID = NULL
WHERE iver_edit_user_ID IN ( ' . $user_ids . ' )') !== false;
// Remove this user from links where it was as last edit user
$result = $result && $DB->query('UPDATE T_links
SET link_lastedit_user_ID = NULL
WHERE link_lastedit_user_ID IN ( ' . $user_ids . ' )') !== false;
if ($result) {
// Delete the user(s) with all of the cascade objects
$params['use_transaction'] = false;
// no need to start a new transaction
$result = parent::db_delete_where($class_name, $sql_where, $object_ids, $params);
}
if ($result !== false) {
// delete the users' media folders recursively, for all deleted users
$FileRootCache =& get_FileRootCache();
foreach ($object_ids as $user_ID) {
if ($root_directory = $FileRootCache->get_root_dir('user', $user_ID)) {
// Delete the folder only when it is detected:
rmdir_r($root_directory);
}
}
}
$result !== false ? $DB->commit() : $DB->rollback();
return $result;
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:55,代码来源:_user.class.php
示例7: pbm_process_messages
/**
* Read messages from server and create posts
*
* @param resource $mbox created by pbm_connect() (by reference)
* @param integer the number of messages to process
* @return boolean true on success
*/
function pbm_process_messages(&$mbox, $limit)
{
global $Settings;
global $pbm_item_files, $pbm_messages, $pbm_items, $post_cntr, $del_cntr, $is_cron_mode;
// No execution time limit
set_max_execution_time(0);
// Are we in test mode?
$test_mode_on = $Settings->get('eblog_test_mode');
$post_cntr = 0;
$del_cntr = 0;
for ($index = 1; $index <= $limit; $index++) {
pbm_msg('<hr /><h3>Processing message #' . $index . ':</h3>');
$strbody = '';
$hasAttachment = false;
$hasRelated = false;
$pbm_item_files = array();
// reset the value for each new Item
// Save email to hard drive, otherwise attachments may take a lot of RAM
if (!($tmpMIME = tempnam(sys_get_temp_dir(), 'b2evoMail'))) {
pbm_msg(T_('Could not create temporary file.'), true);
continue;
}
imap_savebody($mbox, $tmpMIME, $index);
// Create random temp directory for message parts
$tmpDirMIME = pbm_tempdir(sys_get_temp_dir(), 'b2evo_');
$mimeParser = new mime_parser_class();
$mimeParser->mbox = 0;
// Set to 0 for parsing a single message file
$mimeParser->decode_headers = 1;
$mimeParser->ignore_syntax_errors = 1;
$mimeParser->extract_addresses = 0;
$MIMEparameters = array('File' => $tmpMIME, 'SaveBody' => $tmpDirMIME, 'SkipBody' => 1);
if (!$mimeParser->Decode($MIMEparameters, $decodedMIME)) {
pbm_msg(sprintf('MIME message decoding error: %s at position %d.', $mimeParser->error, $mimeParser->error_position), true);
rmdir_r($tmpDirMIME);
unlink($tmpMIME);
continue;
} else {
pbm_msg('MIME message decoding successful');
if (!$mimeParser->Analyze($decodedMIME[0], $parsedMIME)) {
pbm_msg(sprintf('MIME message analyse error: %s', $mimeParser->error), true);
rmdir_r($tmpDirMIME);
unlink($tmpMIME);
continue;
}
// Get message $subject and $post_date from headers (by reference)
if (!pbm_process_header($parsedMIME, $subject, $post_date)) {
// Couldn't process message headers
rmdir_r($tmpDirMIME);
unlink($tmpMIME);
continue;
}
// TODO: handle type == "message" recursively
// sam2kb> For some reason imap_qprint() demages HTML text... needs more testing
if ($parsedMIME['Type'] == 'html') {
// Mail is HTML
if ($Settings->get('eblog_html_enabled')) {
// HTML posting enabled
pbm_msg('HTML message part saved as ' . $parsedMIME['DataFile']);
$html_body = file_get_contents($parsedMIME['DataFile']);
}
foreach ($parsedMIME['Alternative'] as $alternative) {
// First try to get HTML alternative (when possible)
if ($alternative['Type'] == 'html' && $Settings->get('eblog_html_enabled')) {
// HTML text
pbm_msg('HTML alternative message part saved as ' . $alternative['DataFile']);
// sam2kb> TODO: we may need to use $html_body here instead
$strbody = file_get_contents($alternative['DataFile']);
break;
// stop after first alternative
} elseif ($alternative['Type'] == 'text') {
// Plain text
pbm_msg('Text alternative message part saved as ' . $alternative['DataFile']);
$strbody = imap_qprint(file_get_contents($alternative['DataFile']));
break;
// stop after first alternative
}
}
} elseif ($parsedMIME['Type'] == 'text') {
// Mail is plain text
pbm_msg('Plain-text message part saved as ' . $parsedMIME['DataFile']);
$strbody = imap_qprint(file_get_contents($parsedMIME['DataFile']));
}
// Check for attachments
if (!empty($parsedMIME['Attachments'])) {
$hasAttachment = true;
foreach ($parsedMIME['Attachments'] as $file) {
pbm_msg('Attachment: ' . $file['FileName'] . ' stored as ' . $file['DataFile']);
}
}
// Check for inline images
if (!empty($parsedMIME['Related'])) {
$hasRelated = true;
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_post_by_mail.funcs.php
示例8: dre_process_messages
/**
* Read messages from server and save returned emails into DB
*
* @param resource $mbox created by dre_connect() (by reference)
* @param integer the number of messages to process
* @return boolean true on success
*/
function dre_process_messages(&$mbox, $limit)
{
//return; // Exit, in development...
global $Settings;
global $dre_messages, $dre_emails, $email_cntr, $del_cntr, $is_cron_mode;
// No execution time limit
set_max_execution_time(0);
$email_cntr = 0;
$del_cntr = 0;
for ($index = 1; $index <= $limit; $index++) {
dre_msg('<hr /><h3>Processing message #' . $index . ':</h3>');
$strbody = '';
$hasAttachment = false;
$hasRelated = false;
// Save email to hard drive, otherwise attachments may take a lot of RAM
if (!($tmpMIME = tempnam(sys_get_temp_dir(), 'b2evoMail'))) {
dre_msg(T_('Could not create temporary file.'), true);
continue;
}
imap_savebody($mbox, $tmpMIME, $index);
// Create random temp directory for message parts
$tmpDirMIME = dre_tempdir(sys_get_temp_dir(), 'b2evo_');
$mimeParser = new mime_parser_class();
$mimeParser->mbox = 0;
// Set to 0 for parsing a single message file
$mimeParser->decode_headers = 1;
$mimeParser->ignore_syntax_errors = 1;
$mimeParser->extract_addresses = 0;
$MIMEparameters = array('File' => $tmpMIME, 'SaveBody' => $tmpDirMIME, 'SkipBody' => 1);
if (!$mimeParser->Decode($MIMEparameters, $decodedMIME)) {
dre_msg(sprintf('MIME message decoding error: %s at position %d.', $mimeParser->error, $mimeParser->error_position), true);
rmdir_r($tmpDirMIME);
unlink($tmpMIME);
continue;
} else {
dre_msg('MIME message decoding successful');
if (!$mimeParser->Analyze($decodedMIME[0], $parsedMIME)) {
dre_msg(sprintf('MIME message analyse error: %s', $mimeParser->error), true);
rmdir_r($tmpDirMIME);
unlink($tmpMIME);
continue;
}
// Get message $subject and $post_date from headers (by reference)
if (!dre_process_header($parsedMIME, $subject, $post_date)) {
// Couldn't process message headers
rmdir_r($tmpDirMIME);
unlink($tmpMIME);
continue;
}
// TODO: handle type == "message" recursively
// sam2kb> For some reason imap_qprint() demages HTML text... needs more testing
if ($parsedMIME['Type'] == 'html') {
// Mail is HTML
dre_msg('HTML message part saved as ' . $parsedMIME['DataFile']);
$html_body = file_get_contents($parsedMIME['DataFile']);
foreach ($parsedMIME['Alternative'] as $alternative) {
// First try to get HTML alternative (when possible)
if ($alternative['Type'] == 'html') {
// HTML text
dre_msg('HTML alternative message part saved as ' . $alternative['DataFile']);
// sam2kb> TODO: we may need to use $html_body here instead
$strbody = file_get_contents($alternative['DataFile']);
break;
// stop after first alternative
} elseif ($alternative['Type'] == 'text') {
// Plain text
dre_msg('Text alternative message part saved as ' . $alternative['DataFile']);
$strbody = imap_qprint(file_get_contents($alternative['DataFile']));
break;
// stop after first alternative
}
}
} elseif ($parsedMIME['Type'] == 'text') {
// Mail is plain text
dre_msg('Plain-text message part saved as ' . $parsedMIME['DataFile']);
$strbody = imap_qprint(file_get_contents($parsedMIME['DataFile']));
} elseif ($parsedMIME['Type'] == 'delivery-status') {
// Mail is delivery-status
$strbody = '';
foreach ($decodedMIME[0]['Parts'] as $part) {
$strbody .= imap_qprint(file_get_contents($part['BodyFile']));
}
}
if (count($mimeParser->warnings) > 0) {
dre_msg(sprintf('<h4>%d warnings during decode:</h4>', count($mimeParser->warnings)));
foreach ($mimeParser->warnings as $k => $v) {
dre_msg('Warning: ' . $v . ' at position ' . $k);
}
}
}
unlink($tmpMIME);
if (empty($html_body)) {
// Plain text message
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_decode_returned_emails.funcs.php
示例9: CleanUpAfterUpload
public function CleanUpAfterUpload()
{
fwrite($this->logger , "Cleaning up after upload\n");
$dataFolderPath = $this->baseFolderPath.$this->layerName;
unlink($this->zipFile);
rmdir_r($dataFolderPath);
fclose($this->logger);
}
开发者ID:rahool,项目名称:maplocator,代码行数:8,代码来源:loaddata.php
示例10: rmdir_r
function rmdir_r($path)
{
if (is_dir($path)) {
foreach (glob($path . "/*") as $file) {
if ($file != "." && $file != "..") {
if (is_dir($file)) {
rmdir_r($file);
} else {
if (!unlink($file)) {
return FALSE;
}
}
}
}
if (rmdir($path)) {
return TRUE;
}
}
return FALSE;
}
开发者ID:rakeshmani123,项目名称:zendto,代码行数:20,代码来源:NSSUtils.php
示例11: rmdir_r
/**
* rmdir_r - Remove a directory and all it's contents.
*
* @param mixed $dir
*/
function rmdir_r($dir)
{
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {
is_dir("{$dir}/{$file}") ? rmdir_r("{$dir}/{$file}") : unlink("{$dir}/{$file}");
}
return rmdir($dir);
}
开发者ID:endel,项目名称:hook,代码行数:13,代码来源:helpers.php
示例12: dbdelete
/**
* Delete user and dependencies from database
*
* Includes WAY TOO MANY requests because we try to be compatible with MySQL 3.23, bleh!
*
* @param Log Log object where output gets added (by reference).
*/
function dbdelete(&$Log)
{
global $DB, $Plugins;
if ($this->ID == 0) {
debug_die('Non persistant object cannot be deleted!');
}
$deltype = param('deltype', 'string', '');
// spammer
$DB->begin();
if ($deltype == 'spammer') {
// If we delete user as spammer we should delete private messaged of this user
$this->delete_messages();
} else {
// If we delete user as not spammer we keep his comments as from anonymous user
// Transform registered user comments to unregistered:
$ret = $DB->query('UPDATE T_comments
SET comment_author_ID = NULL,
comment_author = ' . $DB->quote($this->get('preferredname')) . ',
comment_author_email = ' . $DB->quote($this->get('email')) . ',
comment_author_url = ' . $DB->quote($this->get('url')) . '
WHERE comment_author_ID = ' . $this->ID);
if (is_a($Log, 'log')) {
$Log->add('Transforming user\'s comments to unregistered comments... ' . sprintf('(%d rows)', $ret), 'note');
}
}
// Get list of posts that are going to be deleted (3.23)
$post_list = implode(',', $DB->get_col('
SELECT post_ID
FROM T_items__item
WHERE post_creator_user_ID = ' . $this->ID));
if (!empty($post_list)) {
// Delete comments
$ret = $DB->query("DELETE FROM T_comments\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE comment_post_ID IN ({$post_list})");
if (is_a($Log, 'log')) {
$Log->add(sprintf('Deleted %d comments on user\'s posts.', $ret), 'note');
}
// Delete post extracats
$ret = $DB->query("DELETE FROM T_postcats\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE postcat_post_ID IN ({$post_list})");
if (is_a($Log, 'log')) {
$Log->add(sprintf('Deleted %d extracats of user\'s posts\'.', $ret));
// TODO: geeky wording.
}
// Posts will we auto-deleted by parent method
} else {
// no posts
if (is_a($Log, 'log')) {
$Log->add('No posts to delete.', 'note');
}
}
// Get list of sessions that are going to be deleted
$sessions_SQL = new SQL();
$sessions_SQL->SELECT('sess_ID');
$sessions_SQL->FROM('T_sessions');
$sessions_SQL->WHERE('sess_user_ID = ' . $this->ID);
$sessions_list = $DB->get_col($sessions_SQL->get());
if (!empty($sessions_list)) {
// Delete all hit logs of this user
$DB->query('DELETE FROM T_hitlog
WHERE hit_sess_ID IN ( ' . $DB->quote($sessions_list) . ' )');
}
// delete user involved ophan threads
delete_orphan_threads($this->ID);
// Remove this user from posts where it was as last edit user
$DB->query('UPDATE T_items__item
SET post_lastedit_user_ID = NULL
WHERE post_lastedit_user_ID = ' . $this->ID);
$DB->query('UPDATE T_items__version
SET iver_edit_user_ID = NULL
WHERE iver_edit_user_ID = ' . $this->ID);
// Remove this user from links where it was as last edit user
$DB->query('UPDATE T_links
SET link_lastedit_user_ID = NULL
WHERE link_lastedit_user_ID = ' . $this->ID);
// remember ID, because parent method resets it to 0
$old_ID = $this->ID;
$old_email = $this->get('email');
// Delete main object:
if (!parent::dbdelete()) {
$DB->rollback();
$Log->add('User has not been deleted.', 'error');
return false;
}
// user was deleted, also delete this user's media folder recursively
$FileRootCache =& get_FileRootCache();
$root_directory = $FileRootCache->get_root_dir('user', $old_ID);
rmdir_r($root_directory);
if ($deltype == 'spammer') {
// User was deleted as spammer, we should mark email of this user as 'Spammer'
load_class('tools/model/_emailblocked.class.php', 'EmailBlocked');
$EmailBlockedCache =& get_EmailBlockedCache();
$EmailBlocked =& $EmailBlockedCache->get_by_name($old_email, false, false);
if (!$EmailBlocked) {
// Create new record in the T_email_blocked table
//.........这里部分代码省略.........
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:101,代码来源:_user.class.php
示例13: json_encode
break;
case "chmod_directory":
if ($directory && $_POST['permissions']) {
if (chmod($directory, octdec(0 . $_POST['permissions']))) {
print json_encode(array('success' => true, 'message' => 'Directory chmod\'d successfully'));
} else {
print json_encode(array('success' => false, 'message' => 'Could not chmod ' . $directory));
}
} else {
print json_encode(array('success' => false, 'message' => 'Could not chmod ' . $directory));
}
exit;
break;
case "delete_directory":
if ($_POST['directory'] && $directory != DIRECTORY && stristr($directory, DIRECTORY)) {
if (rmdir_r($directory)) {
print json_encode(array('success' => true, 'message' => 'Directory deleted successfully'));
} else {
print json_encode(array('success' => false, 'message' => 'Could not delete ' . $directory));
}
} else {
print json_encode(array('success' => false, 'message' => 'Could not delete ' . $directory));
}
exit;
break;
case "create_temp_image":
if ($_POST['image']) {
// Create a temp image copy of the image we are trying to edit
$temp_image = str_replace(basename($_POST['image']), '_fm_' . basename($_POST['image']), $_POST['image']);
if (copy(DIRECTORY . $_POST['image'], DIRECTORY . $temp_image)) {
list($width, $height) = getimagesize(DIRECTORY . $temp_image);
开发者ID:emonpc,项目名称:extjsfilemanager,代码行数:31,代码来源:actions.php
示例14: rm_cache
/**
* Delete cache for a file
*/
function rm_cache()
{
global $Messages;
// Remove cached elts for teh current file:
$ads_filecache = $this->get_ads_evocache(false);
if ($ads_filecache[0] == '!') {
// This creates unwanted noise
// $Messages->add( 'Cannot remove .evocache for file. - '.$ads_filecache, 'error' );
} else {
rmdir_r($ads_filecache);
// In case cache is now empty, delete the folder:
$adp_evocache = $this->_dir . '.evocache';
@rmdir($adp_evocache);
}
}
开发者ID:LFSF,项目名称:oras,代码行数:18,代码来源:_file.class.php
示例15: memorize_param
$action = 'start';
break;
// Stop an upgrade from SVN
} else {
// Use only correct revision
$phpsvnclient->setVersion($svn_revision);
}
}
$repository_version = $phpsvnclient->getVersion();
$upgrade_name = 'export_svn_' . $repository_version;
memorize_param('upd_name', 'string', '', $upgrade_name);
$upgrade_folder = $upgrade_path . $upgrade_name;
if ($action == 'force_export_svn' && file_exists($upgrade_folder)) {
// The exported folder already exists
// Try to delete previous package
if (!rmdir_r($upgrade_folder)) {
echo '<p class="red">' . sprintf(T_('Unable to delete previous exported package %s before forcing the export.'), '<b>' . $upgrade_folder . '</b>') . '</p>';
}
evo_flush();
}
if (file_exists($upgrade_folder)) {
// Current version already is downloaded
echo '<p class="green">' . sprintf(T_('Revision %s has already been downloaded. Using: %s'), $repository_version, $upgrade_folder);
$revision_is_exported = true;
} else {
// Download files
echo '<p>' . sprintf(T_('Downloading package to «<strong>%s</strong>»...'), $upgrade_folder);
evo_flush();
// Export all files in temp folder for following coping
$svn_result = $phpsvnclient->checkOut($svn_folder, $upgrade_folder, false, true);
echo '</p>';
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:31,代码来源:upgrade.ctrl.php
示例16: rmdir_r
/**
* Deletes a dir recursively, wiping out all subdirectories!!
*
* @param string the dir
*/
function rmdir_r($path)
{
$path = trailing_slash($path);
// echo "<br>rmdir_r($path)";
if ($dir = @opendir($path)) {
while (($file = readdir($dir)) !== false) {
if ($file == '.' || $file == '..') {
continue;
}
$adfp_filepath = $path . $file;
// echo "<br> - $os_filepath ";
if (is_dir($adfp_filepath) && !is_link($adfp_filepath)) {
// Note: we do NOT follow symlinks
// echo 'D';
rmdir_r($adfp_filepath);
} else {
// File or symbolic link
//echo 'F/S';
@unlink($adfp_filepath);
}
}
closedir($dir);
@rmdir($path);
}
}
开发者ID:LFSF,项目名称:oras,代码行数:30,代码来源:_file.funcs.php
示例17: rmdir_r
function rmdir_r($dr)
{
$dir = opendir($dr);
if (!auth(6)) {
return;
}
while ($f = readdir($dir)) {
$drb = $dr . '/' . $f;
if (is_dir($drb) && $f != '..' && $f != '.') {
rmdir_r($drb);
rmdir($drb);
} elseif (is_file($drb)) {
unlink($drb);
echo $drb . br();
}
}
rmdir($dr);
}
开发者ID:philum,项目名称:cms,代码行数:18,代码来源:lib.php
示例18: tarim_copy
function tarim_copy($rc)
{
$dr = 'imgd/';
rmdir_r('imgd');
mkdir_r($dr);
foreach ($rc as $v) {
copy($v, $dr . substr($v, 4));
}
}
开发者ID:philum,项目名称:cms,代码行数:9,代码来源:tarim.php
示例19: cache_delete
/**
* Delete all cache files
*/
function cache_delete()
{
rmdir_r($this->ads_collcache_path);
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:7,代码来源:_pagecache.class.php
示例20: dbm_delete_orphan_file_roots
/**
* Remove orphan file roots ( with no matching Blog or User entry in the database ) recursively with all of the content
*/
function dbm_delete_orphan_file_roots()
{
global $DB, $media_path;
echo T_('Removing orphan file roots recursively with all of their content... ');
evo_flush();
// Store all directories that must be deleted
$delete_dirs = array();
/* BLOGS */
// Get the media diretories of all existing blogs
$BlogCache =& get_BlogCache();
$BlogCache->load_all();
$blog_dirs = array();
foreach ($BlogCache->cache as $Blog) {
$blog_dirs[] = $Blog->get_media_dir();
}
$BlogCache->clear();
$media_path_blogs = $media_path . 'blogs/';
if (($media_dir_blogs = @opendir($media_path_blogs)) === false) {
// Could not open blogs media dir
echo '<p class="red">' . sprintf(T_('Cannot open blogs media directory %s'), '<b>' . $media_path_blogs . '</b>') . '</p>';
} else {
// Find the blog dirs that must be deleted
while (($folder = readdir($media_dir_blogs)) !== false) {
if ($folder == '.' || $folder == '..' || !is_dir($media_path_blogs . $folder)) {
// Skip files
continue;
}
if (!in_array($media_path_blogs . $folder . '/', $blog_dirs)) {
// This dir must be deleted because it is not media dir of the existing blogs
$delete_dirs[] = $media_path_blogs . $folder . '/';
}
}
closedir($media_dir_blogs);
}
/* USERS */
echo '. ';
evo_flush();
// Get logins of all existing users
$SQL = new SQL();
$SQL->SELECT('user_login');
$SQL->FROM('T_users');
$user_logins = $DB->get_col($SQL->get());
$media_path_users = $media_path . 'users/';
if (($media_dir_users = @opendir($media_path_users)) === false) {
// Could not open users media dir
echo '<p class="red">' . sprintf(T_('Cannot open users media directory %s'), '<b>' . $media_path_users . '</b>') . '</p>';
} else {
// Find the user dirs that must be deleted
while (($folder = readdir($media_dir_users)) !== false) {
if ($folder == '.' || $folder == '..' || !is_dir($media_path_users . $folder)) {
// Skip files
continue;
}
if (!in_array($folder, $user_logins)) {
// This dir must be deleted because it is not media dir of the existing users
$delete_dirs[] = $media_path_users . $folder . '/';
}
}
closedir($media_dir_users);
}
/* DELETE broken file roots */
echo '. ';
evo_flush();
foreach ($delete_dirs as $delete_dir) {
if (rmdir_r($delete_dir)) {
// Success deleting
echo '<p class="green">' . sprintf(T_('Invalid file root %s was found and removed with all of its content.'), '<b>' . $delete_dir . '</b>') . '</p>';
} else {
// Failed deleting
echo '<p class="red">' . sprintf(T_('Cannot delete directory %s. Please check the permissions or delete it manually.'), '<b>' . $delete_dir . '</b>') . '</p>';
}
}
/* DELETE orphan DB file records of the blogs and the users */
echo '. ';
evo_flush();
$count_files_deleted = $DB->query('DELETE f, l, lv FROM T_files AS f
LEFT JOIN T_links AS l ON l.link_file_ID = f.file_ID
LEFT JOIN T_links__vote AS lv ON l.link_ID = lv.lvot_link_ID
WHERE ( file_root_type = "collection"
AND file_root_ID NOT IN ( SELECT blog_ID FROM T_blogs ) )
OR ( file_root_type = "user"
AND file_root_ID NOT IN ( SELECT user_ID FROM T_users ) )');
echo 'OK.<p>';
echo sprintf(T_('%d File roots have been removed from the disk.'), count($delete_dirs)) . '<br />';
echo sprintf(T_('%d File objects have been deleted from DB.'), intval($count_files_deleted)) . '</p>';
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:89,代码来源:_dbmaintenance.funcs.php
注:本文中的rmdir_r函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论