Skip to content
Snippets Groups Projects
Commit 5f1b7d01 authored by kevin.dezaphi's avatar kevin.dezaphi
Browse files

FEAT #7539 correct ldap connection and update migration script

parent 76a2233a
No related branches found
No related tags found
No related merge requests found
...@@ -140,10 +140,6 @@ if (!empty($_SESSION['error'])) { ...@@ -140,10 +140,6 @@ if (!empty($_SESSION['error'])) {
$xpLdapConf = new domxpath($ldapConf); $xpLdapConf = new domxpath($ldapConf);
$ldapConfig = simplexml_load_file($pathtoConfig); $ldapConfig = simplexml_load_file($pathtoConfig);
// foreach ($xpLdapConf->query('/root/config/*') as $cf) {
// ${$cf->nodeName} = $cf->nodeValue;
// }
foreach ($ldapConfig->config->ldap as $ldap) { foreach ($ldapConfig->config->ldap as $ldap) {
$_SESSION['error'] = ''; $_SESSION['error'] = '';
foreach ($ldap as $node => $value) { foreach ($ldap as $node => $value) {
...@@ -197,7 +193,7 @@ if (!empty($_SESSION['error'])) { ...@@ -197,7 +193,7 @@ if (!empty($_SESSION['error'])) {
continue; continue;
} else { } else {
echo functions::xssafe($conFailure->getMessage()); echo functions::xssafe($conFailure->getMessage());
exit; continue;
} }
} }
......
...@@ -39,11 +39,28 @@ foreach ($customs as $custom) { ...@@ -39,11 +39,28 @@ foreach ($customs as $custom) {
} }
if (file_exists("custom/{$custom}/modules/ldap/xml/config.xml")) { if (file_exists("custom/{$custom}/modules/ldap/xml/config.xml")) {
$configXmlfile = simplexml_load_file("custom/{$custom}/modules/ldap/xml/config.xml"); $dom = new DOMDocument();
$dom->formatOutput = true;
$configXmlfile->config->addChild('standardConnect', 'false'); $dom->load("custom/{$custom}/modules/ldap/xml/config.xml");
$res = $configXmlfile->asXML(); $config = $dom->getElementsByTagName('config')[0];
$saveNodes = [];
foreach ($config->childNodes as $node) {
$saveNodes[] = $node;
}
while ($config->hasChildNodes()) {
$config->removeChild($config->firstChild);
}
$ldap = $dom->createElement('ldap');
foreach ($saveNodes as $node) {
$ldap->appendChild($node);
}
$ldap->appendChild($dom->createElement('standardConnect', 'false'));
$config->appendChild($ldap);
$res = $dom->saveXML($dom, LIBXML_NOEMPTYTAG);
$fp = @fopen("custom/{$custom}/modules/ldap/xml/config.xml", "w+"); $fp = @fopen("custom/{$custom}/modules/ldap/xml/config.xml", "w+");
if ($fp) { if ($fp) {
fwrite($fp, $res); fwrite($fp, $res);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment