/** * Set chache core * @param Cache_Interface $manager */ public static function setCache(Cache_Interface $manager) { self::$_cache = $manager; }
/** * Create new report */ public function fsmakefileAction() { $this->_checkCanEdit(); $name = Request::post('name', 'string', ''); $path = Request::post('path', 'string', ''); $name = str_replace(array(DIRECTORY_SEPARATOR), '', $name); if (!strlen($name)) { Response::jsonError($this->_lang->WRONG_REQUEST . ' [code 1]'); } $newPath = $this->_configMain->get('report_configs'); if (strlen($path)) { $filepath = $newPath . $path . DIRECTORY_SEPARATOR . $name . '.report.dat'; } else { $filepath = $newPath . $name . '.report.dat'; } if (file_exists($filepath)) { Response::jsonError($this->_lang->FILE_EXISTS); } $obj = new Db_Query(); $storage = Db_Query_Storage::getInstance('file'); if ($storage->save($filepath, $obj)) { Response::jsonSuccess(array('file' => DIRECTORY_SEPARATOR . str_replace($newPath, '', $filepath))); } else { Response::jsonError($this->_lang->CANT_WRITE_FS); } }