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.
|
* or delete.
|
||||||
* (OLD values are IGNORED, we will have got them when we build this object from the LDAP server DN.)
|
* (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'))
|
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||||
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
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))));
|
$rdnarray = rdn_explode(strtolower(get_rdn(dn_escape($this->dn))));
|
||||||
|
|
||||||
$counter = 1;
|
$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.
|
# We ignore DNs.
|
||||||
if ($attr == 'dn')
|
if ($attr == 'dn')
|
||||||
continue;
|
continue;
|
||||||
|
@ -2001,7 +2001,7 @@ class ldap extends DS {
|
|||||||
* @see getDNSysAttrs
|
* @see getDNSysAttrs
|
||||||
* @see getDNAttrValue
|
* @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'))
|
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||||
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||||
|
|
||||||
@ -2017,7 +2017,7 @@ class ldap extends DS {
|
|||||||
elseif (in_array('*',$attrs))
|
elseif (in_array('*',$attrs))
|
||||||
$cacheindex = '*';
|
$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];
|
$results = $CACHE[$this->index][$method][$dn][$cacheindex];
|
||||||
|
|
||||||
if (DEBUG_ENABLED)
|
if (DEBUG_ENABLED)
|
||||||
|
@ -215,7 +215,7 @@ class ImportLDIF extends Import {
|
|||||||
return $this->error(sprintf('%s %s',_('DN does not exist'),$dn),$lines);
|
return $this->error(sprintf('%s %s',_('DN does not exist'),$dn),$lines);
|
||||||
|
|
||||||
$this->template->setDN($dn);
|
$this->template->setDN($dn);
|
||||||
$this->template->accept();
|
$this->template->accept(false,true);
|
||||||
|
|
||||||
return $this->getModifyDetails($lines);
|
return $this->getModifyDetails($lines);
|
||||||
|
|
||||||
@ -511,7 +511,7 @@ class ImportLDIF extends Import {
|
|||||||
case 'delete':
|
case 'delete':
|
||||||
$deleteattr = false;
|
$deleteattr = false;
|
||||||
|
|
||||||
if ($key = array_search($attribute_value_part,$attribute->getValues()))
|
if (($key = array_search($attribute_value_part,$attribute->getValues())) !== false)
|
||||||
$attribute->delValue($key);
|
$attribute->delValue($key);
|
||||||
else
|
else
|
||||||
return $this->error(sprintf('%s %s',_('Delete value doesnt exist in DN'),$attribute_value_part),
|
return $this->error(sprintf('%s %s',_('Delete value doesnt exist in DN'),$attribute_value_part),
|
||||||
|
Loading…
Reference in New Issue
Block a user