[horde] hook appinitialized

Ronan SALMON rsalmon at mbpgroup.com
Thu May 26 10:23:24 UTC 2011


Michael M Slusarz <slusarz at horde.org> a écrit :

> Quoting Ronan SALMON <rsalmon at mbpgroup.com>:
>
>> Hi all,
>>
>> I'm trying to assign a new value to a looked pref from hook  
>> appinitialized().
>>
>> Example with turba :
>>
>> $_prefs['addressbooks']['locked'] = true;
>>
>> turba/config/hook.php:
>> public function appinitialized() {
>>     
>> $GLOBALS['prefs']->setValue('addressbooks',json_encode($sources),  
>> array('nosave' => true));
>> }
>>
>> The pref doesn't get setted, because setValue() from  
>> framework/Prefs/lib/Horde/Prefs.php doesn't do anything if pref is  
>> locked.
>>
>> So, how can I update a locked pref from hook appinitialized()
>
> Unlock the pref, store the value, and re-lock if necessary.

Ah, I hadn't seen that function setLocked existed, thanks.

I still can't set the pref. The 'scope' doesn't seem to match the  
application calling the hook.

turba/config/hook.php:public function appinitialized() {
   Horde::debug($GLOBALS['prefs']->getScope());
}
2011-05-26T12:14:08+02:00 DEBUG: Variable information:
string(4) "ingo"

Backtrace:
  1. Horde_Registry::appInit() /var/www/html/horde/services/portal/index.php:12
  2. Horde_Registry->__construct() /usr/share/pear/Horde/Registry.php:231
  3. Horde_Injector->getInstance() /usr/share/pear/Horde/Registry.php:440
  4. Horde_Injector->createInstance() /usr/share/pear/Horde/Injector.php:248
  5. Horde_Injector_Binder_Factory->create()  
/usr/share/pear/Horde/Injector.php:213
  6. Horde_Core_Factory_Notification->create()  
/usr/share/pear/Horde/Injector/Binder/Factory.php:111
  7. Horde_Registry->listApps()  
/usr/share/pear/Horde/Core/Factory/Notification.php:27
  8. Horde_Registry->hasPermission() /usr/share/pear/Horde/Registry.php:785
  9. Horde_Registry->isAuthenticated() /usr/share/pear/Horde/Registry.php:1409
10. Horde_Core_Auth_Application->transparent()  
/usr/share/pear/Horde/Registry.php:1842
11. Horde_Core_Auth_Application->_setAuth()  
/usr/share/pear/Horde/Core/Auth/Application.php:311
12. Horde_Registry->setAuth()  
/usr/share/pear/Horde/Core/Auth/Application.php:580
13. Horde::callHook() /usr/share/pear/Horde/Registry.php:2195
14. call_user_func_array() /usr/share/pear/Horde.php:1802
15. Turba_Hooks->appinitialized()
16. Horde::debug() /var/www/html/horde/turba/config/hooks.php:86

This is using the following versions :
horde 4.0.3
turba 3.0.2
imp 5.0.4
ingo 2.0.1 (no hooks.php, no prefs.local.php)

Thanks,
Ronan.


More information about the horde mailing list