Magento事件观察者不能在某些机器上工作 [英] Magento event observer not working on some machines

查看:184
本文介绍了Magento事件观察者不能在某些机器上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法弄清楚我的活动观察者为什么从我的机器(和另一个同事)工作,而不是从办公室的其他机器工作。

I cannot seem to figure out why my event observer works from my machine (and another coworkers) but not from other machines in the office.

例如,我有一个监听事件的观察者:

For example, I have an observer that listens for the event:

controller_action_postdispatch_adminhtml_process_reindexProcess

我的代码检测事件并运行一些代码。当我运行重新索引进程时,我的代码执行。当办公室里某些其他机器运行重新索引时,事件不会触发,或者我的观察者没有检测到。

My code detects the event and runs some code. When I run the re-index process, my code executes. When certain other machines here in the office run the re-index, either the event is not fired, or my observer isn't detecting it.

为什么电脑或用户点击管理面板中的重新索引按钮可以改变任何事件触发或观察的内容?

Why would the computer or the user clicking on the re-index button in the admin panel change anything for how events are fired or observed?

我已经尽可能地研究了这个问题,并发现这个post。

I have researched this problem as best I could and found this post.

事件未触发或观察者在magento中无法工作

但这似乎与不同的安装有关。在我的问题中,它适用于某些计算机上的给定安装,而不是来自其他计算机,因此我觉得这篇文章没有直接关系。

But that seemed to pertain to different installations. In my problem, it works on a given installation on certain computers and not from others so I felt that this article was not directly relevant.

这个问题让我疯狂。任何帮助将不胜感激。

This problem is driving me crazy. Any help would be greatly appreciated.

推荐答案

有很多voodoo可以尝试,但你最终会有到最后是从这里开始

There's a whole lot of voodoo you could try, but what you'll end up having to in the end is start here

#File: app/Mage.php

public static function dispatchEvent($name, array $data = array())
{
    Varien_Profiler::start('DISPATCH EVENT:'.$name);
    $result = self::app()->dispatchEvent($name, $data);
    #$result = self::registry('events')->dispatch($name, $data);
    Varien_Profiler::stop('DISPATCH EVENT:'.$name);
    return $result;
}

,并调试/记录事件的执行情况,以确定它不是在某些情况下开火。

and debug/log the execution of your event to determine why it isn't firing in certain situations.

来自评论的具体答案


谢谢!我看到从复选标记的重新索引调用一个不同的事件,而不仅仅是单击重新索引进程文本。一个很长的错误调试,但一个简单的解决方案。再次感谢! -

Thanks! I was able to see that re-indexing from the check marks calls a different event than simply clicking on the re-index process text. A painfully long error to debug but a simple solution. Thanks again! –

这篇关于Magento事件观察者不能在某些机器上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆