mikuli.cz

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

commit a1ed2498c39eebeeeece23869331c2f182bc34fe
parent 8a8965ab129fef0019d2386d7680fa787327e8be
Author: markseu <mark2011@mayberg.se>
Date:   Mon, 25 Feb 2019 21:50:19 +0100

Updated installation files

Diffstat:
Msystem/extensions/core.php | 24++++++++++++------------
Msystem/extensions/install-languages.zip | 0
Msystem/extensions/install.php | 3++-
Msystem/extensions/update.php | 35++++++++++++++++++++++-------------
Msystem/settings/system.ini | 31++++++++++++++++---------------
5 files changed, 52 insertions(+), 41 deletions(-)

diff --git a/system/extensions/core.php b/system/extensions/core.php @@ -39,6 +39,13 @@ class YellowCore { $this->system->setDefault("email", "webmaster"); $this->system->setDefault("language", "en"); $this->system->setDefault("timezone", "UTC"); + $this->system->setDefault("layout", "default"); + $this->system->setDefault("theme", "default"); + $this->system->setDefault("parser", "markdown"); + $this->system->setDefault("navigation", "navigation"); + $this->system->setDefault("header", "header"); + $this->system->setDefault("footer", "footer"); + $this->system->setDefault("sidebar", "sidebar"); $this->system->setDefault("staticUrl", ""); $this->system->setDefault("staticDefaultFile", "index.html"); $this->system->setDefault("staticErrorFile", "404.html"); @@ -68,17 +75,10 @@ class YellowCore { $this->system->setDefault("downloadExtension", ".download"); $this->system->setDefault("systemFile", "system.ini"); $this->system->setDefault("textFile", "text.ini"); - $this->system->setDefault("serverUrl", ""); - $this->system->setDefault("layout", "default"); - $this->system->setDefault("theme", "default"); - $this->system->setDefault("parser", "markdown"); - $this->system->setDefault("navigation", "navigation"); - $this->system->setDefault("header", "header"); - $this->system->setDefault("footer", "footer"); - $this->system->setDefault("sidebar", "sidebar"); - $this->system->setDefault("startupUpdate", "none"); - $this->system->setDefault("multiLanguageMode", "0"); $this->system->setDefault("safeMode", "0"); + $this->system->setDefault("multiLanguageMode", "0"); + $this->system->setDefault("startupUpdate", "none"); + $this->system->setDefault("serverUrl", ""); } public function __destruct() { @@ -375,8 +375,8 @@ class YellowCore { $this->system->save("system/settings/system.ini", array("startupUpdate" => "update")); if (!empty($fileDataError)) $this->toolbox->createFile($fileNameError, $fileDataError); @header($this->toolbox->getHttpStatusFormatted(empty($fileDataError) ? 200 : 500)); - die(empty($fileDataError) ? "System folder has been updated. Please try again.\n" : - "System folder has not been updated. See errors in file '$fileNameError'!\n"); + die(empty($fileDataError) ? "System has been updated. Please update your website one more time.\n" : + "System has not been updated. Please check errors in file '$fileNameError'!\n"); } } diff --git a/system/extensions/install-languages.zip b/system/extensions/install-languages.zip Binary files differ. diff --git a/system/extensions/install.php b/system/extensions/install.php @@ -88,7 +88,8 @@ class YellowInstall { $languagesFound = array(); foreach ($languages as $language) $languagesFound[$language] = ""; if (preg_match("#^(.*\/).*?$#", $zip->getNameIndex(0), $matches)) $pathBase = $matches[1]; - $fileData = $zip->getFromName($pathBase.$this->yellow->system->get("updateInformationFile")); + $fileData = $zip->getFromName($pathBase.$this->yellow->system->get("updateExtensionFile")); + if (empty($fileData)) $fileData = $zip->getFromName($pathBase.$this->yellow->system->get("updateInformationFile")); //TODO: remove later, for backwards compatibility foreach ($this->yellow->toolbox->getTextLines($fileData) as $line) { preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches); if (!empty($matches[1]) && !empty($matches[2]) && strposu($matches[1], "/")) { diff --git a/system/extensions/update.php b/system/extensions/update.php @@ -4,7 +4,7 @@ // This file may be used and distributed under the terms of the public license. class YellowUpdate { - const VERSION = "0.8.2"; + const VERSION = "0.8.3"; const TYPE = "feature"; const PRIORITY = "2"; public $yellow; //access to API @@ -15,6 +15,7 @@ class YellowUpdate { $this->yellow = $yellow; $this->yellow->system->setDefault("updateExtensionUrl", "https://github.com/datenstrom/yellow-extensions"); $this->yellow->system->setDefault("updateInformationFile", "update.ini"); + $this->yellow->system->setDefault("updateExtensionFile", "extension.ini"); $this->yellow->system->setDefault("updateVersionFile", "version.ini"); $this->yellow->system->setDefault("updateWaffleFile", "waffle.ini"); } @@ -161,22 +162,29 @@ class YellowUpdate { if ($update) { $fileName = $this->yellow->system->get("settingDir").$this->yellow->system->get("systemFile"); $fileData = $this->yellow->toolbox->readFile($fileName); - $fileDataNew = ""; - $settingsDefaults = new YellowDataCollection(); - $settingsDefaults->exchangeArray($this->yellow->system->settingsDefaults->getArrayCopy()); + $fileDataHeader = $fileDataSettings = $fileDataFooter = ""; + $settings = new YellowDataCollection(); + $settings->exchangeArray($this->yellow->system->settingsDefaults->getArrayCopy()); foreach ($this->yellow->toolbox->getTextLines($fileData) as $line) { preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches); - if (!empty($matches[1]) && !is_null($settingsDefaults[$matches[1]])) unset($settingsDefaults[$matches[1]]); - if (!empty($matches[1]) && $matches[1][0]!="#" && is_null($this->yellow->system->settingsDefaults[$matches[1]])) { - $fileDataNew .= "# $line"; - } else { - $fileDataNew .= $line; + if (empty($fileDataHeader) && preg_match("/^\#/", $line)) { + $fileDataHeader = $line; + } elseif (!empty($matches[1]) && !is_null($settings[$matches[1]])) { + $settings[$matches[1]] = $matches[2]; + } elseif (!empty($matches[1]) && $matches[1][0]!="#") { + $fileDataFooter .= "# $line"; + } elseif (!empty($matches[1])) { + $fileDataFooter .= $line; } } - unset($settingsDefaults["systemFile"]); - foreach ($settingsDefaults as $key=>$value) { - $fileDataNew .= ucfirst($key).": $value\n"; + unset($settings["systemFile"]); + foreach ($settings as $key=>$value) { + $fileDataSettings .= ucfirst($key).(strempty($value) ? ":\n" : ": $value\n"); + if ($key=="updateWaffleFile") $fileDataSettings .= "\n"; } + if (!empty($fileDataHeader)) $fileDataHeader .= "\n"; + if (!empty($fileDataFooter)) $fileDataSettings .= "\n"; + $fileDataNew = $fileDataHeader.$fileDataSettings.$fileDataFooter; if ($fileData!=$fileDataNew) $this->yellow->toolbox->createFile($fileName, $fileDataNew); } } @@ -466,7 +474,8 @@ class YellowUpdate { if ($zip->open($path)===true) { if (defined("DEBUG") && DEBUG>=2) echo "YellowUpdate::updateExtensionArchive file:$path<br/>\n"; if (preg_match("#^(.*\/).*?$#", $zip->getNameIndex(0), $matches)) $pathBase = $matches[1]; - $fileData = $zip->getFromName($pathBase.$this->yellow->system->get("updateInformationFile")); + $fileData = $zip->getFromName($pathBase.$this->yellow->system->get("updateExtensionFile")); + if (empty($fileData)) $fileData = $zip->getFromName($pathBase.$this->yellow->system->get("updateInformationFile")); //TODO: remove later, for backwards compatibility foreach ($this->yellow->toolbox->getTextLines($fileData) as $line) { preg_match("/^\s*(.*?)\s*:\s*(.*?)\s*$/", $line, $matches); if (!empty($matches[1]) && !empty($matches[2])) { diff --git a/system/settings/system.ini b/system/settings/system.ini @@ -5,7 +5,13 @@ Author: Datenstrom Email: webmaster Language: en Timezone: UTC - +Layout: default +Theme: flatsite +Parser: markdown +Navigation: navigation +Header: header +Footer: footer +Sidebar: sidebar StaticUrl: StaticDefaultFile: index.html StaticErrorFile: 404.html @@ -34,17 +40,16 @@ ContentDefaultFile: page.md ContentExtension: .md DownloadExtension: .download TextFile: text.ini -ServerUrl: -Layout: default -Theme: flatsite -Parser: markdown -Navigation: navigation -Header: header -Footer: footer -Sidebar: sidebar -StartupUpdate: none -MultiLanguageMode: 0 SafeMode: 0 +MultiLanguageMode: 0 +StartupUpdate: none +ServerUrl: +UpdateExtensionUrl: https://github.com/datenstrom/yellow-extensions +UpdateInformationFile: update.ini +UpdateExtensionFile: extension.ini +UpdateVersionFile: version.ini +UpdateWaffleFile: waffle.ini + BundleAndMinify: 1 EditLocation: /edit/ EditUploadNewLocation: /media/@group/@filename @@ -68,7 +73,3 @@ ImageUploadJpgQuality: 80 ImageThumbnailLocation: /media/thumbnails/ ImageThumbnailDir: media/thumbnails/ ImageThumbnailJpgQuality: 80 -UpdateExtensionUrl: https://github.com/datenstrom/yellow-extensions -UpdateInformationFile: update.ini -UpdateVersionFile: version.ini -UpdateWaffleFile: waffle.ini