Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / config / check / PhabricatorGDSetupCheck.php
blob7ada2048015a402fc4743fbd57bfd4c7aca2dd86
1 <?php
3 final class PhabricatorGDSetupCheck extends PhabricatorSetupCheck {
5 public function getDefaultGroup() {
6 return self::GROUP_OTHER;
9 protected function executeChecks() {
10 if (!extension_loaded('gd')) {
11 $message = pht(
12 "The '%s' extension is not installed. Without '%s', support, ".
13 "Phabricator will not be able to process or resize images ".
14 "(for example, to generate thumbnails). Install or enable '%s'.",
15 'gd',
16 'gd',
17 'gd');
19 $this->newIssue('extension.gd')
20 ->setName(pht("Missing '%s' Extension", 'gd'))
21 ->setMessage($message)
22 ->addPHPExtension('gd');
23 } else {
24 $image_type_map = array(
25 'imagecreatefrompng' => 'PNG',
26 'imagecreatefromgif' => 'GIF',
27 'imagecreatefromjpeg' => 'JPEG',
30 $have = array();
31 foreach ($image_type_map as $function => $image_type) {
32 if (function_exists($function)) {
33 $have[] = $image_type;
37 $missing = array_diff($image_type_map, $have);
38 if ($missing) {
39 $missing = implode(', ', $missing);
40 $have = implode(', ', $have);
42 $message = pht(
43 "The '%s' extension has support for only some image types. ".
44 "Phabricator will be unable to process images of the missing ".
45 "types until you build '%s' with support for them. ".
46 "Supported types: %s. Missing types: %s.",
47 'gd',
48 'gd',
49 $have,
50 $missing);
52 $this->newIssue('extension.gd.support')
53 ->setName(pht("Partial '%s' Support", 'gd'))
54 ->setMessage($message);