mikuli.cz

:)
git clone https://git.sr.ht/~ashymad/mikuli.cz
Log | Files | Refs

commit ab92f85f2c61af2566c8c4af5b878f9713bcc430
parent c2303281967d3f86f6109e2059707261bb4b4404
Author: markseu <mark2011@mayberg.se>
Date:   Wed, 17 Apr 2019 10:16:06 +0200

Simplified installation of new website

Diffstat:
Msystem/extensions/install.php | 25+++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/system/extensions/install.php b/system/extensions/install.php @@ -4,7 +4,7 @@ // This file may be used and distributed under the terms of the public license. class YellowInstall { - const VERSION = "0.8.5"; + const VERSION = "0.8.6"; const TYPE = "feature"; const PRIORITY = "1"; public $yellow; //access to API @@ -66,6 +66,9 @@ class YellowInstall { if ($status=="ok") $status = $this->updateContent($language, "Home", "/")==200 ? "ok" : "error"; if ($status=="ok") $status = $this->updateContent($language, "About", "/about/")==200 ? "ok" : "error"; if ($status=="ok") $status = $this->updateContent($language, "Footer", "/shared/footer")==200 ? "ok" : "error"; + if ($status=="ok") $status = $this->updateContent($language, "Default", "/shared/page-new-default")==200 ? "ok" : "error"; + if ($status=="ok") $status = $this->updateContent($language, "Blog", "/shared/page-new-blog")==200 ? "ok" : "error"; + if ($status=="ok") $status = $this->updateContent($language, "Wiki", "/shared/page-new-wiki")==200 ? "ok" : "error"; if ($status=="ok") $status = $this->updateSettings($this->getSystemData())==200 ? "ok" : "error"; if ($status=="ok") $status = $this->removeFiles()==200 ? "done" : "error"; if ($status=="done") { @@ -186,17 +189,19 @@ class YellowInstall { public function updateContent($language, $name, $location) { $statusCode = 200; if ($language!="en") { - $titleOld = "Title: ".$this->yellow->text->getText("install{$name}Title", "en"); - $titleNew = "Title: ".$this->yellow->text->getText("install{$name}Title", $language); - $textOld = strreplaceu("\\n", "\n", $this->yellow->text->getText("install{$name}Text", "en")); - $textNew = strreplaceu("\\n", "\n", $this->yellow->text->getText("install{$name}Text", $language)); $fileName = $this->yellow->lookup->findFileFromLocation($location); $fileData = strreplaceu("\r\n", "\n", $this->yellow->toolbox->readFile($fileName)); - $fileData = strreplaceu($titleOld, $titleNew, $fileData); - $fileData = strreplaceu($textOld, $textNew, $fileData); - if (!$this->yellow->toolbox->createFile($fileName, $fileData)) { - $statusCode = 500; - $this->yellow->page->error($statusCode, "Can't write file '$fileName'!"); + if (!empty($fileData)) { + $titleOld = "Title: ".$this->yellow->text->getText("install{$name}Title", "en"); + $titleNew = "Title: ".$this->yellow->text->getText("install{$name}Title", $language); + $textOld = strreplaceu("\\n", "\n", $this->yellow->text->getText("install{$name}Text", "en")); + $textNew = strreplaceu("\\n", "\n", $this->yellow->text->getText("install{$name}Text", $language)); + if ($name!="Footer") $fileData = strreplaceu($titleOld, $titleNew, $fileData); + $fileData = strreplaceu($textOld, $textNew, $fileData); + if (!$this->yellow->toolbox->createFile($fileName, $fileData)) { + $statusCode = 500; + $this->yellow->page->error($statusCode, "Can't write file '$fileName'!"); + } } } return $statusCode;