maverick193 / magento-full-page-cache-crawler

Magento Full Page Cache Crawler
17 stars 10 forks source link

Column not found: 1054 Unknown column '1' in 'where clause' #5

Open ProxiBlue opened 7 years ago

ProxiBlue commented 7 years ago

Hi,

M1.9.2.4 Installed without any noted errors, but i get this every day: Curious as to why you need to do the AND (1 = 1) in your SQL?

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column '1' in 'where clause', query was: SELECT main_table.* FROM maverick_crawler_entity AS main_table WHERE (scheduled = 1) AND (1 = 1)' in /var/www/deployments/release-306/lib/Zend/Db/Statement/Pdo.php:235 Stack trace:

0 /var/www/deployments/release-306/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)

1 /var/www/deployments/release-306/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)

2 /var/www/deployments/release-306/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)

3 /var/www/deployments/release-306/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)

4 /var/www/deployments/release-306/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)

5 /var/www/deployments/release-306/lib/Zend/Db/Adapter/Abstract.php(737): Varien_Db_Adapter_Pdo_Mysql->query('SELECT `main_ta...', Array)

6 /var/www/deployments/release-306/lib/Varien/Data/Collection/Db.php(740): Zend_Db_Adapter_Abstract->fetchAll('SELECT `main_ta...', Array)

7 /var/www/deployments/release-306/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(521): Varien_Data_Collection_Db->_fetchAll('SELECT `main_ta...', Array)

8 /var/www/deployments/release-306/lib/Varien/Data/Collection/Db.php(572): Mage_Core_Model_Resource_Db_Collection_Abstract->getData()

9 /var/www/deployments/release-306/lib/Varien/Data/Collection.php(752): Varien_Data_Collection_Db->load()

10 /var/www/deployments/release-306/app/code/local/Maverick/Crawler/Model/Cron.php(52): Varien_Data_Collection->count()

11 [internal function]: Maverick_Crawler_Model_Cron->crawl(Object(Aoe_Scheduler_Model_Schedule))

12 /var/www/deployments/release-306/app/code/community/Aoe/Scheduler/Model/Schedule.php(193): call_user_func_array(Array, Array)

13 /var/www/deployments/release-306/app/code/community/Aoe/Scheduler/Model/Schedule.php(579): Aoe_Scheduler_Model_Schedule->runNow(true)

14 /var/www/deployments/release-306/app/code/community/Aoe/Scheduler/Model/Observer.php(39): Aoe_Scheduler_Model_Schedule->process()

15 /var/www/deployments/release-306/app/code/core/Mage/Core/Model/App.php(1358): Aoe_Scheduler_Model_Observer->dispatch(Object(Varien_Event_Observer))

16 /var/www/deployments/release-306/app/code/core/Mage/Core/Model/App.php(1337): Mage_Core_Model_App->_callObserverMethod(Object(Aoe_Scheduler_Model_Observer), 'dispatch', Object(Varien_Event_Observer))

17 /var/www/deployments/release-306/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('default', Array)

18 /var/www/deployments/release-306/shell/scheduler.php(374): Mage::dispatchEvent('default', Array)

19 /var/www/deployments/release-306/shell/scheduler.php(37): Aoe_Scheduler_Shell_Scheduler->cronAction()

20 /var/www/deployments/release-306/shell/scheduler.php(400): Aoe_Scheduler_Shell_Scheduler->run()

21 {main}

maverick193 commented 7 years ago

Hi ProxiBlue, I wrote this module 3 years ago and since then it didn't change a lot, I'll have to update it (once I'll have time) The problem you describe here comes from a typo : If you look at Maverick_Crawler_Model_Cron::crawl( ) (line 48) : $crawlers = Mage::getResourceModel('maverick_crawler/crawler_collection') ->addFieldToFilter('scheduled', array('eq' => self::CRAWLER_SCHEDULED)) ->filterByStatus(Maverick_Crawler_Model_Crawler::STATUS_ENABLED);

The problem is this function filterByStatus( ) defined in Maverick_Crawler_Model_Resource_Crawler_Collection

public function filterByStatus($status) { $this->addFieldToFilter($status, array('eq' => $status)); return $this; }

The condition in the filter should be $this->addFieldToFilter('status', array('eq' => $status)); ('status' instead of $status) ....

I'll try to update the code soon. Thanks for the information.

ProxiBlue commented 7 years ago

https://github.com/maverick193/magento-full-page-cache-crawler/pull/6