/** * @param $text * @return string - url to the created file */ private function createFile($text) { $this->fileName = 'site_update_' . HelperFormatted::generateString(5) . '_' . time() . '.json'; $this->dirPath = 'files/site_update/'; $this->filePath = Config::get()->basePath . '/' . $this->dirPath . $this->fileName; //Save file try { $fp = fopen($this->filePath, "w"); fwrite($fp, $text); fclose($fp); $this->fileUrl = Config::get()->url . $this->dirPath . $this->fileName; } catch (Exception $e) { return false; } return true; }