public static function export(Tiki_Profile_Writer $writer, $id, $withTopic = false, $withType = false) { $artlib = TikiLib::lib('art'); $info = $artlib->get_article($id, false); if (!$info) { return false; } $bodypage = "article_{$id}_body"; $writer->writeExternal($bodypage, $writer->getReference('wiki_content', $info['body'])); $out = array('title' => $info['title'], 'author' => $info['authorName'], 'body' => "wikicontent:{$bodypage}", 'type' => $writer->getReference('article_type', $info['type']), 'publication_date' => $info['publishDate'], 'expiration_date' => $info['expireDate'], 'topline' => $info['topline'], 'subtitle' => $info['subtitle'], 'link_to' => $info['linkto'], 'language' => $info['lang']); if ($info['topicId']) { if ($withTopic) { Tiki_Profile_InstallHandler_ArticleTopic::export($writer, $info['topicId']); } $out['topic'] = $writer->getReference('article_topic', $info['topicId']); } if ($info['heading']) { $headerpage = "article_{$id}_heading"; $writer->writeExternal($headerpage, $writer->getReference('wiki_content', $info['heading'])); $out['heading'] = "wikicontent:{$headerpage}"; } $out = array_filter($out); $writer->addObject('article', $id, $out); if ($withType) { Tiki_Profile_InstallHandler_ArticleType::export($writer, $info['type']); } return true; }
protected function execute(InputInterface $input, OutputInterface $output) { $id = $input->getArgument('topic'); $writer = $this->getProfileWriter($input); $result = \Tiki_Profile_InstallHandler_ArticleTopic::export($writer, $id); if ($result) { $writer->save(); } else { $output->writeln("Topic not found: {$id}"); } }