mikuli.cz

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

commit b4a12fe6586b11cb30171d11914cf0062bd7d9f5
parent f451069c8f5c45ba61ff065cec9bd4a5fa3c58af
Author: markseu <mark2011@mayberg.se>
Date:   Sat, 22 Feb 2020 15:16:13 +0100

Updated extensions, troubleshooting

Diffstat:
Msystem/extensions/core.php | 5++---
Msystem/extensions/image.php | 3---
Msystem/extensions/install.php | 32+++++++++++++++++++++++---------
Msystem/extensions/update.php | 3---
4 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/system/extensions/core.php b/system/extensions/core.php @@ -74,9 +74,8 @@ class YellowCore { // Handle initialisation public function load() { - $troubleshooting = "<a href=\"https://datenstrom.se/yellow/help/troubleshooting\">See troubleshooting</a>."; - extension_loaded("mbstring") || die("Datenstrom Yellow requires PHP extension 'mbstring'! $troubleshooting"); - version_compare(PHP_VERSION, "5.6", ">=") || die("Datenstrom Yellow requires PHP 5.6 or higher! $troubleshooting"); + $troubleshooting = PHP_SAPI!="cli" ? "<a href=\"https://datenstrom.se/yellow/help/troubleshooting\">See troubleshooting</a>." : ""; + version_compare(PHP_VERSION, "5.6", ">=") || die("Datenstrom Yellow requires PHP 5.6 or higher! $troubleshooting\n"); if (defined("DEBUG") && DEBUG>=3) { $serverVersion = $this->toolbox->getServerVersion(); echo "YellowCore::load Datenstrom Yellow ".YellowCore::VERSION.", PHP ".PHP_VERSION.", $serverVersion<br/>\n"; diff --git a/system/extensions/image.php b/system/extensions/image.php @@ -18,9 +18,6 @@ class YellowImage { $this->yellow->system->setDefault("imageThumbnailLocation", "/media/thumbnails/"); $this->yellow->system->setDefault("imageThumbnailDir", "media/thumbnails/"); $this->yellow->system->setDefault("imageThumbnailJpgQuality", "80"); - $troubleshooting = "<a href=\"https://datenstrom.se/yellow/help/troubleshooting\">See troubleshooting</a>."; - extension_loaded("gd") || die("Datenstrom Yellow requires PHP extension 'gd'! $troubleshooting"); - extension_loaded("exif") || die("Datenstrom Yellow requires PHP extension 'exif'! $troubleshooting"); } // Handle page content of shortcut diff --git a/system/extensions/install.php b/system/extensions/install.php @@ -4,7 +4,7 @@ // This file may be used and distributed under the terms of the public license. class YellowInstall { - const VERSION = "0.8.17"; + const VERSION = "0.8.18"; const TYPE = "feature"; const PRIORITY = "1"; public $yellow; //access to API @@ -12,20 +12,18 @@ class YellowInstall { // Handle initialisation public function onLoad($yellow) { $this->yellow = $yellow; - $troubleshooting = "<a href=\"https://datenstrom.se/yellow/help/troubleshooting\">See troubleshooting</a>."; - extension_loaded("curl") || die("Datenstrom Yellow requires PHP extension 'curl'! $troubleshooting"); - extension_loaded("zip") || die("Datenstrom Yellow requires PHP extension 'zip'! $troubleshooting"); } // Handle request public function onRequest($scheme, $address, $base, $location, $fileName) { $statusCode = 0; if ($this->yellow->lookup->isContentFile($fileName) || empty($fileName)) { - $server = $this->yellow->toolbox->getServerVersion(true); $troubleshooting = "<a href=\"https://datenstrom.se/yellow/help/troubleshooting\">See troubleshooting</a>."; - $this->checkServerConfiguration($server) || die("Datenstrom Yellow requires a configuration file for $server! $troubleshooting"); - $this->checkServerRewrite($scheme, $address, $base, $location, $fileName) || die("Datenstrom Yellow requires rewrite support for $server! $troubleshooting"); - $this->checkServerAccess() || die("Datenstrom Yellow requires write access for $server! $troubleshooting"); + $server = $this->yellow->toolbox->getServerVersion(true); + $this->checkServerExtensions() || die("Datenstrom Yellow requires PHP extension '".$this->getServerExtensionRequired()."' for $server! $troubleshooting\n"); + $this->checkServerConfiguration($server) || die("Datenstrom Yellow requires a configuration file for $server! $troubleshooting\n"); + $this->checkServerRewrite($scheme, $address, $base, $location, $fileName) || die("Datenstrom Yellow requires rewrite support for $server! $troubleshooting\n"); + $this->checkServerAccess() || die("Datenstrom Yellow requires write access for $server! $troubleshooting\n"); $statusCode = $this->processRequestInstall($scheme, $address, $base, $location, $fileName); } return $statusCode; @@ -33,6 +31,7 @@ class YellowInstall { // Handle command public function onCommand($args) { + $this->checkServerExtensions() || die("Datenstrom Yellow requires PHP extension '".$this->getServerExtensionRequired()."'!\n"); return $this->processCommandInstall(); } @@ -269,6 +268,11 @@ class YellowInstall { return $statusCode; } + // Check web server extensions + public function checkServerExtensions() { + return empty($this->getServerExtensionRequired()); + } + // Check web server configuration public function checkServerConfiguration($server) { return strtoloweru($server)!="apache" || is_file(".htaccess"); @@ -310,7 +314,17 @@ class YellowInstall { return array_unique($languages); } - // Return system data, detect server URL + // Return web server extension required + public function getServerExtensionRequired() { + $extension = ""; + $extensionsRequired = "curl, dom, gd, exif, mbstring, zip"; + foreach (preg_split("/\s*,\s*/", $extensionsRequired) as $extensionRequired) { + if (!extension_loaded($extensionRequired)) $extension = $extensionRequired; + } + return $extension; + } + + // Return system data, detect system settings public function getSystemData() { $data = array(); foreach ($_REQUEST as $key=>$value) { diff --git a/system/extensions/update.php b/system/extensions/update.php @@ -19,9 +19,6 @@ class YellowUpdate { $this->yellow->system->setDefault("updateVersionFile", "version.ini"); $this->yellow->system->setDefault("updateWaffleFile", "waffle.ini"); $this->yellow->system->setDefault("updateNotification", "none"); - $troubleshooting = "<a href=\"https://datenstrom.se/yellow/help/troubleshooting\">See troubleshooting</a>."; - extension_loaded("curl") || die("Datenstrom Yellow requires PHP extension 'curl'! $troubleshooting"); - extension_loaded("zip") || die("Datenstrom Yellow requires PHP extension 'zip'! $troubleshooting"); } // Handle request