mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Now backup and restore are using central zip & unzip functions.
Merged from MOODLE_14_STABLE
This commit is contained in:
parent
0e919226b1
commit
17841181b6
2 changed files with 8 additions and 56 deletions
|
@ -5,27 +5,8 @@
|
|||
//It automatically uses pclzip or command line unzip
|
||||
function restore_unzip ($file) {
|
||||
|
||||
global $CFG;
|
||||
return unzip_file($file, '', false);
|
||||
|
||||
$status = true;
|
||||
|
||||
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"); //Debug
|
||||
//include_once("$CFG->dirroot/lib/pclzip/pcltrace.lib.php"); //Debug
|
||||
//PclTraceOn(2); //Debug
|
||||
$archive = new PclZip(cleardoubleslashes($file));
|
||||
if (!$list = $archive->extract(PCLZIP_OPT_PATH, cleardoubleslashes(dirname($file)))) {
|
||||
$status = false;
|
||||
}
|
||||
//PclTraceDisplay(); //Debug
|
||||
//PclTraceOff(); //Debug
|
||||
} else { // Use external unzip program
|
||||
$command = "cd ".dirname($file)."; $CFG->unzip -o ".basename($file);
|
||||
Exec($command);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
//This function checks if moodle.xml seems to be a valid xml file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue