Check for the "jpeg" and "png" support of GD
authorAlexander Ebert <ebert@woltlab.com>
Fri, 2 Oct 2020 17:42:11 +0000 (19:42 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 2 Oct 2020 17:42:11 +0000 (19:42 +0200)
wcfsetup/install/files/acp/templates/systemCheck.tpl
wcfsetup/install/files/lib/acp/page/SystemCheckPage.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 15e8e5a3b260c9c4165dc4a8afbf6ebcfcaede38..92a36ee03491071197ba9e3a5abcc88bde5af4fa 100644 (file)
                        <small>{lang}wcf.acp.systemCheck.php.sha256.description{/lang}</small>
                </dd>
        </dl>
+       
+       <dl{if !$results[php][gd][result]} class="formError"{/if}>
+               <dt>{lang}wcf.acp.systemCheck.php.gd{/lang}</dt>
+               <dd>
+                       {if $results[php][gd][result]}
+                               {@$statusOk} {lang}wcf.acp.systemCheck.pass{/lang}
+                       {else}
+                               <ul class="nativeList">
+                                       {if !$results[php][gd][jpeg]}
+                                               <li>{@$statusInsufficient} <kbd>jpeg</kbd></li>
+                                       {/if}
+                                       {if !$results[php][gd][png]}
+                                               <li>{@$statusInsufficient} <kbd>png</kbd></li>
+                                       {/if}
+                               </ul>
+                       {/if}
+                       <small>{lang}wcf.acp.systemCheck.php.gd.description{/lang}</small>
+               </dd>
+       </dl>
 </section>
 
 <section class="section">
index e21129cc1cc20699febca45b9907f51327a68732..f61595a05b42f8f840ec1a34ceafd53c0fc344a2 100644 (file)
@@ -92,33 +92,33 @@ class SystemCheckPage extends AbstractPage {
                'wcf'. WCF_N .'_user' => [
                        'avatarID' => [
                                'referenceTable' => 'wcf'. WCF_N .'_user_avatar',
-                               'referenceColumn' => 'avatarID'
-                       ]
+                               'referenceColumn' => 'avatarID',
+                       ],
                ],
                'wcf'. WCF_N .'_comment' => [
                        'userID' => [
                                'referenceTable' => 'wcf'. WCF_N .'_user',
-                               'referenceColumn' => 'userID'
+                               'referenceColumn' => 'userID',
                        ],
                        'objectTypeID' => [
                                'referenceTable' => 'wcf'. WCF_N .'_object_type',
-                               'referenceColumn' => 'objectTypeID'
-                       ]
+                               'referenceColumn' => 'objectTypeID',
+                       ],
                ],
                'wcf'. WCF_N .'_moderation_queue' => [
                        'objectTypeID' => [
                                'referenceTable' => 'wcf'. WCF_N .'_object_type',
-                               'referenceColumn' => 'objectTypeID'
+                               'referenceColumn' => 'objectTypeID',
                        ],
                        'assignedUserID' => [
                                'referenceTable' => 'wcf'. WCF_N .'_user',
-                               'referenceColumn' => 'userID'
+                               'referenceColumn' => 'userID',
                        ],
                        'userID' => [
                                'referenceTable' => 'wcf'. WCF_N .'_user',
-                               'referenceColumn' => 'userID'
-                       ]
-               ]
+                               'referenceColumn' => 'userID',
+                       ],
+               ],
        ];
        
        public $results = [
@@ -131,10 +131,15 @@ class SystemCheckPage extends AbstractPage {
                        'foreignKeys' => false,
                        'searchEngine' => [
                                'result' => false, 
-                               'incorrectTables' => []
+                               'incorrectTables' => [],
                        ],
                ],
                'php' => [
+                       'gd' => [
+                               'jpeg' => false,
+                               'png' => false,
+                               'result' => false,
+                       ],
                        'extension' => [],
                        'memoryLimit' => [
                                'required' => '0',
@@ -181,6 +186,7 @@ class SystemCheckPage extends AbstractPage {
                $this->validatePhpExtensions();
                $this->validatePhpMemoryLimit();
                $this->validatePhpVersion();
+               $this->validatePhpGdSupport();
                $this->validateWritableDirectories();
        }
        
@@ -382,6 +388,21 @@ class SystemCheckPage extends AbstractPage {
                $this->results['status']['php'] = $this->results['status']['php'] && ($this->results['php']['version']['result'] !== 'unsupported');
        }
        
+       protected function validatePhpGdSupport() {
+               if (!function_exists('\gd_info')) {
+                       $this->results['status']['php'] = false;
+                       return;
+               }
+               
+               $gdInfo = \gd_info();
+               $this->results['php']['gd']['jpeg'] = !empty($gdInfo['JPEG Support']);
+               $this->results['php']['gd']['png'] = !empty($gdInfo['PNG Support']);
+               
+               $this->results['php']['gd']['result'] = $this->results['php']['gd']['jpeg'] && $this->results['php']['gd']['png'];
+               
+               $this->results['status']['php'] = $this->results['status']['php'] && $this->results['php']['gd']['result'];
+       }
+       
        protected function validateWritableDirectories() {
                foreach ($this->directories as $abbreviation => $directories) {
                        $basePath = Application::getDirectory($abbreviation);
index e2093080ca480ca100fe5fa884dbd54e78c1d05b..c47feb9794e78f5d458f02da1bb04c459930e7d1 100644 (file)
@@ -2767,6 +2767,8 @@ Kein Abschnitt darf leer sein und alle Abschnitten dürfen nur folgende Zeichen
                <item name="wcf.acp.systemCheck.mysql.innodb.description"><![CDATA[InnoDB (XtraDB unter MariaDB) ist eine transaktionale Storage-Engine von MySQL und wird zwingend für den Betrieb benötigt. Dies ist eine Standardfunktion von MySQL.]]></item>
                <item name="wcf.acp.systemCheck.directories.writable"><![CDATA[Beschreibbare Verzeichnisse]]></item>
                <item name="wcf.acp.systemCheck.directories.writable.description"><![CDATA[Einige Verzeichnisse werden zur Laufzeit durch die Software beschrieben, der PHP-Benutzer muss Schreibrechte haben.]]></item>
+               <item name="wcf.acp.systemCheck.php.gd"><![CDATA[Unterstützte Formate der GD-Bibliothek]]></item>
+               <item name="wcf.acp.systemCheck.php.gd.description"><![CDATA[Die GD-Bibliothek muss inklusive der Unterstützung der Formate „jpeg“ und „png“ installiert sein.]]></item>
        </category>
        <category name="wcf.acp.updateServer">
                <item name="wcf.acp.updateServer.add"><![CDATA[Server hinzufügen]]></item>
index aa3feaa28cb95c587e30ee97676575d9f8f56052..08dd7f44bdf0958ce7fccaf1674b680e96a7adb5 100644 (file)
@@ -2694,6 +2694,8 @@ If you have <strong>already bought the licenses for the listed apps</strong>, th
                <item name="wcf.acp.systemCheck.mysql.innodb.description"><![CDATA[InnoDB (XtraDB when using MariaDB) is a transaction storage engine for MySQL and is required for the operation of the software. This is a built-in feature of MySQL.]]></item>
                <item name="wcf.acp.systemCheck.directories.writable"><![CDATA[Writable Directories]]></item>
                <item name="wcf.acp.systemCheck.directories.writable.description"><![CDATA[Some directories are being written to during the normal operation. The user that runs the PHP process must have write access.]]></item>
+               <item name="wcf.acp.systemCheck.php.gd"><![CDATA[Supported formats of the GD library]]></item>
+               <item name="wcf.acp.systemCheck.php.gd.description"><![CDATA[The GD library must be installed with support for the formats “jpeg” and “png”.]]></item>
        </category>
        <category name="wcf.acp.updateServer">
                <item name="wcf.acp.updateServer.add"><![CDATA[Add Server]]></item>