Skip to content
Browse files

Solved one problem when copying empty directories.

  • Loading branch information...
1 parent bbc69d9 commit 41923e7511c437f423ee8c4899ec2ccabd59e6d2 stronk7 committed
Showing with 17 additions and 7 deletions.
  1. +8 −3 backup/backuplib.php
  2. +1 −1 backup/lib.php
  3. +3 −3 backup/restore_execute.html
  4. +5 −0 backup/restorelib.php
View
11 backup/backuplib.php
@@ -929,19 +929,24 @@ function backup_zip ($preferences) {
$files = array();
foreach ($filelist as $file) {
//If directory, append "/"
- if (is_dir($basedir."/".$file)) {
- $file = $file."/";
- }
+ //if (is_dir($basedir."/".$file)) {
+ // $file = $file."/";
+ //}
//Include into array
//echo "<br>Adding file/dir ".$file; //Debug
$files[] = $basedir."/".$file;
}
include_once("$CFG->dirroot/lib/pclzip/pclzip.lib.php");
+ include_once("$CFG->dirroot/lib/pclzip/pclerror.lib.php");
+ include_once("$CFG->dirroot/lib/pclzip/pcltrace.lib.php");
+ PclTraceOn(2);
$archive = new PclZip("$basedir/$name");
if (($list = $archive->create($files,PCLZIP_OPT_REMOVE_PATH,$basedir)) == 0) {
error($archive->errorInfo(true));
$status = false;
}
+ PclTraceDisplay();
+ PclTraceOff();
} else { // Use external zip program
//echo "<br>Using external zip"; //Debug
$files = "";
View
2 backup/lib.php
@@ -272,7 +272,7 @@ function backup_copy_dir($from_file,$to_file) {
if (!is_dir($to_file)) {
//echo "<br>Creating ".$to_file; //Debug
- mkdir($to_file,$CFG->directorypermissions);
+ $status = mkdir($to_file,$CFG->directorypermissions);
}
$dir = opendir($from_file);
while ($file=readdir($dir)) {
View
6 backup/restore_execute.html
@@ -276,9 +276,9 @@
//Cleanup temps (files and db)
if ($status) {
echo "<li>".get_string("cleaningtempdata");
- if (!$status = clean_temp_data ($restore)) {
- notify("Could not clean up temporary data from files and database");
- }
+ //if (!$status = clean_temp_data ($restore)) {
+ // notify("Could not clean up temporary data from files and database");
+ //}
}
//End the main ul
View
5 backup/restorelib.php
@@ -11,10 +11,15 @@ function restore_unzip ($file) {
if (empty($CFG->unzip)) { // Use built-in php-based unzip function
include_once("$CFG->dirroot/lib/pclzip/pclzip.lib.php");
+ include_once("$CFG->dirroot/lib/pclzip/pclerror.lib.php");
+ include_once("$CFG->dirroot/lib/pclzip/pcltrace.lib.php");
+ PclTraceOn(2);
$archive = new PclZip($file);
if (!$list = $archive->extract(dirname($file))) {
$status = false;
}
+ PclTraceDisplay();
+ PclTraceOff();
} else { // Use external unzip program
$command = "cd ".dirname($file)."; $CFG->unzip -o ".basename($file);
Exec($command);

0 comments on commit 41923e7

Please sign in to comment.
Something went wrong with that request. Please try again.