From 56727de7b430a80b2b97cf0ff1b2c11cfb7134f8 Mon Sep 17 00:00:00 2001 From: markseu Date: Sat, 13 Apr 2024 01:14:51 +0200 Subject: [PATCH] Updated installer --- system/extensions/update-available.ini | 4 ++-- system/extensions/yellow-extension.ini | 8 ++++---- system/workers/install.php | 4 ++-- system/workers/update.php | 11 ++++++----- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/system/extensions/update-available.ini b/system/extensions/update-available.ini index 2ce341a..68256c9 100644 --- a/system/extensions/update-available.ini +++ b/system/extensions/update-available.ini @@ -777,14 +777,14 @@ Status: available system/workers/turkish.php: turkish.php, create, update Extension: Update -Version: 0.9.3 +Version: 0.9.4 Description: Keep your website up to date. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-update/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-update DocumentationLanguage: en, de, sv -Published: 2024-04-10 10:20:21 +Published: 2024-04-13 00:52:43 Status: available system/workers/update.php: update.php, create, update system/workers/updatepatch.bin: updatepatch.php, create, additional diff --git a/system/extensions/yellow-extension.ini b/system/extensions/yellow-extension.ini index e77491e..dfee39c 100755 --- a/system/extensions/yellow-extension.ini +++ b/system/extensions/yellow-extension.ini @@ -62,13 +62,13 @@ media/images/photo.jpg: photo.jpg, create, optional media/thumbnails/photo-100x40.jpg: photo-100x40.jpg, create, optional Extension: Install -Version: 0.9.3 +Version: 0.9.4 Description: Install a brand new website. Developer: Anna Svensson DownloadUrl: https://github.com/annaesvensson/yellow-install/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-install DocumentationLanguage: en, de, sv -Published: 2024-04-10 11:38:35 +Published: 2024-04-13 00:55:28 Status: unassembled system/workers/install.php: install.php, create system/workers/install-language.bin: install-language.bin, compress @source/yellow-language/, create @@ -129,14 +129,14 @@ system/themes/stockholm-opensans-light.woff: stockholm-opensans-light.woff, crea system/themes/stockholm-opensans-regular.woff: stockholm-opensans-regular.woff, create, update, careful Extension: Update -Version: 0.9.3 +Version: 0.9.4 Description: Keep your website up to date. Developer: Anna Svensson Tag: feature DownloadUrl: https://github.com/annaesvensson/yellow-update/archive/refs/heads/main.zip DocumentationUrl: https://github.com/annaesvensson/yellow-update DocumentationLanguage: en, de, sv -Published: 2024-04-10 10:20:21 +Published: 2024-04-13 00:52:43 Status: available system/workers/update.php: update.php, create, update system/workers/updatepatch.bin: updatepatch.php, create, additional diff --git a/system/workers/install.php b/system/workers/install.php index 26d6fbd..1b17a1d 100755 --- a/system/workers/install.php +++ b/system/workers/install.php @@ -2,7 +2,7 @@ // Install extension, https://github.com/annaesvensson/yellow-install class YellowInstall { - const VERSION = "0.9.3"; + const VERSION = "0.9.4"; const PRIORITY = "1"; public $yellow; // access to API @@ -163,7 +163,7 @@ class YellowInstall { $modified = strtotime($settings->get("published")); $fileNamePhp = $this->yellow->system->get("coreWorkerDirectory").$extension.".php"; if (!is_string_empty($extension) && !is_string_empty($version) && !is_file($fileNamePhp)) { - $statusCode = max($statusCode, $this->yellow->extension->get("update")->updateExtensionSettings($extension, $action, $settings)); + $statusCode = max($statusCode, $this->yellow->extension->get("update")->updateExtensionSettings($extension, $action, $fileDataIni)); $statusCode = max($statusCode, $this->yellow->extension->get("update")->updateExtensionFile( $fileNamePhp, $fileDataPhp, $modified, 0, 0, "create", $extension)); $this->yellow->toolbox->log($statusCode==200 ? "info" : "error", ucfirst($action)." extension '".ucfirst($extension)." $version'"); diff --git a/system/workers/update.php b/system/workers/update.php index dd85bcb..1dab0db 100644 --- a/system/workers/update.php +++ b/system/workers/update.php @@ -2,7 +2,7 @@ // Update extension, https://github.com/annaesvensson/yellow-update class YellowUpdate { - const VERSION = "0.9.3"; + const VERSION = "0.9.4"; const PRIORITY = "2"; public $yellow; // access to API public $extensions; // number of extensions @@ -277,7 +277,7 @@ class YellowUpdate { $settings = $this->yellow->toolbox->getTextSettings($fileData, ""); list($extension, $version, $newModified, $oldModified) = $this->getExtensionInformation($settings); if (!is_string_empty($extension) && !is_string_empty($version)) { - $statusCode = max($statusCode, $this->updateExtensionSettings($extension, $action, $settings)); + $statusCode = max($statusCode, $this->updateExtensionSettings($extension, $action, $fileData)); $paths = $this->getExtensionDirectories($zip, $pathBase); foreach ($this->getExtensionFileNames($settings) as $fileName) { list($entry, $flags) = $this->yellow->toolbox->getTextList($settings[$fileName], ",", 2); @@ -434,14 +434,15 @@ class YellowUpdate { } // Update extension settings - public function updateExtensionSettings($extension, $action, $settings) { + public function updateExtensionSettings($extension, $action, $text = "") { $statusCode = 200; $fileName = $this->yellow->system->get("coreExtensionDirectory").$this->yellow->system->get("coreExtensionFile"); $fileData = $fileDataNew = $this->yellow->toolbox->readFile($fileName); if ($action=="install" || $action=="update") { $settingsCurrent = $this->yellow->toolbox->getTextSettings($fileData, "extension"); $settingsCurrent[$extension] = new YellowArray(); - foreach ($settings as $key=>$value) $settingsCurrent[$extension][$key] = $value; + $block = $this->yellow->toolbox->getTextSettings($text, ""); + foreach ($block as $key=>$value) $settingsCurrent[$extension][$key] = $value; $settingsCurrent->uksort("strnatcasecmp"); $fileDataNew = ""; foreach ($this->yellow->toolbox->getTextLines($fileData) as $line) { @@ -618,7 +619,7 @@ class YellowUpdate { $statusCode = max($statusCode, $this->removeExtensionFile($fileName)); } if ($statusCode==200) { - $statusCode = max($statusCode, $this->updateExtensionSettings($extension, $action, $settings)); + $statusCode = max($statusCode, $this->updateExtensionSettings($extension, $action)); $statusCode = max($statusCode, $this->updateSystemSettings($extension, $action)); $statusCode = max($statusCode, $this->updateLanguageSettings($extension, $action)); }