Explorar o código

Updated installer

markseu hai 1 ano
pai
achega
56727de7b4

+ 2 - 2
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

+ 4 - 4
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

+ 2 - 2
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'");

+ 6 - 5
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));
             }