Magento 事件观察器在某些机器上无法工作
我似乎无法弄清楚为什么我的事件观察者可以在我的机器(和其他同事)上工作,但不能在办公室的其他机器上工作。
例如,我有一个监听事件的观察者:
controller_action_postdispatch_adminhtml_process_reindexProcess
我的代码检测到该事件并运行一些代码。当我运行重新索引过程时,我的代码就会执行。当办公室中的某些其他机器运行重新索引时,要么事件没有被触发,要么我的观察者没有检测到它。
为什么计算机或用户单击管理面板中的重新索引按钮会更改事件触发或观察方式的任何内容?
我已尽我所能研究这个问题并找到了这篇文章。
但这似乎涉及不同的安装。在我的问题中,它适用于某些计算机上的给定安装,而不是其他计算机上的给定安装,因此我觉得本文不直接相关。
这个问题快把我逼疯了。任何帮助将不胜感激。
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试很多巫术,但最终您必须从这里开始
并调试/记录事件的执行,以确定为什么它在某些情况下不触发。
评论的具体答复
There's a whole lot of voodoo you could try, but what you'll end up having to in the end is start here
and debug/log the execution of your event to determine why it isn't firing in certain situations.
Specific Answer From Comments
您确定两台计算机上的文件状态相同吗?
也许您忘记传输/签入 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.