Updated error messages for better troubleshooting

This commit is contained in:
markseu 2022-04-17 02:22:38 +02:00
parent 8ece563c01
commit e605ca8367
5 changed files with 34 additions and 34 deletions

View file

@ -2,7 +2,7 @@
// Core extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/core
class YellowCore {
const VERSION = "0.8.67";
const VERSION = "0.8.68";
const RELEASE = "0.8.19";
public $page; // current page
public $content; // content files
@ -2506,6 +2506,7 @@ class YellowToolbox {
case 430: $text = "Login failed"; break;
case 434: $text = "Can create"; break;
case 435: $text = "Can restore"; break;
case 450: $text = "Update error"; break;
case 500: $text = "Server error"; break;
case 503: $text = "Service unavailable"; break;
default: $text = "Error $statusCode";

View file

@ -2,7 +2,7 @@
// Install extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/install
class YellowInstall {
const VERSION = "0.8.67";
const VERSION = "0.8.68";
const PRIORITY = "1";
public $yellow; // access to API
@ -85,18 +85,18 @@ class YellowInstall {
$statusCode = 200;
} else {
$statusCode = 304;
echo "The installation has not been completed. Please type 'php yellow.php serve'\n";
echo "The installation has not been completed. Please type 'php yellow.php serve'.\n";
}
if ($statusCode>=400) {
echo "ERROR installing files: ".$this->yellow->page->get("pageError")."\n";
echo "Your website has not been installed: Please run command again\n";
echo "The installation has not been completed. Please run command again.\n";
}
} else {
$statusCode = $this->removeInstall();
$this->yellow->log($statusCode==200 ? "info" : "error", "Uninstall extension 'Install ".YellowInstall::VERSION."'");
if ($statusCode>=400) {
echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
echo "Your website has not been updated: Please run command again\n";
echo "Detected ZIP-files, 0 extensions installed. Please run command again.\n";
}
}
if ($statusCode==200) $statusCode = 0;

View file

@ -21,11 +21,11 @@ Tag: feature
system/extensions/command.php: command.php, create, update
Extension: Core
Version: 0.8.67
Version: 0.8.68
Description: Core functionality of the website.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/core
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/core.zip
Published: 2022-04-14 16:29:41
Published: 2022-04-17 02:00:23
Developer: Datenstrom
Tag: feature
system/extensions/core.php: core.php, create, update
@ -64,11 +64,11 @@ media/images/photo.jpg: photo.jpg, create, optional
media/thumbnails/photo-100x40.jpg: photo-100x40.jpg, create, optional
Extension: Install
Version: 0.8.67
Version: 0.8.68
Description: Install a brand new, shiny website.
HelpUrl: https://github.com/datenstrom/yellow-extensions/tree/master/source/install
DownloadUrl: https://github.com/datenstrom/yellow-extensions/raw/master/zip/install.zip
Published: 2022-04-15 12:52:14
Published: 2022-04-17 01:09:22
Developer: Datenstrom
Status: unlisted
system/extensions/install.php: install.php, create
@ -131,11 +131,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.68
Version: 0.8.69
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: 2022-04-14 17:32:03
Published: 2022-04-17 01:50:25
Developer: Datenstrom
Tag: feature
system/extensions/update.php: update.php, create, update

View file

@ -2,10 +2,10 @@
// Update extension, https://github.com/datenstrom/yellow-extensions/tree/master/source/update
class YellowUpdate {
const VERSION = "0.8.68";
const VERSION = "0.8.69";
const PRIORITY = "2";
public $yellow; // access to API
public $updates; // number of updates
public $extensions; // number of extensions
// Handle initialisation
public function onLoad($yellow) {
@ -206,13 +206,13 @@ class YellowUpdate {
public function processCommandInstall($command, $text) {
$extensions = $this->getExtensionsFromText($text);
if (!empty($extensions)) {
$this->updates = 0;
$this->extensions = 0;
list($statusCode, $settings) = $this->getExtensionInstallInformation($extensions);
if ($statusCode==200) $statusCode = $this->downloadExtensions($settings);
if ($statusCode==200) $statusCode = $this->updateExtensions("install");
if ($statusCode>=400) echo "ERROR installing files: ".$this->yellow->page->get("pageError")."\n";
echo "Yellow $command: Website ".($statusCode!=200 ? "not " : "")."updated";
echo ", $this->updates extension".($this->updates!=1 ? "s" : "")." installed\n";
echo ", $this->extensions extension".($this->extensions!=1 ? "s" : "")." installed\n";
} else {
$statusCode = $this->showExtensions(true);
}
@ -223,12 +223,12 @@ class YellowUpdate {
public function processCommandUninstall($command, $text) {
$extensions = $this->getExtensionsFromText($text);
if (!empty($extensions)) {
$this->updates = 0;
$this->extensions = 0;
list($statusCode, $settings) = $this->getExtensionUninstallInformation($extensions, "core, update");
if ($statusCode==200) $statusCode = $this->removeExtensions($settings);
if ($statusCode>=400) echo "ERROR uninstalling files: ".$this->yellow->page->get("pageError")."\n";
echo "Yellow $command: Website ".($statusCode!=200 ? "not " : "")."updated";
echo ", $this->updates extension".($this->updates!=1 ? "s" : "")." uninstalled\n";
echo ", $this->extensions extension".($this->extensions!=1 ? "s" : "")." uninstalled\n";
} else {
$statusCode = $this->showExtensions(false);
}
@ -241,22 +241,24 @@ class YellowUpdate {
if (!empty($extensions)) {
list($statusCode, $settings) = $this->getExtensionUpdateInformation($extensions);
if ($statusCode!=200 || !empty($settings)) {
$this->updates = 0;
$this->extensions = 0;
if ($statusCode==200) $statusCode = $this->downloadExtensions($settings);
if ($statusCode==200) $statusCode = $this->updateExtensions("update");
if ($statusCode>=400) echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
echo "Yellow $command: Website ".($statusCode!=200 ? "not " : "")."updated";
echo ", $this->updates update".($this->updates!=1 ? "s" : "")." installed\n";
echo ", $this->extensions extension".($this->extensions!=1 ? "s" : "")." updated\n";
} else {
echo "Your website is up to date\n";
}
} else {
list($statusCode, $settings) = $this->getExtensionUpdateInformation(array("all"));
if ($statusCode!=200 || !empty($settings)) {
if ($statusCode>=400) echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
$this->updates = count($settings);
echo "Yellow $command: Please type 'php yellow.php update all'";
echo ", $this->updates update".($this->updates!=1 ? "s" : "")." available\n";
if (!empty($settings)) {
foreach ($settings as $key=>$value) {
echo ucfirst($key)." ".$value->get("version")."\n";
}
echo "Yellow $command: Updates are available. Please type 'php yellow.php update all'.\n";
} elseif ($statusCode!=200) {
echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
} else {
echo "Your website is up to date\n";
}
@ -269,9 +271,11 @@ class YellowUpdate {
$statusCode = 0;
$this->updateEventPending();
if ($this->isExtensionPending()) {
$this->extensions = 0;
$statusCode = $this->updateExtensions("install");
if ($statusCode!=200) echo "ERROR updating files: ".$this->yellow->page->get("pageError")."\n";
echo "Your website has ".($statusCode!=200 ? "not " : "")."been updated: Please run command again\n";
if ($statusCode!=200) echo "ERROR installing files: ".$this->yellow->page->get("pageError")."\n";
echo "Detected ZIP-file".($this->extensions!=1 ? "s" : "");
echo ", $this->extensions extension".($this->extensions!=1 ? "s" : "")." installed. Please run command again.\n";
}
return $statusCode;
}
@ -389,7 +393,7 @@ class YellowUpdate {
$statusCode = max($statusCode, $this->updateExtensionNotification($extension, $action));
}
$this->yellow->log($statusCode==200 ? "info" : "error", ucfirst($action)." extension '".ucfirst($extension)." $version'");
++$this->updates;
++$this->extensions;
} else {
$statusCode = 500;
$this->yellow->page->error($statusCode, "Can't detect file '$path'!");
@ -628,7 +632,7 @@ class YellowUpdate {
if ($statusCode==200) $statusCode = $this->updateExtensionSettings($extension, $settings, $action);
$version = $settings->get("version");
$this->yellow->log($statusCode==200 ? "info" : "error", ucfirst($action)." extension '".ucfirst($extension)." $version'");
++$this->updates;
++$this->extensions;
} else {
$statusCode = 500;
$this->yellow->page->error($statusCode, "Please delete extension '$extension' manually!");
@ -741,11 +745,6 @@ class YellowUpdate {
}
}
}
if ($statusCode==200) {
foreach ($settings as $key=>$value) {
echo ucfirst($key)." ".$value->get("version")."\n";
}
}
return array($statusCode, $settings);
}
@ -875,7 +874,7 @@ class YellowUpdate {
} elseif ($statusCode==0) {
$statusCode = 500;
list($scheme, $address) = $this->yellow->lookup->getUrlInformation($url);
$this->yellow->page->error($statusCode, "Can't connect to server '$scheme://$address'!");
$this->yellow->page->error($statusCode, "Can't connect to the update server!");
} else {
$statusCode = 500;
$this->yellow->page->error($statusCode, "Can't download file '$url'!");