1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-01 09:28:22 +01:00
phorge-phorge/src/applications/config/check/PhabricatorGDSetupCheck.php
Chad Little b701313e0e Split Setup Issues into Groups
Summary: Groups setup issues into Important, PHP, MySQL, and Base for easier parsing on initial installations.

Test Plan:
Test my internal server and various issues.

{F289699}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7207

Differential Revision: https://secure.phabricator.com/D11726
2015-02-10 12:53:00 -08:00

52 lines
1.5 KiB
PHP

<?php
final class PhabricatorGDSetupCheck extends PhabricatorSetupCheck {
public function getDefaultGroup() {
return self::GROUP_OTHER;
}
protected function executeChecks() {
if (!extension_loaded('gd')) {
$message = pht(
"The 'gd' extension is not installed. Without 'gd', support, ".
"Phabricator will not be able to process or resize images ".
"(for example, to generate thumbnails). Install or enable 'gd'.");
$this->newIssue('extension.gd')
->setName(pht("Missing 'gd' Extension"))
->setMessage($message);
} else {
$image_type_map = array(
'imagecreatefrompng' => 'PNG',
'imagecreatefromgif' => 'GIF',
'imagecreatefromjpeg' => 'JPEG',
);
$have = array();
foreach ($image_type_map as $function => $image_type) {
if (function_exists($function)) {
$have[] = $image_type;
}
}
$missing = array_diff($image_type_map, $have);
if ($missing) {
$missing = implode(', ', $missing);
$have = implode(', ', $have);
$message = pht(
"The 'gd' extension has support for only some image types. ".
"Phabricator will be unable to process images of the missing ".
"types until you build 'gd' with support for them. ".
"Supported types: %s. Missing types: %s.",
$have,
$missing);
$this->newIssue('extension.gd.support')
->setName(pht("Partial 'gd' Support"))
->setMessage($message);
}
}
}
}