Solved one problem when copying empty directories.

This commit is contained in:
stronk7 2003-08-23 17:33:34 +00:00
parent bbc69d99c1
commit 41923e7511
4 changed files with 17 additions and 7 deletions

View File

@ -929,19 +929,24 @@
$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 File

@ -272,7 +272,7 @@
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 File

@ -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 File

@ -11,10 +11,15 @@
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);