mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Solved one problem when copying empty directories.
This commit is contained in:
parent
bbc69d99c1
commit
41923e7511
@ -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 = "";
|
||||
|
@ -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)) {
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user