From ce5ce1369f828d54f4036bddfff07277053ce0c1 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 23 Oct 2006 19:26:20 +0000 Subject: [PATCH] Excel export returns a zero bytes file when system temp not writable MDL-7176; merged from MOODLE_17_STABLE --- lib/excellib.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/excellib.class.php b/lib/excellib.class.php index 8f3f81d4ea..5ea429c5e1 100644 --- a/lib/excellib.class.php +++ b/lib/excellib.class.php @@ -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 -- 2.39.5