Summary | Ingo does not store spam preferences |
Queue | Ingo |
Queue Version | 1.2 |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | jan (at) horde (dot) org |
Requester | develop (at) kristov (dot) de |
Created | 07/06/2008 (6185 days ago) |
Due | |
Updated | 07/07/2008 (6184 days ago) |
Assigned | 07/06/2008 (6185 days ago) |
Resolved | 07/07/2008 (6184 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
State ⇒ Resolved
State ⇒ Feedback
http://cvs.horde.org/diff.php/ingo/lib/Storage.php?r1=1.84&r2=1.85&ty=u
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ Ingo does not store spam preferences
Queue ⇒ Ingo
Milestone ⇒
Patch ⇒ Yes
New Attachment: horde-ingo-1.2.ebuild
State ⇒ Unconfirmed
correctly. The problem is in the following code (lib/Storage/prefs.php):
case INGO_STORAGE_ACTION_SPAM:
$ob = new Ingo_Storage_spam();
$data = @unserialize($prefs->getValue('spam'));
Here, $prefs has previously been loaded to point to Ingo's
preferences. However, within the constructor of Ingo_Storage_spam, the
preference object is invalidated by changing the preference object's
scope, as Imp's preferences are loaded:
if (in_array('imp', $GLOBALS['registry']->listApps())) {
$prefs = &Prefs::singleton($GLOBALS['conf']['prefs']['driver'],
'imp', Ingo::getUser(), '',
null, false);
$prefs->retrieve();
[...]
To solve this, I changed Ingo's code to read
case INGO_STORAGE_ACTION_SPAM:
$ob = new Ingo_Storage_spam();
$prefs->retrieve($GLOBALS['registry']->getApp());
$data = @unserialize($prefs->getValue('spam'));
So the preferences are reloaded after the construction call.
Alternatively, only resetting the scope should also be sufficient.
This solves the problem, but I admit it may not be the most preferable
solution. I think that Prefs::singleton() should allow to cache
preference objects with different scopes separately, which is
currently disallowed (horde/lib/Horde/Prefs.php):
if (!isset($instances[$signature])) {
$instances[$signature] = &Prefs::factory($driver, $scope,
$user, $password, $params, $caching);
}
/* Preferences may be cached with a different scope. */
$instances[$signature]->setScope($scope);
If you want, I'll submit that as a separate Horde framework bug.