SF Bug #3398344 - Import LDIF overwrites entries
This commit is contained in:
parent
d8ab7fc2f0
commit
1e1fcabb3d
@ -258,7 +258,7 @@ class Template extends xmlTemplate {
|
||||
* or delete.
|
||||
* (OLD values are IGNORED, we will have got them when we build this object from the LDAP server DN.)
|
||||
*/
|
||||
public function accept($makeVisible=false) {
|
||||
public function accept($makeVisible=false,$nocache=false) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
@ -275,7 +275,7 @@ class Template extends xmlTemplate {
|
||||
$rdnarray = rdn_explode(strtolower(get_rdn(dn_escape($this->dn))));
|
||||
|
||||
$counter = 1;
|
||||
foreach ($server->getDNAttrValues($this->dn,null,LDAP_DEREF_NEVER,array_merge(array('*'),$server->getValue('server','custom_attrs'))) as $attr => $values) {
|
||||
foreach ($server->getDNAttrValues($this->dn,null,LDAP_DEREF_NEVER,array_merge(array('*'),$server->getValue('server','custom_attrs')),$nocache) as $attr => $values) {
|
||||
# We ignore DNs.
|
||||
if ($attr == 'dn')
|
||||
continue;
|
||||
|
@ -2001,7 +2001,7 @@ class ldap extends DS {
|
||||
* @see getDNSysAttrs
|
||||
* @see getDNAttrValue
|
||||
*/
|
||||
public function getDNAttrValues($dn,$method=null,$deref=LDAP_DEREF_NEVER,$attrs=array('*','+')) {
|
||||
public function getDNAttrValues($dn,$method=null,$deref=LDAP_DEREF_NEVER,$attrs=array('*','+'),$nocache=false) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
@ -2017,7 +2017,7 @@ class ldap extends DS {
|
||||
elseif (in_array('*',$attrs))
|
||||
$cacheindex = '*';
|
||||
|
||||
if (! is_null($cacheindex) && isset($CACHE[$this->index][$method][$dn][$cacheindex])) {
|
||||
if (! $nocache && ! is_null($cacheindex) && isset($CACHE[$this->index][$method][$dn][$cacheindex])) {
|
||||
$results = $CACHE[$this->index][$method][$dn][$cacheindex];
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
|
@ -215,7 +215,7 @@ class ImportLDIF extends Import {
|
||||
return $this->error(sprintf('%s %s',_('DN does not exist'),$dn),$lines);
|
||||
|
||||
$this->template->setDN($dn);
|
||||
$this->template->accept();
|
||||
$this->template->accept(false,true);
|
||||
|
||||
return $this->getModifyDetails($lines);
|
||||
|
||||
@ -511,7 +511,7 @@ class ImportLDIF extends Import {
|
||||
case 'delete':
|
||||
$deleteattr = false;
|
||||
|
||||
if ($key = array_search($attribute_value_part,$attribute->getValues()))
|
||||
if (($key = array_search($attribute_value_part,$attribute->getValues())) !== false)
|
||||
$attribute->delValue($key);
|
||||
else
|
||||
return $this->error(sprintf('%s %s',_('Delete value doesnt exist in DN'),$attribute_value_part),
|
||||
|
Loading…
Reference in New Issue
Block a user