Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

delete_dir_contents function now allows excluding a dir

  • Loading branch information...
commit 35ea159433eb57c78d9346bee8aa44510491a04b 1 parent 642ac84
stronk7 authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 backup/lib.php
View
7 backup/lib.php
@@ -92,8 +92,9 @@ function check_and_create_backup_dir($backup_unique_code) {
}
//Function to delete all the directory contents recursively
+ //it supports a excluded dit too
//Copied from the web !!
- function delete_dir_contents ($dir) {
+ function delete_dir_contents ($dir,$excludeddir="") {
$slash = "/";
@@ -111,10 +112,10 @@ function delete_dir_contents ($dir) {
// Loop through all directory entries, and construct two temporary arrays containing files and sub directories
while($entry = readdir($handle)) {
- if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != ".") {
+ if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != "." && $entry != $excludeddir) {
$dir_subdirs[] = $dir. $slash .$entry;
}
- else if ($entry != ".." && $entry != ".") {
+ else if ($entry != ".." && $entry != "." && $entry != $excludeddir) {
$dir_files[] = $dir. $slash .$entry;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.