[dev] hooks: prefs & conf loading problem
Hans Lellelid
hans at appliedsec.com
Wed Jan 8 14:13:49 PST 2003
I'm running into some trouble w/ the way pref hooks are implemented.
I'm using the Horde framework to build some inter-related apps that all
share a non-horde user backend. Basically, I'm trying to populate the
Identity object with some values from my user module/app and using the
pref_hooks framework seemed like an obvious way to do this.
So, I have hooks that look like this:
function _prefs_hook_fullname()
{
$registry = &Registry::singleton();
require_once $registry->getParam('fileroot', 'myuserapp') .
'/lib/base.php';
require_once DDHR_BASE . '/lib/MyUserApp.php';
$user = &MyUserApp::getCurrentUser();
return $user->getName();
}
The hook is being invoked, BUT IS FAILING because of the way that
Registry pushes apps onto the stack. My call to
MyUserApp::getCurrentUser() wants to pass the apps' $conf values to the
driver, but it cannot access the $conf for my app because in
Registry->pushApp() the preferences are read before the conf is loaded
for the app -- and of course, loading the prefs in my scenario is
dependent on the hook, which is dependent on being able to access that
application's $conf variable. ... So, in short, pushApp() is failing
because of the order in which prefs & conf files are loaded (i.e. prefs
first, then conf).
In Registry->pushApp(), is there any reason why we couldn't load the
app's $conf (i.e. Registry->importConfig($app) ) before loading the apps
preferences...? Maybe I'm missing something really obvious here.
Maybe there is a way around this? Even using Registry->call() would, I
think, result in the same problem -- since the app would not be pushed
until prefs had been initialized.
Thanks in advance,
Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4461 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.horde.org/archives/dev/attachments/20030108/1106a221/smime.bin
More information about the dev
mailing list