Ver código fonte

Updated extensions, troubleshooting

markseu 5 anos atrás
pai
commit
b4a12fe658

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

+ 0 - 3
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

+ 23 - 9
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) {

+ 0 - 3
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