Php 如何使用magento正确执行cron作业-异常Mage_Core_异常消息模型/方法定义无效
我会尽我所能直截了当地说,我使用的是Magento 1.9。 在我的简单cron模块中有以下代码,每次执行cron作业时,我都可以看到日程安排记录得很好,但在消息的日志中我看到以下错误 异常“Mage\u Core\u exception”,消息为“无效模型/方法” 定义,应为/Users/XXXXX/Sites/projects/php/web/magento/magento_test1.9/SRC/app/Mage.php:595中的“model/class::method.” 堆栈跟踪:#0/Users/XXXXX/Sites/projects/php/web/magento/magento_test1.9/SRC/app/code/core/Mage/Cron/Model/Observer.php(299): Mage::ThroweException('Invalid model/m...) #1/Users/XXXXX/Sites/projects/php/web/magento/magento_test1.9/SRC/app/code/core/Mage/Cron/Model/Observer.php(72): Mage\u Cron\u Model\u Observer->\u processJob(对象(Mage\u Cron\u Model\u调度), 对象(Mage\u Core\u Model\u Config\u元素)) #2/Users/XXXXX/Sites/projects/php/web/magento/magento_test1.9/SRC/app/code/core/Mage/core/Model/app.php(1358): Mage\u Cron\u Model\u Observer->dispatch(对象(变量事件\u Observer)) #3/Users/XXXXX/Sites/projects/php/web/magento/magento_test1.9/SRC/app/code/core/Mage/core/Model/app.php(1337): Mage_Core_Model_App->_callObserverMethod(对象(Mage_Cron_Model_Observer),“调度”,对象(Varien_事件_Observer)) #4/Users/XXXXX/Sites/projects/php/web/magento/magento_test1.9/SRC/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('默认',数组) #5/Users/XXXXX/Sites/projects/php/web/magento/magento_test1.9/SRC/test_cron.php(76): Mage::dispatchEvent('默认值') #6{main} 我的配置: config.xmlPhp 如何使用magento正确执行cron作业-异常Mage_Core_异常消息模型/方法定义无效,php,magento,exception,cron,magento-1.9,Php,Magento,Exception,Cron,Magento 1.9,我会尽我所能直截了当地说,我使用的是Magento 1.9。 在我的简单cron模块中有以下代码,每次执行cron作业时,我都可以看到日程安排记录得很好,但在消息的日志中我看到以下错误 异常“Mage\u Core\u exception”,消息为“无效模型/方法” 定义,应为/Users/XXXXX/Sites/projects/php/web/magento/magento_test1.9/SRC/app/Mage.php:595中的“model/class::method.” 堆栈跟踪:#
<?xml version="1.0"?>
<config>
<!-- lets define the module name and version -->
<modules>
<Mymodule_Update>
<version>0.1.0</version>
</Mymodule_Update>
</modules>
<frontend>
<!-- lets define the module router i.e. for request to any controller within the module and action e.g. mymodule/controller/action -->
<routers>
<update>
<use>standard</use>
<args>
<module>Mymodule_Update</module>
<frontName>mymoduleupdate</frontName>
</args>
</update>
</routers>
<!-- lets define the layout to be used by this module -->
<layout>
<updates>
<update module="Mymodule_Update">
<file>mymoduleupdate.xml</file>
</update>
</updates>
</layout>
</frontend>
<crontab>
<jobs>
<!-- every 5 minute-->
<mymodule_update_in>
<schedule>
<cron_expr>*/5 * * * * </cron_expr>
</schedule>
<run>
<model>
mymodule_update/updater::performUpdateIn
</model>
</run>
</mymodule_update_in>
<!-- every 5 minute-->
<mymodule_update_out>
<schedule>
<cron_expr>*/5 * * * * </cron_expr>
</schedule>
<run>
<model>
mymodule_update/updater::performUpdateOut
</model>
</run>
</mymodule_update_out>
</jobs>
</crontab>
<global>
<!-- lets define the models to use-->
<models>
<mymodule_update>
<resourceModel>mymodule_update_resource</resourceModel>
<class>Mymodule_Update_Model</class>
</mymodule_update>
<mymodule_update_resource>
<class>Mymodule_Update_Model_Resource</class>
</mymodule_update_resource>
</models>
<helpers>
<mymodule_update>
<class>Mymodule_Update_Helper</class>
</mymodule_update>
</helpers>
<resources>
<mymodule_update_setup>
<setup>
<module>Mymodule_Update</module>
<class>Mymodule_Update_Model_Resource_Setup</class>
</setup>
</mymodule_update_setup>
</resources>
<events>
</events>
</global>
</config>
或
同样的错误是我得到的。我希望任何一个知道为什么会出错的人都能给我指出正确的方向,谢谢。发现问题在于要执行的操作的xml标记之间的间距 i、 e
mymodule_更新程序::PerformUpdate
应该是
<model>mymodule_update/updater::performUpdateOut</model>
mymodule\u更新程序::执行更新
同样,对于performUpdateIn
试图美化或允许一些代码编辑器在两者之间添加空格可能会导致数小时不必要的脑力劳动
mymodule_update/updater::performUpdateOut
update/updater::performUpdateOut
mymodule_update/updater::performUpdateIn
update/updater::performUpdateIn
<model>
mymodule_update/updater::performUpdateOut
</model>
<model>mymodule_update/updater::performUpdateOut</model>