From: hickert Date: Thu, 7 Apr 2011 14:33:36 +0000 (+0000) Subject: #Updated remoteObject class X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8f7e5176629d0d3d73342381241c80826fd5cf8d;p=gosa.git #Updated remoteObject class git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20664 594d385d-05f5-0310-b6e9-bd551577e9d8 --- 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.