I traced source codes of Spout module. I found Spout used sys_get_temp_dir() php builtin function. Windows system default temp directory
is C:\Windows\temp. PHP process lacked list folder permissions in temp directory, so occurred RecursiveDirectoryIterator executing error.
I fixed this problem by adding some lines in \lib\classes\dataformat\spout_base.php are shown below:
public function send_http_headers() {
$this->writer = \Box\Spout\Writer\WriterFactory::create($this->spouttype);
//======================================================
// added as below
if( $this->spouttype == 'ods' || $this->spouttype == 'xlsx' )
{
global $CFG ;
$this->writer->setTempFolder( $CFG->dataroot.'/temp/dataformat' );
}
// =====================================================
$filename = $this->filename . $this->get_extension();
$this->writer->openToBrowser($filename);
if ($this->sheettitle && $this->writer instanceof \Box\Spout\Writer\AbstractMultiSheetsWriter) {
$sheet = $this->writer->getCurrentSheet();
$sheet->setName($this->sheettitle);
}
}
Re: Feedback Analysis Excel (.xlsx) download Failure Moodle 3.1.1
by Chien Wen-chang -
Number of replies: 0
I reported this bug in https://tracker.moodle.org/browse/MDL-56642