Cron PHP代码无法在Magento上运行并产生错误

So I inherited a product reviews module. A cron runs every 6 hours. It checks for when to send an email out, but has not been working as of late.

Here's the config.xml file part containing the crontab. The crontab node is only placed within .

<crontab>
    <jobs>
        <company_reviews_delay>
            <schedule>
                <cron_expr>* * * * *</cron_expr><!-- every 6 hours -->
            </schedule>
            <run>
                <model>reviews/adminhtml_observer::delaySend</model>
            </run>
        </company_reviews_delay>
    </jobs>
</crontab>

The php file with the delaySend method is in Reviews/Model/Adminhtml/Observer.php Here's the code for it

public function delaySend() {
    $error_counter = 0;

    $unsent_notifications = $this->getNotificationCollection()->addFieldToFilter('notified', array('lt' => 1));
    foreach($unsent_notifications as $notification){
        try{
            $order = Mage::getModel('sales/order')->loadByIncrementId($notification->getOrderId());

            if(!$this->getConfig()->isCronEnabled($order->getStoreId()) || !$this->getConfig()->isEnabled($order->getStoreId())){
                continue; //skip for store that is disabled
            }

            $shipments_collection = $order->getShipmentsCollection();

            if (empty($shipments_collection)) continue;
            $shipment = $shipments_collection->getFirstItem();
        }catch(Exception $e){
            if($error_counter == 0){
                mage::helper('mymodule_base')->logError('Review delay send error: ' . $e, true);
            }
            mage::helper('mymodule_base')->logError('Issue with notification order ID: ' . $notification->getOrderId(), false);
            $error_counter++;
            continue;
        }
        $execution_time =  strtotime($shipment->getCreatedAt().'+'. $this->getConfig()->getCronDelay($order->getStoreId())); //e.g (+1 day to shipping date)
        if($execution_time < time()){
            $notification->sendEmail($order->getStoreId());
        }
    }
    return $this;
}

I substituted a simple print "Hello"; command in the method and ran it on command line. Hello was printed out but we get this error:

2015-07-22T15:48:54+00:00 ERR (3): Warning: include(Symfony\Component\Console\Event\ConsoleTerminateEvent.php): failed to open stream: No such file or directory  in /home/os2/public_html/lib/Varien/Autoload.php on line 94
2015-07-22T15:48:54+00:00 ERR (3): Warning: include(Symfony\Component\Console\Event\ConsoleTerminateEvent.php): failed to open stream: No such file or directory  in /home/os2/public_html/lib/Varien/Autoload.php on line 94
2015-07-22T15:48:54+00:00 ERR (3): Warning: include(): Failed opening 'Symfony\Component\Console\Event\ConsoleTerminateEvent.php' for inclusion (include_path='/home/os2/public_html/app/code/local:/home/os2/public_html/app/code/community:/home/os2/public_html/app/code/core:/home/os2/public_html/lib:.:/usr/lib/php:/usr/local/lib/php')  in /home/os2/public_html/lib/Varien/Autoload.php on line 94

Can anyone offer some advice or help? Thanks.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐