New CFG->zip and CFG->unzip valiables which specify programs to use

when zipping and unzipping files.  Unix only at this stage. (Zip interfaces
for Windows are much less standardised)
This commit is contained in:
martin 2002-08-18 15:26:04 +00:00
parent 0a260c54f8
commit 8ce53f0f85
2 changed files with 21 additions and 4 deletions

View File

@ -93,6 +93,13 @@ $CFG->gdversion = 1;
$CFG->longtimenosee = 100;
// These programs are used by the file management code to zip and unzip
// uploaded files. This only works on Unix systems right now.
$CFG->zip = "/usr/bin/zip";
$CFG->unzip = "/usr/bin/unzip";
// You should not need to change anything else. To continue setting up
// Moodle, use your web browser to go to the moodle/admin web page.
///////////////////////////////////////////////////////////////////////////

View File

@ -21,6 +21,14 @@
error("Only teachers can edit files");
}
if (!$CFG->zip) {
$CFG->zip = "/usr/bin/zip";
}
if (!$CFG->unzip) {
$CFG->unzip = "/usr/bin/unzip";
}
function html_footer() {
global $course;
echo "</td></tr></table></body></html>";
@ -29,9 +37,11 @@
function html_header($formfield=""){
global $course;
$strfiles = get_string("files");
print_header("$course->shortname: Files", "$course->shortname: Files",
"<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> -> Files", $formfield);
print_header("$course->shortname: $strfiles", "$course->fullname",
"<A HREF=\"../course/view.php?id=$course->id\">$course->shortname</A> -> $strfiles", $formfield);
echo "<table border=0 align=center cellspacing=3 cellpadding=3 width=640>";
echo "<tr>";
echo "<td colspan=\"2\">";
@ -293,7 +303,7 @@
$files .= basename($file);
$files .= " ";
}
$command = "cd $basedir/$wdir ; /usr/bin/zip -r $name $files";
$command = "cd $basedir/$wdir ; $CFG->zip -r $name $files";
Exec($command);
clearfilelist();
displaydir($wdir);
@ -338,7 +348,7 @@
print_simple_box_start("center");
echo "<PRE>";
$file = basename($file);
$command = "cd $basedir/$wdir ; /usr/bin/unzip -o $file 2>&1";
$command = "cd $basedir/$wdir ; $CFG->unzip -o $file 2>&1";
passthru($command);
echo "</PRE>";
print_simple_box_end();