mikuli.cz

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

commit 909de941e3471d5ad2208ac3d3e0ad4b23476342
parent 13a0b1740a13e567530703025d9648059b21ddc6
Author: markseu <mark2011@mayberg.se>
Date:   Fri, 20 Aug 2021 12:56:24 +0200

Refactored code

Diffstat:
Msystem/extensions/command.php | 17+++++++++++++++--
Msystem/extensions/update-current.ini | 8++++----
Msystem/extensions/update.php | 25++-----------------------
3 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/system/extensions/command.php b/system/extensions/command.php @@ -2,7 +2,7 @@ // Command extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/command class YellowCommand { - const VERSION = "0.8.29"; + const VERSION = "0.8.30"; public $yellow; // access to API public $files; // number of files public $links; // number of links @@ -26,6 +26,7 @@ class YellowCommand { // Handle command public function onCommand($command, $text) { switch ($command) { + case "about": $statusCode = $this->processCommandAbout($command, $text); break; case "build": $statusCode = $this->processCommandBuild($command, $text); break; case "check": $statusCode = $this->processCommandCheck($command, $text); break; case "clean": $statusCode = $this->processCommandClean($command, $text); break; @@ -36,12 +37,24 @@ class YellowCommand { // Handle command help public function onCommandHelp() { - $help = "build [directory location]\n"; + $help = "about\n"; + $help .= "build [directory location]\n"; $help .= "check [directory location]\n"; $help .= "clean [directory location]\n"; return $help; } + // Process command to show current version and extensions + public function processCommandAbout($command, $text) { + echo "Datenstrom Yellow ".YellowCore::RELEASE."\n"; + $dataCurrent = $this->yellow->extension->data; + uksort($dataCurrent, "strnatcasecmp"); + foreach ($dataCurrent as $key=>$value) { + echo ucfirst($key)." ".$value["version"]."\n"; + } + return 200; + } + // Process command to build static website public function processCommandBuild($command, $text) { $statusCode = 0; diff --git a/system/extensions/update-current.ini b/system/extensions/update-current.ini @@ -11,11 +11,11 @@ Tag: feature system/extensions/bundle.php: bundle.php, create, update Extension: Command -Version: 0.8.29 +Version: 0.8.30 Description: Command line of the website. HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/command DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/command.zip -Published: 2021-08-17 14:50:39 +Published: 2021-08-20 12:49:45 Developer: Datenstrom Tag: feature system/extensions/command.php: command.php, create, update @@ -126,11 +126,11 @@ 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.8.54 +Version: 0.8.55 Description: Keep your website up to date. HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/update DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/update.zip -Published: 2021-08-09 18:50:35 +Published: 2021-08-20 12:49:04 Developer: Datenstrom Tag: feature system/extensions/update.php: update.php, create, update diff --git a/system/extensions/update.php b/system/extensions/update.php @@ -2,7 +2,7 @@ // Update extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/update class YellowUpdate { - const VERSION = "0.8.54"; + const VERSION = "0.8.55"; const PRIORITY = "2"; public $yellow; // access to API public $updates; // number of updates @@ -98,7 +98,6 @@ class YellowUpdate { $statusCode = $this->processCommandPending(); if ($statusCode==0) { switch ($command) { - case "about": $statusCode = $this->processCommandAbout($command, $text); break; case "install": $statusCode = $this->processCommandInstall($command, $text); break; case "uninstall": $statusCode = $this->processCommandUninstall($command, $text); break; case "update": $statusCode = $this->processCommandUpdate($command, $text); break; @@ -110,31 +109,11 @@ class YellowUpdate { // Handle command help public function onCommandHelp() { - $help = "about\n"; - $help .= "install [extension]\n"; + $help = "install [extension]\n"; $help .= "uninstall [extension]\n"; $help .= "update [extension]\n"; return $help; } - - // Process command to show website version and updates - public function processCommandAbout($command, $text) { - echo "Datenstrom Yellow ".YellowCore::RELEASE."\n"; - list($statusCodeCurrent, $settingsCurrent) = $this->getExtensionSettings(false); - list($statusCodeLatest, $settingsLatest) = $this->getExtensionSettings(true); - $statusCode = max($statusCodeCurrent, $statusCodeLatest); - foreach ($settingsCurrent as $key=>$value) { - $versionCurrent = $versionLatest = $settingsCurrent[$key]->get("version"); - if ($settingsLatest->isExisting($key)) $versionLatest = $settingsLatest[$key]->get("version"); - if (strnatcasecmp($versionCurrent, $versionLatest)<0) { - echo ucfirst($key)." $versionCurrent - Update available\n"; - } else { - echo ucfirst($key)." $versionCurrent\n"; - } - } - if ($statusCode!=200) echo "ERROR checking updates: ".$this->yellow->page->get("pageError")."\n"; - return $statusCode; - } // Process command to install extensions public function processCommandInstall($command, $text) {