1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Surface a better warning when the LDAP extension is not installed

Summary:
Fixes T3347. We can't really do this one as a config thing since we don't know if the user wants to use LDAP.

Instead, just give them a better message than they otherwise get when they try to install/configure/use LDAP.

Test Plan: Faked it and got a reasonable message.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T3347

Differential Revision: https://secure.phabricator.com/D10260
This commit is contained in:
epriestley 2014-08-13 15:37:30 -07:00
parent c740d554f6
commit ef0460c1ff
2 changed files with 16 additions and 0 deletions

View file

@ -15,6 +15,8 @@ final class PhabricatorAuthManagementLDAPWorkflow
$console = PhutilConsole::getConsole();
$console->getServer()->setEnableLog(true);
PhabricatorLDAPAuthProvider::assertLDAPExtensionInstalled();
$provider = PhabricatorLDAPAuthProvider::getLDAPProvider();
if (!$provider) {
$console->writeOut(

View file

@ -251,12 +251,26 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider {
return array($errors, $issues, $values);
}
public static function assertLDAPExtensionInstalled() {
if (!function_exists('ldap_bind')) {
throw new Exception(
pht(
'Before you can set up or use LDAP, you need to install the PHP '.
'LDAP extension. It is not currently installed, so PHP can not '.
'talk to LDAP. Usually you can install it with '.
'`yum install php-ldap`, `apt-get install php5-ldap`, or a '.
'similar package manager command.'));
}
}
public function extendEditForm(
AphrontRequest $request,
AphrontFormView $form,
array $values,
array $issues) {
self::assertLDAPExtensionInstalled();
$labels = $this->getPropertyLabels();
$captions = array(