1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 00:02:41 +01:00
phorge-phorge/src/applications/config/check/PhabricatorSetupCheckExtensions.php
epriestley 24845bec42 Port extension checks to new-style setup
Summary:
  - Allow new-style setup to raise fatal setup errors.
  - Port extension checks to new-style setup as fatal errors.
  - When fatal errors are raised, abort setup and show them in a chrome-free response.

Test Plan: {F29981}

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2228

Differential Revision: https://secure.phabricator.com/D4587
2013-01-22 15:16:26 -08:00

50 lines
1.2 KiB
PHP

<?php
final class PhabricatorSetupCheckExtensions extends PhabricatorSetupCheck {
public function getExecutionOrder() {
return 0;
}
protected function executeChecks() {
// TODO: Require 'mysql' OR 'mysqli'.
// TODO: Make 'mbstring' and 'iconv' soft requirements.
// TODO: Make 'curl' a soft requirement.
$required = array(
'mysql',
'hash',
'json',
'openssl',
'mbstring',
'iconv',
// There is a chance we might not need this, but some configurations (like
// OAuth or Amazon SES) will require it. Just mark it 'required' since
// it's widely available and relatively core.
'curl',
);
$need = array();
foreach ($required as $extension) {
if (!extension_loaded($extension)) {
$need[] = $extension;
}
}
if (!$need) {
return;
}
$message = pht('Required PHP extensions are not installed.');
$issue = $this->newIssue('php.extensions')
->setIsFatal(true)
->setName(pht('Missing Required Extensions'))
->setMessage($message);
foreach ($need as $extension) {
$issue->addPHPExtension($extension);
}
}
}