Magento 事件观察器在某些机器上无法工作

发布于 2024-12-20 01:09:44 字数 593 浏览 2 评论 0原文

我似乎无法弄清楚为什么我的事件观察者可以在我的机器(和其他同事)上工作,但不能在办公室的其他机器上工作。

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

controller_action_postdispatch_adminhtml_process_reindexProcess

我的代码检测到该事件并运行一些代码。当我运行重新索引过程时,我的代码就会执行。当办公室中的某些其他机器运行重新索引时,要么事件没有被触发,要么我的观察者没有检测到它。

为什么计算机或用户单击管理面板中的重新索引按钮会更改事件触发或观察方式的任何内容?

我已尽我所能研究这个问题并找到了这篇文章。

事件未触发/或观察者未在 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?

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

Events not firing/or observer not working in 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦里人 2024-12-27 01:09:44

您可以尝试很多巫术,但最终您必须从这里开始

#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;
}

并调试/记录事件的执行,以确定为什么它在某些情况下不触发。

评论的具体答复

谢谢!我可以看到,从复选标记重新索引调用的事件与简单地单击重新索引过程文本不同。这是一个令人痛苦的长错误,需要调试,但却是一个简单的解决方案。再次感谢! –

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.

Specific Answer From Comments

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! –

丘比特射中我 2024-12-27 01:09:44

您确定两台计算机上的文件状态相同吗?
也许您忘记传输/签入 MyFirm_MyModule.xml 并且您的模块未激活?

计算机是否使用不同的操作系统?如果您使用 Windows 而您的同事使用 Linux,则可能是模块名称大写/小写的问题。

Are you sure you have the same file state on both computer?
Maybe you forget to transfer/check-in the MyFirm_MyModule.xml and your module is not active?

Are the computers using different operating systems? If you are on Windows and your colleagues are on Linux it might be a problem with uppercase/lowercase of module names.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文