From: Marcel Werk Date: Sat, 8 Feb 2020 19:46:42 +0000 (+0100) Subject: Improve the system check during WCFSetup in regards to the graphics library X-Git-Tag: 5.2.3~39^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5e3aefb5028bd032ae3949a5a49af4918ea26270;p=GitHub%2FWoltLab%2FWCF.git Improve the system check during WCFSetup in regards to the graphics library Closes #3154 --- diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index 55c5490178..a2f525ca3b 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -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 diff --git a/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php b/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php index caaccbf4b5..6f8a873c19 100644 --- a/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php +++ b/wcfsetup/install/files/lib/system/image/adapter/GDImageAdapter.class.php @@ -478,6 +478,6 @@ class GDImageAdapter implements IImageAdapter { * @inheritDoc */ public static function isSupported() { - return true; + return function_exists('gd_info'); } } diff --git a/wcfsetup/setup/lang/setup_de.xml b/wcfsetup/setup/lang/setup_de.xml index 5b3e7f035f..a68f251db7 100644 --- a/wcfsetup/setup/lang/setup_de.xml +++ b/wcfsetup/setup/lang/setup_de.xml @@ -28,11 +28,10 @@ - - - - - + + + + diff --git a/wcfsetup/setup/lang/setup_en.xml b/wcfsetup/setup/lang/setup_en.xml index 85e59c7e29..40933e817a 100644 --- a/wcfsetup/setup/lang/setup_en.xml +++ b/wcfsetup/setup/lang/setup_en.xml @@ -28,11 +28,10 @@ - - - - - + + + + diff --git a/wcfsetup/setup/template/stepShowSystemRequirements.tpl b/wcfsetup/setup/template/stepShowSystemRequirements.tpl index 6a6f44ff77..4f8a8a112a 100644 --- a/wcfsetup/setup/template/stepShowSystemRequirements.tpl +++ b/wcfsetup/setup/template/stepShowSystemRequirements.tpl @@ -65,19 +65,19 @@
-

{lang}wcf.global.systemRequirements.gdLib{/lang}

+

{lang}wcf.global.systemRequirements.graphicsLibrary{/lang}

{lang}wcf.global.systemRequirements.element.required{/lang}
-
2.0.0
+
{lang}wcf.global.systemRequirements.graphicsLibrary.requirement{/lang}
{lang}wcf.global.systemRequirements.element.yours{/lang}
- {$system.gdLib.value} - {if !$system.gdLib.result}{lang}wcf.global.systemRequirements.gdLib.description{/lang}{/if} + {if !$system.graphicsLibrary.result}{lang}wcf.global.systemRequirements.graphicsLibrary.notFound{/lang}{else}{$system.graphicsLibrary.value}{/if} + {if !$system.graphicsLibrary.result}{lang}wcf.global.systemRequirements.graphicsLibrary.description{/lang}{/if}
@@ -127,29 +127,10 @@
- -
-

{lang}wcf.global.systemRequirements.imagick{/lang}

- -
-
-
{lang}wcf.global.systemRequirements.element.recommended{/lang}
-
{lang}wcf.global.systemRequirements.active{/lang}
-
- -
-
{lang}wcf.global.systemRequirements.element.yours{/lang}
-
- {if !$system.imagick.result}{lang}wcf.global.systemRequirements.notActive{/lang}{else}{$system.imagick.value}{/if} - {if !$system.imagick.result}{lang}wcf.global.systemRequirements.imagick.description{/lang}{/if} -
-
-
-
- +