Improve the system check during WCFSetup in regards to the graphics library
authorMarcel Werk <burntime@woltlab.com>
Sat, 8 Feb 2020 19:46:42 +0000 (20:46 +0100)
committerMarcel Werk <burntime@woltlab.com>
Sat, 8 Feb 2020 19:46:42 +0000 (20:46 +0100)
Closes #3154

wcfsetup/install/files/lib/system/WCFSetup.class.php
wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php
wcfsetup/setup/lang/setup_de.xml
wcfsetup/setup/lang/setup_en.xml
wcfsetup/setup/template/stepShowSystemRequirements.tpl

index 55c54901781cafa9cc2d26f8b73994edb60f5481..a2f525ca3b8a1e55c7123da904af9f24e49eb18c 100644 (file)
@@ -13,6 +13,7 @@ use wcf\system\database\MySQLDatabase;
 use wcf\system\devtools\DevtoolsSetup;
 use wcf\system\exception\SystemException;
 use wcf\system\exception\UserInputException;
+use wcf\system\image\adapter\GDImageAdapter;
 use wcf\system\image\adapter\ImagickImageAdapter;
 use wcf\system\io\File;
 use wcf\system\io\Tar;
@@ -360,26 +361,20 @@ class WCFSetup extends WCF {
                $system['uploadMaxFilesize']['value'] = min(ini_get('upload_max_filesize'), ini_get('post_max_size'));
                $system['uploadMaxFilesize']['result'] = (intval($system['uploadMaxFilesize']['value']) > 0);
                
-               // gdlib version
-               $system['gdLib']['value'] = '0.0.0';
-               if (function_exists('gd_info')) {
-                       $temp = gd_info();
-                       $match = [];
-                       if (preg_match('!([0-9]+\.[0-9]+(?:\.[0-9]+)?)!', $temp['GD Version'], $match)) {
-                               if (preg_match('/^[0-9]+\.[0-9]+$/', $match[1])) $match[1] .= '.0';
-                               $system['gdLib']['value'] = $match[1];
-                       }
+               // graphics library
+               $system['graphicsLibrary']['result'] = false;
+               $system['graphicsLibrary']['value'] = '';
+               if (ImagickImageAdapter::isSupported() && ImagickImageAdapter::supportsAnimatedGIFs(ImagickImageAdapter::getVersion())) {
+                       $system['graphicsLibrary'] = [
+                               'result' => true,
+                               'value' => 'ImageMagick',
+                       ];
                }
-               $system['gdLib']['result'] = (version_compare($system['gdLib']['value'], '2.0.0') >= 0);
-               
-               // ImageMagick
-               $system['imagick'] = ['result' => false];
-               if (ImagickImageAdapter::isSupported()) {
-                       $system['imagick'] = [
+               else if (GDImageAdapter::isSupported()) {
+                       $system['graphicsLibrary'] = [
                                'result' => true,
-                               'value' => ImagickImageAdapter::getVersion(),
+                               'value' => 'GD Library',
                        ];
-                       $system['imagick']['supportsAnimatedGIFs'] = ImagickImageAdapter::supportsAnimatedGIFs($system['imagick']['value']);
                }
                
                // memory limit
index caaccbf4b5a1bd5dc1a45c794b4758a0f9151509..6f8a873c19f568a681c998699d56d17eeb739689 100644 (file)
@@ -478,6 +478,6 @@ class GDImageAdapter implements IImageAdapter {
         * @inheritDoc
         */
        public static function isSupported() {
-               return true;
+               return function_exists('gd_info');
        }
 }
index 5b3e7f035f61e8f995b12cc4bc708071e36245fd..a68f251db71df5e472858669d650ad00e3faf10e 100644 (file)
                <item name="wcf.global.systemRequirements.sql.description"><![CDATA[Ohne die „pdo_mysql“ PHP-Erweiterung kann diese Software nicht installiert werden.]]></item>
                <item name="wcf.global.systemRequirements.uploadMaxFilesize"><![CDATA[Maximale Größe für das Hochladen von Dateien]]></item>
                <item name="wcf.global.systemRequirements.uploadMaxFilesize.description"><![CDATA[Die derzeitige Konfiguration der Skriptsprache „PHP“ macht das Hochladen von Dateien unmöglich. Einige Funktionalitäten werden durch diese Konfiguration nur eingeschränkt funktionieren.]]></item>
-               <item name="wcf.global.systemRequirements.gdLib"><![CDATA[Installierte Version der Grafikbearbeitungs-Bibliothek „gdlib“]]></item>
-               <item name="wcf.global.systemRequirements.gdLib.description"><![CDATA[Grafikbearbeitungs-Bibliothek „gdlib“ ist für die Verarbeitung und dynamische Generierung von Bildern zuständig.]]></item>
-               <item name="wcf.global.systemRequirements.imagick"><![CDATA[Installierte Version der Grafikbearbeitungs-Bibliothek „ImageMagick“]]></item>
-               <item name="wcf.global.systemRequirements.imagick.description"><![CDATA[Grafikbearbeitungs-Bibliothek „ImageMagick“ ist für die Verarbeitung und dynamische Generierung von Bildern zuständig. Unterstützt zusätzlich die Skalierung von animierten GIF-Dateien.]]></item>
-               <item name="wcf.global.systemRequirements.gdLib.notFound"><![CDATA[nicht gefunden]]></item>
+               <item name="wcf.global.systemRequirements.graphicsLibrary"><![CDATA[Grafikbearbeitungs-Bibliothek]]></item>
+               <item name="wcf.global.systemRequirements.graphicsLibrary.requirement"><![CDATA[GD Library oder ImageMagick]]></item>
+               <item name="wcf.global.systemRequirements.graphicsLibrary.description"><![CDATA[Die Grafikbearbeitungs-Bibliothek ist für die Verarbeitung und dynamische Generierung von Bildern zuständig. Es wird die GD Library oder alternativ ImageMagick benötigt.]]></item>
+               <item name="wcf.global.systemRequirements.graphicsLibrary.notFound"><![CDATA[nicht gefunden]]></item>
                <item name="wcf.global.systemRequirements.active"><![CDATA[aktiviert]]></item>
                <item name="wcf.global.systemRequirements.notActive"><![CDATA[nicht aktiviert]]></item>
                <item name="wcf.global.systemRequirements.memoryLimit"><![CDATA[Zur Verfügung stehender Arbeitsspeicher]]></item>
index 85e59c7e29d39553be109b3b7387c021d7c3466c..40933e817af75e79236a1375e4fcc7eee63e0cc0 100644 (file)
                <item name="wcf.global.systemRequirements.sql.description"><![CDATA[The “pdo_mysql” PHP extension is required to install this software.]]></item>
                <item name="wcf.global.systemRequirements.uploadMaxFilesize"><![CDATA[Maximum Size for File Uploads]]></item>
                <item name="wcf.global.systemRequirements.uploadMaxFilesize.description"><![CDATA[The current configuration of the installed “PHP” version does not allow file uploads. Due to this configuration, some features of this software will not be available.]]></item>
-               <item name="wcf.global.systemRequirements.gdLib"><![CDATA[Installed version of the graphics library “GDLib”]]></item>
-               <item name="wcf.global.systemRequirements.gdLib.description"><![CDATA[The graphics-library “GDLib” is needed to read images and for the dynamic image generation.]]></item>
-               <item name="wcf.global.systemRequirements.gdLib.notFound"><![CDATA[not found]]></item>
-               <item name="wcf.global.systemRequirements.imagick"><![CDATA[Installed version of the graphics library “ImageMagick”]]></item>
-               <item name="wcf.global.systemRequirements.imagick.description"><![CDATA[The graphics-library “ImageMagick” is used to read images and for the dynamic image generation. Supports for scaling of animated GIF files.]]></item>
+               <item name="wcf.global.systemRequirements.graphicsLibrary"><![CDATA[Graphics library]]></item>
+               <item name="wcf.global.systemRequirements.graphicsLibrary.requirement"><![CDATA[GD library or ImageMagick]]></item>
+               <item name="wcf.global.systemRequirements.graphicsLibrary.description"><![CDATA[A graphics library is needed to read images and for the dynamic image generation. The GD library or alternatively ImageMagick is required.]]></item>
+               <item name="wcf.global.systemRequirements.graphicsLibrary.notFound"><![CDATA[not found]]></item>
                <item name="wcf.global.systemRequirements.active"><![CDATA[Enabled]]></item>
                <item name="wcf.global.systemRequirements.notActive"><![CDATA[Not enabled]]></item>
                <item name="wcf.global.systemRequirements.memoryLimit"><![CDATA[PHP memory limit]]></item>
index 6a6f44ff7730bd630653fb7406705e328b9978a1..4f8a8a112afa25526ba071232877953da3665296 100644 (file)
                </section>
                
                <section class="section">
-                       <h2 class="sectionTitle">{lang}wcf.global.systemRequirements.gdLib{/lang}</h2>
+                       <h2 class="sectionTitle">{lang}wcf.global.systemRequirements.graphicsLibrary{/lang}</h2>
                        
                        <div class="row rowColGap formGrid">
                                <dl class="col-xs-12 col-md-6">
                                        <dt>{lang}wcf.global.systemRequirements.element.required{/lang}</dt>
-                                       <dd>2.0.0</dd>
+                                       <dd>{lang}wcf.global.systemRequirements.graphicsLibrary.requirement{/lang}</dd>
                                </dl>
                                
                                <dl class="col-xs-12 col-md-6">
                                        <dt>{lang}wcf.global.systemRequirements.element.yours{/lang}</dt>
                                        <dd>
-                                               <span class="badge {if !$system.gdLib.result}red{else}green{/if}">{$system.gdLib.value}</span>
-                                               {if !$system.gdLib.result}<small>{lang}wcf.global.systemRequirements.gdLib.description{/lang}</small>{/if}
+                                               <span class="badge {if !$system.graphicsLibrary.result}red{else}green{/if}">{if !$system.graphicsLibrary.result}{lang}wcf.global.systemRequirements.graphicsLibrary.notFound{/lang}{else}{$system.graphicsLibrary.value}{/if}</span>
+                                               {if !$system.graphicsLibrary.result}<small>{lang}wcf.global.systemRequirements.graphicsLibrary.description{/lang}</small>{/if}
                                        </dd>
                                </dl>
                        </div>
                                </dl>
                        </div>
                </section>
-               
-               <section class="section">
-                       <h2 class="sectionTitle">{lang}wcf.global.systemRequirements.imagick{/lang}</h2>
-                       
-                       <div class="row rowColGap formGrid">
-                               <dl class="col-xs-12 col-md-6">
-                                       <dt>{lang}wcf.global.systemRequirements.element.recommended{/lang}</dt>
-                                       <dd>{lang}wcf.global.systemRequirements.active{/lang}</dd>
-                               </dl>
-                               
-                               <dl class="col-xs-12 col-md-6">
-                                       <dt>{lang}wcf.global.systemRequirements.element.yours{/lang}</dt>
-                                       <dd>
-                                               <span class="badge {if !$system.imagick.result}red{elseif !$system.imagick.supportsAnimatedGIFs}yellow{else}green{/if}">{if !$system.imagick.result}{lang}wcf.global.systemRequirements.notActive{/lang}{else}{$system.imagick.value}{/if}</span>
-                                               {if !$system.imagick.result}<small>{lang}wcf.global.systemRequirements.imagick.description{/lang}</small>{/if}
-                                       </dd>
-                               </dl>
-                       </div>
-               </section>
        </section>
 
        <div class="formSubmit">
-               <input type="submit" value="{lang}wcf.global.button.next{/lang}"{if !$system.phpVersion.result || !$system.sql.result || !$system.memoryLimit.result || (!$system.gdLib.result && !$system.imagick.result)} disabled{/if} accesskey="s">
+               <input type="submit" value="{lang}wcf.global.button.next{/lang}"{if !$system.phpVersion.result || !$system.sql.result || !$system.memoryLimit.result || !$system.graphicsLibrary.result} disabled{/if} accesskey="s">
                <input type="hidden" name="step" value="{@$nextStep}">
                <input type="hidden" name="tmpFilePrefix" value="{@$tmpFilePrefix}">
                <input type="hidden" name="languageCode" value="{@$languageCode}">