[dev] how to repair the conf object?
Michael J Rubinsky
mrubinsk at horde.org
Sat May 25 16:37:47 UTC 2019
Quoting Sebastian Birnbach <birnbacs at gmail.com>:
> Am Fr., 24. Mai 2019 um 22:13 Uhr schrieb Michael J Rubinsky <
> mrubinsk at horde.org>:
>
>>
>> Quoting Sebastian Birnbach <birnbacs at gmail.com>:
>>
>> > I recently installed nag and found out that my own application had stolen
>> > one of its settings:
>> > $GLOBALS['conf']['storage']['driver'].
>>
>> Each application runs in it's own configuration scope, so I'm not sure
>> what you mean here. How did it steal it?
>>
>
> I happened to choose $GLOBALS['conf'][dossierstorage]['driver'] for my own
> purposes. That is, my conf.xml looked like this:
>
> <?xml version="1.0"?>
> <!-- $Id: 0f00ea4b8b9ffa35aef42705c8eca2d06ca65177 $ -->
> <configuration>
> <configsection name="storage">
> <configheader>Storage System Settings</configheader>
> <configswitch name="driver" desc="What storage driver should we use?">
> <case name="sql" desc="SQL">
> <configsection name="params">
> <configsql switchname="driverconfig">
> </configsql>
> </configsection>
> </case>
> <case name="rdo" desc="RDO">
> <configsection name="params">
> <configsql switchname="driverconfig">
> </configsql>
> </configsection>
> </case>
> </configswitch>
> </configsection>
>
> <configsection name="templates">
> <configheader>Templates Location</configheader>
> <configstring name="path" desc="Storage location of office template
> files. Make sure the directory exists and is writable for the webserver"
> required="true">
> /usr/local/www/apache24/data/abakus/officetemplates</configstring>
> </configsection>
>
> </configuration>
And this is the conf.xml of you own application, correct? I.e.
/horde/dossierstorage/conf/conf.xml?
>> > (It took me a while to figure this out)
>> >
>> > I changed my application so that it uses
>> > $GLOBALS['conf'][dossierstorage]['driver'] instead. This side works well
>> > again.
>> >
>> > Problem is, I am unable to get nag's configuration hash entry back. I can
>> > see and manipulate nag's configuration in the console and settings get
>> > reflected in nag/config/conf.php no problem. But when I dump them with
>> > print_r($GLOBALS['conf']) they are missing.
>>
>> Where are you dumping the values? You have to do it from within Nag's
>> context if you want to see Nag's $conf entries. Use the php shell in
>> the horde admin, and select 'Nag' in the context drop down.
>>
>
> I started playing around with Nag_Api and kept getting
>
> Cannot instantiate abstract class Nag_Drivererrors.
>
>
> So I looked into nag/lib/Factory/Driver.php to see what is the matter.
> Around line 39 the name of the driver is pulled from
> $GLOBALS['conf'][dossierstorage]['driver'] .
>
> I dumped the configuration hash there with print_r($GLOBALS['conf']) and
> found the setting contained 'rdo'. Changing the configuration of my own
> application made this value change as well, so I thought I had found the
> problem. I changed my application not to use said configuration entry as
> described. The dump now shows the changed setting ('dossierstorage'), but
> not the original ('storage') any more.
>
> Nag's driver works fine if I edit Driver.php north of line 39 to read
> $driver = 'sql'; I can access tasklists and everything through the api then.
>
> By way of testing: managing conf.php seems to work fine.
> $myconfig = new Horde_Config('nag');
> print_r($myconfig->getPHPConfig());
> reflects the file's contents and I can change the file through the admin
> console.
>
> Only conf.php's contents do not seem to get promoted into the configuration
> hash.
It sounds to me like there is some error in how you are initializing
your application within horde and the application's context is leaking
out to other applications. Did you create a registry entry for your
application? Are you calling Horde_Registry::appInit() at the
beginning of each of your application's requests?
Normally, when you load an application, as part of the init process,
your application is pushed onto the registry stack and it's conf.php
values are merged with the horde(base) application's conf.php values.
There should be no other entries in $conf other than the horde/base
application and the currently scoped application.
>> > I tried logging out and back in, restarting the web server and even
>> > reinstalling nag, but to no avail. I also tried setting conf values
>> > manually
>> > $GLOBALS['conf']['storage'] = array('params' => array('driverconfig' =>
>> > 'horde'), 'driver' => 'sql');
>> > but such changes do not get saved.
>> > --
>> > dev mailing list
>> > Frequently Asked Questions: http://wiki.horde.org/FAQ
>> > To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>>
>>
>>
>> --
>> mike
>> The Horde Project
>> http://www.horde.org
>> https://www.facebook.com/hordeproject
>> https://www.twitter.com/hordeproject
>> --
>> dev mailing list
>> Frequently Asked Questions: http://wiki.horde.org/FAQ
>> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>>
--
mike
The Horde Project
http://www.horde.org
https://www.facebook.com/hordeproject
https://www.twitter.com/hordeproject
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 9272 bytes
Desc: PGP Public Key
URL: <https://lists.horde.org/archives/dev/attachments/20190525/1a6eae59/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 821 bytes
Desc: PGP Digital Signature
URL: <https://lists.horde.org/archives/dev/attachments/20190525/1a6eae59/attachment-0001.bin>
More information about the dev
mailing list