MODx插件不会被触发(没有事件)

时间:2015-11-03 20:18:36

标签: plugins modx

我创建了一个测试插件,并在“系统事件”标签中激活了所有事件。插件看起来像这样:

<?php
error_log('test_plugin: ' . $modx->event->name);

就是这样。

我正在通过tail -f /var/log/error.log关注error.log,当我在后端中重新加载页面时,我得到了几个条目(这是完美的)

[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnHandleRequest, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnManagerPageInit, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnBeforeManagerPageInit, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnManagerPageBeforeRender, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnPluginFormRender, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnParseDocument, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnParseDocument, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnParseDocument, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnParseDocument, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnParseDocument, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnParseDocument, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnPluginFormPrerender, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:08 2015] [error] [client xx.xx.xx.xx] test_plugin: OnManagerPageAfterRender, referer: http://my.domain.de/manager/index.php?a=1
[Tue Nov 03 21:07:10 2015] [error] [client xx.xx.xx.xx] test_plugin: OnResourceToolbarLoad, referer: http://my.domain.de/manager/index.php?a=13&id=13

但是当在 FRONT-END 中加载页面时,我得到一点都没有

有什么想法吗?我正在使用 Revo 2.2.14-pl

2 个答案:

答案 0 :(得分:1)

最后是缓存问题。使用Bob Ray的CacheClear-snippet解决了这个问题。

答案 1 :(得分:0)

最好使用MODX日志:

$modx->setLogLevel(modX::LOG_LEVEL_DEBUG);
$modx->log(modX::LOG_LEVEL_DEBUG, 'test_plugin: ' . $modx->event->name);

您可以使用不同的tail -f /path/to/your/webroot/core/cache/logs/error.log