]> git.mjollnir.org Git - moodle.git/commitdiff
Excel export returns a zero bytes file when system temp not writable MDL-7176; merged...
authorskodak <skodak>
Mon, 23 Oct 2006 19:26:20 +0000 (19:26 +0000)
committerskodak <skodak>
Mon, 23 Oct 2006 19:26:20 +0000 (19:26 +0000)
lib/excellib.class.php

index 8f3f81d4eafc0e84f5e49788528d42431a9b08b9..5ea429c5e1fcca08abc126c3ee7ffdffe35358bf 100644 (file)
@@ -46,10 +46,14 @@ class MoodleExcelWorkbook {
      * @param string $filename The name of the file
      */
     function MoodleExcelWorkbook($filename) {
+        global $CFG;
     /// Internally, create one PEAR Spreadsheet_Excel_Writer_Workbook class
         $this->pear_excel_workbook = new Spreadsheet_Excel_Writer($filename);
     /// Prepare it to accept UTF-16LE data and to encode it properly
         $this->pear_excel_workbook->setVersion(8);
+    /// Choose our temporary directory, because default system tmp might not be writable - see MDL-7176, found by paulo.matos
+        make_upload_directory('temp/excel', false);
+        $this->pear_excel_workbook->setTempDir($CFG->dataroot.'/temp/excel');
     }
 
     /* Create one Moodle Worksheet