This commit is contained in:
2022-06-25 09:23:59 +00:00
parent 4b53121953
commit 0875406bf8
6 changed files with 20 additions and 20 deletions

View File

@ -81,8 +81,7 @@ class WikiHelper {
if ( $this->wikiFolder->nodeExists($path) ) {
$this->getFileByName(self::WIKI_FILE)->putContent($data);
} else {
$this->wikiFolder
->newFile(self::WIKI_FILE, $data);
$this->wikiFolder->newFile(self::WIKI_FILE, $data);
}
} catch(\Exception $ex) {
return false;
@ -154,26 +153,22 @@ class WikiHelper {
public function getWikiPageContent($id): string {
try {
$pageFolder = $this->getFolderById($id);
$path = $pageFolder->getInternalPath().'/'.self::WIKI_FILE_CONTENT;
if ( $this->wikiFolder->nodeExists($path) ) {
return $this->getFileByName(self::WIKI_FILE_CONTENT)->getContent();
if ( $pageFolder->nodeExists(self::WIKI_FILE_CONTENT) ) {
return $pageFolder->get(self::WIKI_FILE_CONTENT)->getContent();
}
$this->wikiFolder->newFile(self::WIKI_FILE_CONTENT, '');
} catch(\Exception $ex) {
return null;
}
return '';
}
}
public function update(int $id, string $content) {
try {
$pageFolder = $this->getFolderById($id);
$path = $pageFolder->getInternalPath().'/'.self::WIKI_FILE_CONTENT;
if ( $this->wikiFolder->nodeExists($path) ) {
$this->getFileByName(self::WIKI_FILE_CONTENT)->putContent($content);
if ( $pageFolder->nodeExists(self::WIKI_FILE_CONTENT) ) {
$pageFolder->get(self::WIKI_FILE_CONTENT)->putContent($content);
} else {
$this->wikiFolder
->newFile(self::WIKI_FILE_CONTENT, $content);
$pageFolder->newFile(self::WIKI_FILE_CONTENT, $content);
}
} catch(\Exception $ex) {
return false;