Cron, maybe, error?

AndreaMarucci

Well-known member
I've seen in the log error that every day between 2AM and 3 AM it's always recorded this error in file

library/Zend/Db/Statement/Mysqli.php:77

Zend_Db_Statement_Mysqli_Exception: Mysqli prepare error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 2 - library/Zend/Db/Statement/Mysqli.php:77

Stack Trace

Code:
#0 /home/kogit/forum/library/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('????DELETE FROM...')
#1 /home/kogit/forum/library/Zend/Db/Adapter/Mysqli.php(381): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), '????DELETE FROM...')
#2 /home/kogit/forum/library/Zend/Db/Adapter/Abstract.php(478): Zend_Db_Adapter_Mysqli->prepare('????DELETE FROM...')
#3 /home/kogit/forum/library/XfRu/BoardNotices/Model/Notice.php(254): Zend_Db_Adapter_Abstract->query('????DELETE FROM...')
#4 /home/kogit/forum/library/XfRu/BoardNotices/Model/Notice.php(229): XfRu_BoardNotices_Model_Notice->deleteDismissionsByNoticeIds(Array)
#5 /home/kogit/forum/library/XfRu/BoardNotices/CronEntry/Archive.php(19): XfRu_BoardNotices_Model_Notice->archiveExpiredNotices()
#6 [internal function]: XfRu_BoardNotices_CronEntry_Archive::archiveNotices()
#7 /home/kogit/forum/library/XenForo/Model/Cron.php(353): call_user_func(Array)
#8 /home/kogit/forum/library/XenForo/Cron.php(29): XenForo_Model_Cron->runEntry(Array)
#9 /home/kogit/forum/library/XenForo/Cron.php(64): XenForo_Cron->run()
#10 /home/kogit/forum/cron.php(12): XenForo_Cron::runAndOutput()
#11 {main}

Request Status

Code:
array(3) {
  ["url"] => string(39) "http://forum.kog.it/cron.php?1307923784"
  ["_GET"] => array(1) {
    [1307923784] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

What can I do?
 
I can confirm this.
It's because of the add-on.
It tries to run this query:
Code:
DELETE FROM `xfr_bn_dismission` WHERE notice_id IN ()
 
Fix
PHP:
public function archiveExpiredNotices()
    {
        $now = XenForo_Application::$time;
        $db = $this->_getDb();
        $db->query('
            UPDATE xfr_bn_notice
            SET archive = 1
            WHERE archive = 0 AND end_date < ' . $db->quote($now) . '
        ');

        $stmt = $db->query('
            SELECT notice_id
            FROM xfr_bn_notice
            WHERE archive = 1
        ');

        $archivedNotices = array();

        while ($row = $stmt->fetch())
        {
            $archivedNotices[] = $row['notice_id'];
        }
        if (count($archivedNotices) > 0) {
            $this->deleteDismissionsByNoticeIds($archivedNotices);
        }
    }
instead of
PHP:
public function archiveExpiredNotices()
    {
        $now = XenForo_Application::$time;
        $db = $this->_getDb();
        $db->query('
            UPDATE xfr_bn_notice
            SET archive = 1
            WHERE archive = 0 AND end_date < ' . $db->quote($now) . '
        ');

        $stmt = $db->query('
            SELECT notice_id
            FROM xfr_bn_notice
            WHERE archive = 1
        ');

        $archivedNotices = array();

        while ($row = $stmt->fetch())
        {
            $archivedNotices[] = $row['notice_id'];
        }

            $this->deleteDismissionsByNoticeIds($archivedNotices);
        
    }
 
Top Bottom