Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.9.3
-
Fix Version/s: None
-
Component/s: Backup
-
Labels:None
-
Environment:Windows with Mooodle Data on different drive to Moodle code
-
Database:MySQL
-
Affected Branches:MOODLE_19_STABLE
Description
Moodle is configured to use external zip program.
Backup runs as are as starting the zip which failes.
Failure reason:
lib/Moodlelib @ 7314 - 7329 builds a command to execute to run the zip. This is a CD command followed by a zip command.
The CD command (if necessary) includes a drive change - eg x:\moodledata
The CD command requires a /D switch to perform the drive change - without the switch it does nothing.
The zip then fails because it does not have the correct current path.
I have changed the code to read -
//Construct the command
$separator = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? ' &' : ' ;';
$command = escapeshellarg($origpath).$separator.
escapeshellarg($CFG->zip).' -r '.
escapeshellarg(cleardoubleslashes("$destpath/$destfilename")).' '.$filestozip;
//All converted to backslashes in WIN
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$command = str_replace('/','\\',$command);
}
$command = ' " cd /D '.$command.' " ';
Exec($command);
This is tested and working on windows , but I do not know if Unix will be happy with the /D option
Sounds ok for me, if that /D switch has sense (note I know nothing about DOS).
Assigning to Petr, our security/zip/lovely expert.
Thanks for the report Roger. Ciao