From: martin Date: Sun, 18 Aug 2002 15:26:04 +0000 (+0000) Subject: New CFG->zip and CFG->unzip valiables which specify programs to use X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8ce53f0f85dc8da2a740af7e774410d35c9bbb87;p=moodle.git 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) --- diff --git a/config-dist.php b/config-dist.php index a58b7442d5..87a676a938 100644 --- a/config-dist.php +++ b/config-dist.php @@ -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. /////////////////////////////////////////////////////////////////////////// diff --git a/files/index.php b/files/index.php index 0b6bdbe1cc..07f3cd9a9c 100644 --- a/files/index.php +++ b/files/index.php @@ -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 ""; @@ -29,9 +37,11 @@ function html_header($formfield=""){ global $course; + + $strfiles = get_string("files"); - print_header("$course->shortname: Files", "$course->shortname: Files", - "id\">$course->shortname -> Files", $formfield); + print_header("$course->shortname: $strfiles", "$course->fullname", + "id\">$course->shortname -> $strfiles", $formfield); echo ""; echo ""; echo "
"; @@ -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 "
";
                 $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 "
"; print_simple_box_end();