public function testTempDirCustom() { $storage = new Omeka_Storage(); $customDir = '/'; $storage->setTempDir($customDir); $this->assertEquals($customDir, $storage->getTempDir()); }
public function generate() { set_error_handler(array($this, 'errorHandler'), E_WARNING); try { $this->_reportFile->status = Reports_File::STATUS_IN_PROGRESS; $this->_reportFile->save(); $this->_report = $this->_reportFile->getReport(); $this->_params = reports_convert_search_filters(unserialize($this->_report->query)); // Creates a random filename based on the type of report. $filter = new Omeka_Filter_Filename(); $filename = $filter->renameFile('report.' . $this->getExtension()); // Generates the report (passes to subclass) $tempFilePath = tempnam($this->_storage->getTempDir(), 'reports'); $tempFilePath = $this->generateReport($tempFilePath); // Store the report $destPath = $this->_storagePrefixDir . '/' . $filename; $this->_storage->store($tempFilePath, $destPath); $this->_reportFile->status = Reports_File::STATUS_COMPLETED; $this->_reportFile->filename = $filename; } catch (Exception $e) { $this->_reportFile->status = Reports_File::STATUS_ERROR; $this->_addStatusMessage('storagePrefixDir: ' . $this->_storagePrefixDir . ' filename: ' . $filename . ' error:' . $e->getMessage(), 'Error'); _log($e, Zend_Log::ERR); } $this->_reportFile->save(); }