From 8f7e5176629d0d3d73342381241c80826fd5cf8d Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 7 Apr 2011 14:33:36 +0000 Subject: [PATCH] #Updated remoteObject class git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20664 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_remoteObject.inc | 38 +++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/gosa-core/include/class_remoteObject.inc b/gosa-core/include/class_remoteObject.inc index 4281d2781..af03c423f 100644 --- a/gosa-core/include/class_remoteObject.inc +++ b/gosa-core/include/class_remoteObject.inc @@ -165,14 +165,20 @@ class remoteObject * @param Mixed The new value for the property. * @return Boolean true on success else false. */ - function __setProperty($name, $value) + function __setProperty($name, $value, $forceSave = FALSE) { - $this->rpcHandle->setObjectProperty($this->ref_id, $name,$value); - if($this->rpcHandle->success()){ + if($this->directStorage || $forceSave){ + $this->rpcHandle->setObjectProperty($this->ref_id, $name,$value); + if($this->rpcHandle->success()){ + $this->__addPropValueToCache($name, $value); + return(TRUE); + }else{ + return(FALSE); + } + }else{ $this->__addPropValueToCache($name, $value); return(TRUE); } - return(FALSE); } @@ -191,6 +197,7 @@ class remoteObject return(NULL); }else{ $this->__addPropValueToCache($name, $res); + $this->values[$name] = $res; return($res); } } @@ -246,6 +253,29 @@ class remoteObject $this->cache = array(); } + + /* \brief See commit(); + */ + function save() + { + return($this->commit()); + } + + + /*! \brief Saves property modifications back to the server. + * This is only necessary in directStorage mode. + * @param Boolean If set to true all attributes will be saved, even not modified. + */ + function commit($saveUntouchedPropertiesToo = FALSE) + { + foreach($this->properties as $prop){ + if($this->__propIsCached($prop)) continue; + if($saveUntouchedPropertiesToo || $this->values[$prop] != $this->__getPropFromCache($prop)){ + $this->__setProperty($prop, $this->__getPropFromCache($prop), TRUE); + } + } + } + /*!\brief Internal method which removes a property from the cache. * @param String The name of the property. -- 2.30.2