performance fixes
This commit is contained in:
parent
4d3b81881a
commit
3d8c0e7dcc
|
@ -1471,7 +1471,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->addSimpleReadOnlyField($fieldContainer, 'title', _('Job title'));
|
$this->addSimpleReadOnlyField($fieldContainer, 'title', _('Job title'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'title', _('Job title'), false, null, false, null, null, $equalWidthElements);
|
$this->addMultiValueInputTextField($fieldContainer, 'title', _('Job title'), false, null, false, array_slice($this->titleCache, 0, 300), null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideCarLicense')) {
|
||||||
|
@ -1497,7 +1497,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->addSimpleReadOnlyField($fieldContainer, 'employeeType', _('Employee type'));
|
$this->addSimpleReadOnlyField($fieldContainer, 'employeeType', _('Employee type'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->addSimpleInputTextField($fieldContainer, 'employeeType', _('Employee type'), false, null, false, $this->employeeTypeCache);
|
$this->addSimpleInputTextField($fieldContainer, 'employeeType', _('Employee type'), false, null, false, array_slice($this->employeeTypeCache, 0, 300));
|
||||||
$equalWidthElements[] = 'employeeType';
|
$equalWidthElements[] = 'employeeType';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1506,7 +1506,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->addSimpleReadOnlyField($fieldContainer, 'businessCategory', _('Business category'));
|
$this->addSimpleReadOnlyField($fieldContainer, 'businessCategory', _('Business category'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'businessCategory', _('Business category'), false, null, false, $this->businessCategoryCache, null, $equalWidthElements);
|
$this->addMultiValueInputTextField($fieldContainer, 'businessCategory', _('Business category'), false, null, false, array_slice($this->businessCategoryCache, 0, 300), null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) {
|
if (!$this->isBooleanConfigOptionSet('inetOrgPerson_hideDepartments')) {
|
||||||
|
@ -1514,7 +1514,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->addSimpleReadOnlyField($fieldContainer, 'departmentNumber', _('Department'));
|
$this->addSimpleReadOnlyField($fieldContainer, 'departmentNumber', _('Department'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'departmentNumber', _('Department'), false, null, false, $this->departmentCache, null, $equalWidthElements);
|
$this->addMultiValueInputTextField($fieldContainer, 'departmentNumber', _('Department'), false, null, false, array_slice($this->departmentCache, 0, 300), null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// organisational unit
|
// organisational unit
|
||||||
|
@ -1523,7 +1523,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->addSimpleReadOnlyField($fieldContainer, 'ou', _('Organisational unit'));
|
$this->addSimpleReadOnlyField($fieldContainer, 'ou', _('Organisational unit'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'ou', _('Organisational unit'), false, null, false, $this->ouCache, null, $equalWidthElements);
|
$this->addMultiValueInputTextField($fieldContainer, 'ou', _('Organisational unit'), false, null, false, array_slice($this->ouCache, 0, 300), null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// organisation
|
// organisation
|
||||||
|
@ -1532,7 +1532,7 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$this->addSimpleReadOnlyField($fieldContainer, 'o', _('Organisation'));
|
$this->addSimpleReadOnlyField($fieldContainer, 'o', _('Organisation'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->addMultiValueInputTextField($fieldContainer, 'o', _('Organisation'), false, null, false, $this->oCache, null, $equalWidthElements);
|
$this->addMultiValueInputTextField($fieldContainer, 'o', _('Organisation'), false, null, false, array_slice($this->oCache, 0, 300), null, $equalWidthElements);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// user certificates
|
// user certificates
|
||||||
|
@ -2438,10 +2438,11 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$temp['counter']++;
|
$temp['counter']++;
|
||||||
if ($temp['counter'] < (sizeof($data) - 1)) {
|
$dataSize = sizeof($data);
|
||||||
|
if ($temp['counter'] < ($dataSize - 1)) {
|
||||||
return array (
|
return array (
|
||||||
'status' => 'inProgress',
|
'status' => 'inProgress',
|
||||||
'progress' => ($temp['counter'] * 100) / sizeof($data),
|
'progress' => ($temp['counter'] * 100) / $dataSize,
|
||||||
'errors' => $errors
|
'errors' => $errors
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3471,22 +3472,34 @@ class inetOrgPerson extends baseModule implements passwordService {
|
||||||
$result = searchLDAPByFilter('(objectClass=inetOrgPerson)', $attrs, array($this->get_scope()));
|
$result = searchLDAPByFilter('(objectClass=inetOrgPerson)', $attrs, array($this->get_scope()));
|
||||||
foreach ($result as $attributes) {
|
foreach ($result as $attributes) {
|
||||||
if (isset($attributes['departmentnumber'])) {
|
if (isset($attributes['departmentnumber'])) {
|
||||||
$departments = array_merge($departments, $attributes['departmentnumber']);
|
foreach ($attributes['departmentnumber'] as $val) {
|
||||||
|
$departments[] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($attributes['ou'])) {
|
if (isset($attributes['ou'])) {
|
||||||
$ous = array_merge($ous, $attributes['ou']);
|
foreach ($attributes['ou'] as $val) {
|
||||||
|
$ous[] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($attributes['o'])) {
|
if (isset($attributes['o'])) {
|
||||||
$os = array_merge($os, $attributes['o']);
|
foreach ($attributes['o'] as $val) {
|
||||||
|
$os[] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($attributes['title'])) {
|
if (isset($attributes['title'])) {
|
||||||
$titles = array_merge($titles, $attributes['title']);
|
foreach ($attributes['title'] as $val) {
|
||||||
|
$titles[] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($attributes['employeetype'])) {
|
if (isset($attributes['employeetype'])) {
|
||||||
$employeeTypes = array_merge($employeeTypes, $attributes['employeetype']);
|
foreach ($attributes['employeetype'] as $val) {
|
||||||
|
$employeeTypes[] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($attributes['businesscategory'])) {
|
if (isset($attributes['businesscategory'])) {
|
||||||
$businessCategories = array_merge($businessCategories, $attributes['businesscategory']);
|
foreach ($attributes['businesscategory'] as $val) {
|
||||||
|
$businessCategories[] = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2269,30 +2269,30 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
$gonMap[$attr['cn'][0]] = $dn;
|
$gonMap[$attr['cn'][0]] = $dn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ($i = 0; $i < sizeof($data); $i++) {
|
foreach ($data as $i => $dataRow) {
|
||||||
if (in_array($i, $failed)) continue; // ignore failed accounts
|
if (in_array($i, $failed)) continue; // ignore failed accounts
|
||||||
if ($data[$i][$col] != "") {
|
if ($dataRow[$col] != "") {
|
||||||
$groups = explode(",", $data[$i][$col]);
|
$groups = explode(",", $dataRow[$col]);
|
||||||
if (isset($this->moduleSettings['posixAccount_primaryGroupAsSecondary'][0])
|
if (isset($this->moduleSettings['posixAccount_primaryGroupAsSecondary'][0])
|
||||||
&& ($this->moduleSettings['posixAccount_primaryGroupAsSecondary'][0] == 'true')) {
|
&& ($this->moduleSettings['posixAccount_primaryGroupAsSecondary'][0] == 'true')) {
|
||||||
if (get_preg($data[$i][$ids['posixAccount_group']], 'digit')) {
|
if (get_preg($dataRow[$ids['posixAccount_group']], 'digit')) {
|
||||||
if (!in_array($groupMap[$data[$i][$ids['posixAccount_group']]], $groups)) {
|
if (!in_array($groupMap[$dataRow[$ids['posixAccount_group']]], $groups)) {
|
||||||
$groups[] = $groupMap[$data[$i][$ids['posixAccount_group']]];
|
$groups[] = $groupMap[$dataRow[$ids['posixAccount_group']]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!in_array($groupMap[$data[$i][$ids['posixAccount_group']]], $groups)) {
|
if (!in_array($groupMap[$dataRow[$ids['posixAccount_group']]], $groups)) {
|
||||||
$groups[] = $data[$i][$ids['posixAccount_group']];
|
$groups[] = $dataRow[$ids['posixAccount_group']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for ($g = 0; $g < sizeof($groups); $g++) {
|
for ($g = 0; $g < sizeof($groups); $g++) {
|
||||||
if (!in_array($groups[$g], $temp['groups'])) $temp['groups'][] = $groups[$g];
|
if (!in_array($groups[$g], $temp['groups'])) $temp['groups'][] = $groups[$g];
|
||||||
$temp['members'][$groups[$g]][] = $data[$i][$ids['posixAccount_userName']];
|
$temp['members'][$groups[$g]][] = $dataRow[$ids['posixAccount_userName']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($ids['posixAccount_gon']) && ($data[$i][$ids['posixAccount_gon']] != "")) {
|
if (isset($ids['posixAccount_gon']) && ($dataRow[$ids['posixAccount_gon']] != "")) {
|
||||||
$gons = explode(",", $data[$i][$ids['posixAccount_gon']]);
|
$gons = explode(",", $dataRow[$ids['posixAccount_gon']]);
|
||||||
$memberAttr = 'member';
|
$memberAttr = 'member';
|
||||||
for ($g = 0; $g < sizeof($gons); $g++) {
|
for ($g = 0; $g < sizeof($gons); $g++) {
|
||||||
if (in_array('groupOfUniqueNames', $gonList[$gonMap[$gons[$g]]]['objectclass'])) {
|
if (in_array('groupOfUniqueNames', $gonList[$gonMap[$gons[$g]]]['objectclass'])) {
|
||||||
|
@ -2301,7 +2301,7 @@ class posixAccount extends baseModule implements passwordService {
|
||||||
$temp['dn_gon'][$gonMap[$gons[$g]]][$memberAttr][] = $accounts[$i]['dn'];
|
$temp['dn_gon'][$gonMap[$gons[$g]]][$memberAttr][] = $accounts[$i]['dn'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($data[$i][$col_home] != "") {
|
if ($dataRow[$col_home] != "") {
|
||||||
$temp['createHomes'][] = $i;
|
$temp['createHomes'][] = $i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ if ($_FILES['inputfile'] && ($_FILES['inputfile']['size'] > 0)) {
|
||||||
$account_dn = $data[$i][$ids['dn_rdn']] . "=" . $account[$data[$i][$ids['dn_rdn']]] . ",";
|
$account_dn = $data[$i][$ids['dn_rdn']] . "=" . $account[$data[$i][$ids['dn_rdn']]] . ",";
|
||||||
if ($data[$i][$ids['dn_suffix']] == "") $account_dn = $account_dn . $suffix;
|
if ($data[$i][$ids['dn_suffix']] == "") $account_dn = $account_dn . $suffix;
|
||||||
else $account_dn = $account_dn . $data[$i][$ids['dn_suffix']];
|
else $account_dn = $account_dn . $data[$i][$ids['dn_suffix']];
|
||||||
$account['dn'] = $account_dn;
|
$accounts[$i]['dn'] = $account_dn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// print errors if DN could not be built
|
// print errors if DN could not be built
|
||||||
|
|
Loading…
Reference in New Issue