[dev] Exclude preferences from being stored

mail at pBartels.info mail at pBartels.info
Thu May 14 09:42:37 UTC 2009


Hello,

Preferences could be stored in a backend, for example mysql.
I'm going to exclude some preferences from being stored in the database.

$pref->setValue() causes updating the value in the backend immediatly  
but the documentation says it's just done when $prefs->store() is  
called.
/horde/lib/Horde/Prefs.php:
>    /**
>     * 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()

/horde/lib/Horde/Prefs/sql.php has an implementation of store() that  
stores preferences in the database. As I can see it provides the only  
way to store a preference in the database. But the store() method is  
never called. In theory the data must not be stored in the database.

As I said, calling setValue() ends up in storing the preference value  
in the database. My Problem is I can't find the code where setValue()  
calls a driver or something that causes the storing in the database. I  
need this code to understand how I can exclude some prefs from being  
stored...

Changing default or dirty bit's doesn't work because setValue() stores  
the data in the database before I can change the bits in  
prefs_callback().

I hope someone is able to explain where setValue() calls the backend driver.

handleForm() in /horde/lib/Horde/Prefs/UI.php is used to handle the  
preferences changes and calls setValue()

store() seems to be called somewhere global at every script call but a  
debug_print_backtrace() gives me just "#0  Prefs_sql->store()". But if  
I comment out setValue(), the preference is not stored, so a global  
store() call is not initiating the storage in some way.

Thanks in advance
Philipp



More information about the dev mailing list