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
未发射/或观察者未在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.
这个问题让我抓狂。任何帮助将不胜感激。
3
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! –
谢谢!我能够看到,从复选标记重新索引会调用一个不同的事件而不是简单地单击重新索引进程文本。一个痛苦的长错误调试,但一个简单的解决方案。再次感谢! -
0
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?
您确定两台计算机上的文件状态相同吗?也许您忘记转移/签入MyFirm_MyModule.xml并且您的模块未激活?
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.
计算机是否使用不同的操作系统?如果您在Windows上并且您的同事在Linux上,那么模块名称的大写/小写可能会出现问题。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2011/12/07/532d3024f0a3bfd58cf49a7ab7536601.html。