]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15919 unzipping support
authorskodak <skodak>
Sat, 2 Aug 2008 18:42:38 +0000 (18:42 +0000)
committerskodak <skodak>
Sat, 2 Aug 2008 18:42:38 +0000 (18:42 +0000)
lib/file/file_packer.php

index 3263763ec018738fcb75e648a30614cdec531fb7..a3b90c8f0536498c6ec9d16e2983fb11ff3b3b9b 100644 (file)
@@ -209,7 +209,7 @@ class file_packer {
 
             } else {
                 // large file, would not fit into memory :-(
-                $tmpfile = tempnam($CFG->dataroot.'/temp/unzip');
+                $tmpfile = tempnam($CFG->dataroot.'/temp/unzip', 'largefile');
                 if (!$fp = fopen($tmpfile, 'wb')) {
                     $processed[$name] = 'Can not write temp file'; // TODO: localise
                     continue;
@@ -224,7 +224,7 @@ class file_packer {
                 }
                 fclose($fz);
                 fclose($fp);
-                if (strlen($tmpfile) !== $size) {
+                if (filesize($tmpfile) !== $size) {
                     $processed[$name] = 'Unknown error during zip extraction'; // TODO: localise
                     // something went wrong :-(
                     @unlink($tmpfile);