/** * Begin exporting definitions from the symbols object specified on constructor. */ public function Start() { if (!$this->definitions_path) { throw new \Exception(t("Your are trying to export definitions without setting a path first.")); } elseif (!file_exists($this->definitions_path)) { FileSystem::MakeDir($this->definitions_path, 0755, true); } $this->definitions_path = rtrim($this->definitions_path, "\\/") . "/"; $this->SendMessage(sprintf(t("Starting export of definitions to %s format."), $this->export_type)); if ($this->export_type == Type::JSON) { $this->SaveToJSON($this->definitions_path); } else { $this->SaveToPHP($this->definitions_path); } $this->SendMessage(t("Export completed.")); }
/** * Adds or updates a generic file if neccessary. * @param string $file_name Original name of header. * @param string $content * @param string $subdir */ public function AddGenericFile($file_name, &$content, $subdir = "") { if ($subdir) { $subdir = trim($subdir, "\\/") . "/"; if (!file_exists($this->output_path . $subdir)) { \Peg\Lib\Utilities\FileSystem::MakeDir($this->output_path . $subdir, 0755, true); } } $output_file = $this->output_path . $subdir . $file_name; \Peg\Lib\Utilities\FileSystem::WriteFileIfDifferent($output_file, $content); }