summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 77cc69e)
raw | patch | inline | side by side (parent: 77cc69e)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 13 Feb 2006 13:30:38 +0000 (13:30 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 13 Feb 2006 13:30:38 +0000 (13:30 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2677 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_plugin.inc | patch | blob | history |
index ac449d59fd60bd5ee5bcbe84d1d1894f0554c608..fc553bf764d294b08d7fbeb0a6f531bc45ec488f 100644 (file)
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
function cleanup()
{
- /* Clean up */
foreach ($this->attrs as $index => $value){
+
+ /* Remove emtpy arrays if they do not differ */
if (is_array($this->attrs[$index]) && count($this->attrs[$index]) == 0 && !isset($this->saved_attributes[$index])){
unset ($this->attrs[$index]);
continue;
}
+ /* Remove single attributes that do not differ */
if (!is_array($this->attrs[$index]) && isset($this->saved_attributes[$index])
&& !is_array($this->saved_attributes[$index]) && $value == $this->saved_attributes[$index]){
unset ($this->attrs[$index]);
continue;
}
- /* Array checks */
- if(is_array($this->attrs[$index]) && isset($this->saved_attributes[$index]) && is_array($this->saved_attributes[$index])){
-
- /* Different number of elements, so this attribute has changed
- We must do this, because array_diff only shows differnces between
- array1 -> array2
- and not
- array2 -> array1
- */
- if(count($this->attrs[$index])!= count($this->saved_attributes[$index])){
- continue;
- }elseif(
-
- /* Same number of elements, so we must check if all elements contain the same value
- */
- count(
- array_diff(
- array_change_key_case(
- array_flip(
- $this->attrs[$index]),
- CASE_UPPER),
- array_change_key_case(
- array_flip(
- $this->saved_attributes[$index]),
- CASE_UPPER)
- )
- ) ==0
- ){
+ /* Remove arrays that do not differ */
+ if (is_array($this->attrs[$index]) && isset($this->saved_attributes[$index]) && is_array($this->saved_attributes[$index])){
+ $dst= $this->attrs[$index];
+ $src= $this->saved_attributes[$index];
+ sort($dst);
+ sort($src);
+ if (count(array_diff($src, $dst))==0 ){
unset ($this->attrs[$index]);
continue;
- }
- }
-
- /* Check for this combination, one value is an array and one is string.
- Both contain the same value (nothing changed).
-
- Example : check for
- $this->attrs['name']= "test";
- $this->saved_attributes['name'][0]= "test";
-
- noting changed, but one is string and one is array;
- */
- if(is_array($this->attrs[$index])&& count($this->attrs[$index])==1 && isset($this->saved_attributes[$index]) && (!is_array($this->saved_attributes[$index])) && $this->attrs[$index][0] == $this->saved_attributes[$index]){
- unset ($this->attrs[$index]);
+ }
}
}
#######################################################
- ; echo "--- DEBUG: changes ---<b>".get_class($this)."</b><br>" ;
+ ; echo "--- DEBUG: changes ---<br>" ;
; print_a ($this->attrs) ;
; if (count($this->attrs)==0)echo "<b>Skipped</b><br>";
#######################################################