Magento:清​​理Cache和reindex之间出错

时间:2013-09-02 10:37:11

标签: php magento caching

由于我更新了Magento(从1.4.2.0升级到1.7.0.2)我总是在之后得到以下错误我清理缓存和之前我重新索引所有:

a:5:{i:0;s:233:"Error in file: "/html/magento_update/app/code/core/Mage/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php" - SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'report_viewed_product_aggregated_daily' already exists";i:1;s:942:"#0 /html/magento_update/app/code/core/Mage/Core/Model/Resource/Setup.php(645): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /html/magento_update/app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.6.0.0', '1.6.0.0.1')
#2 /html/magento_update/app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.6.0.0', '1.6.0.0.1')
#3 /html/magento_update/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /html/magento_update/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /html/magento_update/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#6 /html/magento_update/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#7 /html/magento_update/index.php(87): Mage::run('', 'store')
#8 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

我使用此代码清理缓存:

Mage::app()->cleanCache();
$enable = array();
foreach ( Mage::helper( 'core' )->getCacheTypes() as $type => $label ) {
    $enable[$type] = 1;
} 
Mage::app()->saveUseCache( $enable );

因为它位于文件“upgrade-1.6.0.0-1.6.0.0.1.php”中......可能是更新出了问题?我是通过SSH完成的,遵循不同的方法...来解决发生的错误。

1 个答案:

答案 0 :(得分:1)

通过删除这三个表来解决问题:

  • report_viewed_product_aggregated_daily
  • report_viewed_product_aggregated_monthly
  • report_viewed_product_aggregated_yearly

...就像这里建议的那样:http://duntuk.com/magento-upgrade#comment-417。首先我只是截断它们,这还不够。