久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在 Magento 模塊中設置 cron 作業?

How to setup a cron job in Magento module?(如何在 Magento 模塊中設置 cron 作業?)
本文介紹了如何在 Magento 模塊中設置 cron 作業?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想在我的模塊中設置一個 cron 作業.我按照 Magento wiki 上的說明進行操作 - how_to_setup_a_cron_job,但我的 cron 作業根本沒有執行.

I wanted to setup a cron job inside my module. I followed the instructions on Magento wiki - how_to_setup_a_cron_job, but my cron job is simply not executing.

這是我的 config.xml (app/code/local/Roomstory/Invoice/etc/config.xml)

This is my config.xml (app/code/local/Roomstory/Invoice/etc/config.xml)

<?xml version="1.0"?>
<config>    
    <modules>
        <Roomstory_Invoice>
            <version>0.1.1</version>
        </Roomstory_Invoice>
    </modules>
<!-- -->
    <crontab>
        <jobs>
            <roomstoryinvoice_setstatus>
                <schedule><cron_expr>*/10 * * * *</cron_expr></schedule>
                <run><model>roomstory_invoice/setstatus::run</model></run>
            </roomstoryinvoice_setstatus>
        </jobs>
    </crontab>
</config>

這是我的課.(app/code/local/Roomstory/Invoice/Model/Setstatus.php)

And this is my class. (app/code/local/Roomstory/Invoice/Model/Setstatus.php)

<?php
class Roomstory_Invoice_Model_Setstatus {

  public function run() {
    return true;
  }

}
?>

我安裝了一個 Cron 調度程序模塊,它顯示了我列出的 cron 作業,但是當我嘗試立即運行"(用于調試)時,出現錯誤 -

I have installed a Cron Scheduler Module, which shows my cron job listed, but when I try to "run now" (for debugging), I get error -

無效回調:roomstory_invoice/setstatus::run 不存在

Invalid callback: roomstory_invoice/setstatus::run does not exist

這很簡單,經過多次嘗試,我仍然無法找到錯誤.請告訴一些其他的方法來做到這一點,或者指出這段代碼中的錯誤.

This something simple, after much trying, I am still not able to find the error. Please tell some other way to do it, or indicate the error in this code.

謝謝!

推薦答案

在你的模塊 config.xml 中加入以下內容:

In your modules config.xml put the following:

<config>
    <global>
        <models>
            <roomstoryinvoicecron>
                <class>Roomstory_Invoice_Model</class>
            </roomstoryinvoicecron>                         
        </models>
    </global>
    <crontab>
        <jobs>
            <roomstoryinvoicecron>
                <schedule>
                    <cron_expr>*/10 * * * *</cron_expr>
                </schedule>
                <run>
                    <model>roomstoryinvoicecron/observer::setStatus</model>
                </run>
            </roomstoryinvoicecron>
        </jobs>
    </crontab>
</config>

app/code/local/Roomstory/Invoice/Model/Observer.php 中添加以下內容:

In app/code/local/Roomstory/Invoice/Model/Observer.php add the following:

<?php
class Roomstory_Invoice_Model_Observer {
    public function setStatus() {
        Mage::log("WORKS!");
    }
}

確保日志記錄已啟用并且它應該可以工作,檢查日志以確保;)

Make sure logging is enabled and it should work, check the log to be sure ;)

這篇關于如何在 Magento 模塊中設置 cron 作業?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Magento products by categories(按類別劃分的 Magento 產品)
Resource interpreted as image but transferred with MIME type text/html - Magento(資源被解釋為圖像但使用 MIME 類型 text/html 傳輸 - Magento)
Is there an event for customer account registration in Magento?(Magento 中是否有客戶帳戶注冊事件?)
Magento addFieldToFilter: Two fields, match as OR, not AND(Magento addFieldToFilter:兩個字段,匹配為 OR,而不是 AND)
quot;Error 404 Not Foundquot; in Magento Admin Login Page(“未找到錯誤 404在 Magento 管理員登錄頁面)
Get Order Increment Id in Magento(在 Magento 中獲取訂單增量 ID)
主站蜘蛛池模板: 亚洲国产成人精品在线 | 欧美一级片在线观看 | 国产精品片 | 91在线播 | 伦理一区二区 | 久久电影一区 | 国产精品久久久亚洲 | 国产区精品视频 | 天天干狠狠操 | 久久夜色精品国产 | 美女久久| 精品欧美一区二区三区久久久小说 | 户外露出一区二区三区 | 一级大片网站 | 国产精品久久精品 | 羞羞网站免费 | 91精品国产综合久久久久久漫画 | 国产精品一区二区三区久久 | 精品免费观看 | 精品伊人久久 | 久久成人精品 | 精品在线99 | 久久久涩 | 黄色网址免费看 | 午夜久久av | 黄a网| 天天草天天操 | 欧美一级欧美三级在线观看 | 亚洲一区二区在线播放 | 欧美日韩高清一区二区三区 | 91亚洲精品国偷拍自产在线观看 | 成人综合久久 | 日韩在线精品 | 久久午夜国产精品www忘忧草 | 一区二区三区视频在线观看 | 桃色五月 | 精久久 | 免费观看一级黄色录像 | 精品欧美乱码久久久久久 | 99精品国自产在线 | 色久在线|