6.0.0-alpha12
6/12/25

[#7033] Ingo does not store spam preferences
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

History
07/07/2008 09:01:30 AM Jan Schneider Assigned to Jan Schneider
State ⇒ Resolved
 
07/07/2008 06:33:30 AM develop (at) kristov (dot) de Comment #4 Reply to this comment
Please try what I committed instead.
It works, thanks.


07/06/2008 10:26:05 PM Jan Schneider Patch ⇒ No
 
07/06/2008 10:25:56 PM Jan Schneider Comment #3
State ⇒ Feedback
Reply to this comment
Please try what I committed instead.
07/06/2008 10:25:29 PM CVS Commit Comment #2 Reply to this comment
Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/ingo/lib/Storage.php?r1=1.84&r2=1.85&ty=u
07/06/2008 10:17:23 PM Jan Schneider Deleted Original Message
 
07/06/2008 07:39:23 PM develop (at) kristov (dot) de Comment #1
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
Reply to this comment
When running Imp and Ingo, Ingo does not store the spam preferences 
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.


Saved Queries