[dev] Exclude preferences from being stored
mail at pBartels.info
mail at pBartels.info
Thu May 14 11:46:12 UTC 2009
I looked for a cleaner version but I'm sick of it so I hacked
something like the following code into prefs_callback():
$prefs->_scopes['horde']['mypref']['m'] = 0;
This lets horde think the preference is not changed and therefore not
updated in the backend.
The usage of setDirty or setDefault didn't worked...
Its really nice using the prefs this way.
I'm handling the data in prefs_callback() but there are also some hook
functions that are called during preference manipulation. It would be
cleaner using them instead of hacking prefs_callback().
I'm setting the default preferences in prefs.php (a file that is
included there) like
$_prefs['mypref'] = array( 'value' => $xml_prc_result['mypref'], ...
And if the XML RPC server is not available I don't add the preferences
so just the standard imp preferences are available and shown...
Anyway a flag if the preference should be stored in the backend would
be nice...
Vilius Šumskas <vilius at lnk.lt>:
>> I added some prefs to the imp preferences UI and I'm using the auto
>> generated forms to change some server based settings via XML-RPC. All
>> this settings are in a new category in the same location like the imp
>> preferences. It all works very nice. The 'simple' problem is, the
>> preferences are also stored in the preferences database and I don't
>> want this for this kind of settings...
>
> Ahh, very interesting usage of Prefs. I never would thought about that :)
>
> What you probably need is _shutdown() function. From Prefs.php docs:
>
> /**
> * This function will be run at the end of every request as a shutdown
> * function (registered by the Prefs:: constructor). All prefs with the
> * dirty bit set will be saved to the storage backend at this time;
> thus,
> * there is no need to manually call $prefs->store() every time a
> * preference is changed.
> *
> * @abstract
> */
> function store()
> {
> }
>
>
> Also, if I were you, I'd just write a new custom driver.
>
> --
> Best Regards,
>
> Vilius Šumskas
> LNK TV IT manager
> mob.: +370 614 75713
> http://www.lnk.lt
>
>
>
>
>
> --
> 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