[dev] Exclude preferences from being stored

mail at pBartels.info mail at pBartels.info
Thu May 14 12:56:57 UTC 2009


I think its not that easy but also not very hard.

setValue() doesn't store the data, the data are stored in the store()  
implementation of the Driver. store() is registered as a shutdown  
function.

You want to use setValue and its code because it also updates the cache.
The data are one time at the login queried and cached. After this  
setValue is used to work on the cache. (As I understood it so far.)  
The templates that generates the UI uses getValue to get values from  
the cache. And by the way store is called after each script call to  
store the dirty preferences into the backend. Dirty preferences are  
changes but not stored prefs.

But working a bit around with setDirty and if it works correctly you  
could handle a 'save' or 'store' setting in _setValue() in  
horde/lib/Horde/Prefs.php and not set the pref dirty if a special flag  
is set.

I didn't do this because I wanted to keep the changes simple (in my  
files) but as I think of it this could work in general. But just in  
theory. I had the last hours problems with this preferences stuff and  
I think new problems would occour ;)

And I'm neither deeply familiar with it.

Thanks for you response!

Vilius ?umskas <vilius at lnk.lt>:

>> Anyway a flag if the preference should be stored in the backend would
>> be nice...
>
> I'm not very familiar with the structure of $_prefs array in the   
> driver, but AFAIK this is easily done. Add lines like:
>
> If (this->_prefs[$pref]['save'] == true) { return false; }
>
> To setValue() in Prefs.php.
>
> This way you could use 'save' => true in prefs.php
>
> --
>   Vilius
>
>
> --
> Horde developers mailing list - Join the hunt: http://horde.org/bounties/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>





More information about the dev mailing list