[dev] [cvs] commit: framework/Prefs Prefs.php

Jan Schneider jan at horde.org
Mon Nov 28 10:34:10 PST 2005


Zitat von Michael M Slusarz <slusarz at bigworm.curecanti.org>:

> Quoting Jan Schneider <jan at horde.org>:
>
>> jan         2005-11-28 02:29:06 PST
>>
>>   Modified files:
>>     Prefs                Prefs.php
>>   Log:
>>   Revert 1.155. It is not the factory's job to create singletons.
>> That's what singleton() is for. Fixes partially bug 3050.
>>
>>   Revision  Changes    Path
>>   1.157     +10 -16    framework/Prefs/Prefs.php
>>
>>   Chora Links:
>>
>> http://cvs.horde.org/diff.php/framework/Prefs/Prefs.php?r1=1.156&r2=1.157&ty=u
>
> You're right... but then this code needs to be put back into singleton
> and Registry::loadPrefs() needs to call singleton() not factory().  As
> discussed in my previous email, we should only be creating a new prefs
> objects for each prefs backend.  We should *not* be creating new prefs
> objects for each scope.  Updating the scope and the preferences visible
> to the scope should be something done internally by Prefs::, but there
> is no valid reason to have to create X amount of Prefs objects.  Not
> only does it take up (X - 1) times the memory, but it also causes (X -
> 1) times the shutdown function is called.  Finally, and more
> importantly, caching prefs values should be done entirely in Prefs -
> doing it both in Registry and Prefs is overkill at best and sloppy at
> worse.

I don't question the final goal, only the method to get there. I 
quickly tried to use singleton() in Registry instead, but that broke 
even more. And I didn't have the time to track this further down.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/


More information about the dev mailing list