/** * Clean the data files from public_html. * * @access public */ public function clean() { // Get our cast of characters. $data_dir = $this->project->getDataDirPath(); $data_files = \Curator\FileSystem::getDirectoryContents($data_dir); foreach ($data_files as $data_file) { // Gather our facts here. $data_info = pathinfo($data_file); $data_ext = $data_info['extension']; $data_rel = str_replace($this->project->getProjectDirPath() . DS, '', $data_file); // relative from the project dir. $data_media = \Curator\Handler\Factory::getMediaTypeForFileExtension($data_ext); // load the data file. $handler = \Curator\Handler\Factory::getHandlerForMediaType($data_media); $data = $handler->input($data_file); // See if the file specifies a special name, otherwise hack // together something resembling the data's filename. if (isset($data['header']['url'])) { $filename = $data['header']['url']; } else { $filename = pathinfo($data_file, PATHINFO_FILENAME) . '.html'; } $output_path = $this->project->getPublicHtmlDirPath() . DS . $filename; if (file_exists($output_path)) { \Curator\Console::stdout(' Deleting public_html' . DS . $filename); if (!unlink($output_path)) { throw new \Exception('Could not delete: ' . $output_path); } } } }
/** * Returns the projects manifest data. * * @return array The manifest data. * @access public */ public function getManifestData() { if ($this->manifest === null) { $manifest_path = $this->getProjectDirPath() . DS . 'manifest.yml'; $ext = \Curator\Handler\Factory::getMediaTypeForFileExtension(pathinfo($manifest_path, PATHINFO_EXTENSION)); $handler = \Curator\Handler\Factory::getHandlerForMediaType($ext); $manifest = $handler->input($manifest_path); $this->manifest = $manifest; } return $this->manifest; }