Page MenuHomePhabricator

D10260.diff
No OneTemporary

D10260.diff

diff --git a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php
--- a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php
+++ b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php
@@ -15,6 +15,8 @@
$console = PhutilConsole::getConsole();
$console->getServer()->setEnableLog(true);
+ PhabricatorLDAPAuthProvider::assertLDAPExtensionInstalled();
+
$provider = PhabricatorLDAPAuthProvider::getLDAPProvider();
if (!$provider) {
$console->writeOut(
diff --git a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php
--- a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php
@@ -251,12 +251,26 @@
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(

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 27, 4:05 PM (4 d, 21 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7441841
Default Alt Text
D10260.diff (1 KB)

Event Timeline