[pLog-svn] r5388 - plog/branches/lifetype-1.2/class/action/admin

Jon Daley plogworld at jon.limedaley.com
Fri May 11 08:52:31 EDT 2007


 	I woke up thinking about this.  I think in the case where we want 
to change the bloginfo (and we should probably change the userinfo also) 
we should call register again, because the plugin might do something blog 
or user specific in the register function, right?
 	So, I think we do need to call getPlugins() for each blog.  If we 
are using the singleton _pm or a reference to it, do we need to worry 
about setting the bloginfo and userinfo back to the current blog and user 
after we run through all the blogs?  Maybe that only matters if another 
event is fired later in this same process?  Sounds like a really hard bug 
to find if/when it occurs.

On Fri, 11 May 2007, Jon Daley wrote:

> 	No, it still doesn't really work.  reverting to 5387 causes the
> tagcloud to not be recreated because the register was never called prior
> to the process.
> 	If I change $plugMgr=&getPluginMananger... to skip that but
> instead use the already created $this->_pm it still doesn't work, though
> if I add in a $this->_pm->getPlugins() then it does, because that calls
> register.  However, the order that the plugin gets called is a little odd.
> 	On a temp cleanup, I get a
> register()
> process() on a class that didn't have register called on him
> process() that did have register called previously
> register()
>
> So, that isn't really the best thing either, though if you only look at
> the output, it would appear to do the right thing.
>
> 	My guess is this has been this way for a long time, and that is
> why the plugin authors have been adding register() to their code, and no
> one ever happened to mention it before.
>
> On Fri, 11 May 2007, Jon Daley wrote:
>
>> 	Ah, I see.  I am only looking at one blog at the moment.  I'll see
>> if putting it back will now call register for us.
>>
>> On Fri, 11 May 2007, Oscar Renalias wrote:
>>
>>> I don't think your change does what you think it does :)
>>>
>>> The idea of the original code is to process the
>>> EVENT_POST_ADMIN_PURGE_TEMP_FOLDER event using each one of the active
>>> blogs in the system. For that reason we need to call
>>> PluginBase::setBlogInfo() every time within the loop, so that the
>>> plugin has the right blog in its context, otherwise the event is
>>> thrown and processed only by the current blog.
>>>
>>> On 5/11/07, jondaley at devel.lifetype.net <jondaley at devel.lifetype.net> wrote:
>>>> Author: jondaley
>>>> Date: 2007-05-10 23:21:41 -0400 (Thu, 10 May 2007)
>>>> New Revision: 5388
>>>>
>>>> Modified:
>>>>    plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php
>>>> Log:
>>>> as long as we call notifyEvent *after* setCommonData, the plugin manager is already setup for us
>>>>
>>>> Modified: plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php
>>>> ===================================================================
>>>> --- plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php  2007-05-11 03:20:21 UTC (rev 5387)
>>>> +++ plog/branches/lifetype-1.2/class/action/admin/admincleanupaction.class.php  2007-05-11 03:21:41 UTC (rev 5388)
>>>> @@ -177,16 +177,7 @@
>>>>
>>>>                         $blogs = new Blogs();
>>>>                 $activeBlogs = $blogs->getAllBlogs( BLOG_STATUS_ACTIVE );
>>>> -            // Get the plugin manager
>>>> -            $plugMgr =& PluginManager::getPluginManager();
>>>>
>>>> -               foreach( $activeBlogs as $blogInfo ) {
>>>> -                   $plugMgr->setBlogInfo( $blogInfo);
>>>> -                   $plugMgr->loadPlugins( "admin" );
>>>> -                   // Send the EVENT_POST_ADMIN_PURGE_TEMP_FOLDER message
>>>> -                   $plugMgr->notifyEvent( EVENT_POST_ADMIN_PURGE_TEMP_FOLDER );
>>>> -               }
>>>> -
>>>>                         $this->_message = $this->_locale->tr( "temp_folder_reset_ok" );
>>>>
>>>>                         return true ;
>>>> @@ -232,6 +223,9 @@
>>>>
>>>>                         $this->setCommonData();
>>>>
>>>> +            if($this->_op == "cleanupTemp")
>>>> +                $this->notifyEvent(EVENT_POST_ADMIN_PURGE_TEMP_FOLDER );
>>>> +
>>>>                         return true;
>>>>                 }
>>>>         }
>>>>
>>>> _______________________________________________
>>>> pLog-svn mailing list
>>>> pLog-svn at devel.lifetype.net
>>>> http://limedaley.com/mailman/listinfo/plog-svn
>>>>
>>> _______________________________________________
>>> pLog-svn mailing list
>>> pLog-svn at devel.lifetype.net
>>> http://limedaley.com/mailman/listinfo/plog-svn
>>>
>>
>> --
>> Jon Daley
>> http://jon.limedaley.com/
>>
>> Faith is a simple trust in a personal redeemer.
>> The simpler our trust in Christ for all things, the surer our peace.
>> -- William Adams
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>>
>
> -- 
> Jon Daley
> http://jon.limedaley.com/
>
> To be upset over what you don't have is to waste what you do have.
> -- Unknown
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
>

-- 
Jon Daley
http://jon.limedaley.com/

Our most basic problem is not that we want too much.  On the contrary,
it is that we are content with too little.
-- Randy Alcorn, 50 Days of Heaven


More information about the pLog-svn mailing list