Zip / Unzip doesn't work :(

Re: Zip / Unzip doesn't work :(

by Adam H -
Number of replies: 0

Hey guys

Though I'd post an update in here as this problem is now resolved,, and the solution was different to the mapping of the drives as discussed earlier (Although i'm sure mapping the drives would have worked)..

Copy and pasted from another forum:--

The problem:
We recently moved our Moodle installation onto separate Windows servers.  The MoodleData folder now resides on a separate box to the webserver.  Everything was great until we tried to use any of the ZIP features in Moodle.  Course restore, course backups, SCORM Packages etc... simply would not work.  After spending long days and late evenings trawling through the Moodle libraries and searching the forums I managed to find a fix, courtesy of Kiran Dhaman.
The Fix:
Easy once you know how.
In congif.php, make sure you put 4 backslashes in the UNC path to the MoodleData folder,
For example:
$CFG->dataroot  = '\\\\pathtoserver\moodledata';
 
Now edit lib/moodle.lib
Find this code:
function cleardoubleslashes ($path) {
    return preg_replace('/(\/|\\\){1,}/','/',$path);
}
And replace with this code:
function cleardoubleslashes ($path) {
if (substr($path, 0, 2) == "\\\\" or substr($path, 0, 2) == "//")
return $path;
else
return preg_replace('/(\/|\\\){1,}/','/',$path);


Average of ratings: Useful (2)