Magento – Patch SUPEE-6788 – Error after applying this patch to 1.9.1.0

magento-1.9patchessupee-6788

Most of the site works fine after applying this patch. One exception is that when going to admin->system->cache management->refresh cache, I got the following error. It was just an one-time error. I refreshed the cache again and no error shown. I have no idea what this error means. Should I have any concern?

a:5:{i:0;s:745:"Error in file: "/home/frcb/public_html/app/code/core/Mage/Admin/sql/admin_setup/upgrade-1.6.1.1-1.6.1.2.php" - SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'permission_variable' already exists, query was: CREATE TABLE `permission_variable` (
  `variable_id` int UNSIGNED NOT NULL auto_increment COMMENT 'Variable ID' ,
  `variable_name` varchar(255) NOT NULL default '' COMMENT 'Config Path' ,
  `is_allowed` bool NOT NULL default '0' COMMENT 'Mark that config can be processed by filters' ,
  PRIMARY KEY (`variable_id`, `variable_name`),
  UNIQUE `UNQ_PERMISSION_VARIABLE_VARIABLE_NAME` (`variable_name`)
) COMMENT='System variables that can be processed via content filter' ENGINE=INNODB charset=utf8 COLLATE=utf8_general_ci";i:1;s:954:"#0 /home/frcb/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(644): Mage::exception('Mage_Core', 'Error in file: ...')
#1 /home/frcb/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(437): Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.6.1.1', '1.6.1.2')
#2 /home/frcb/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.6.1.1', '1.6.1.2')
#3 /home/frcb/public_html/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/frcb/public_html/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 /home/frcb/public_html/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#6 /home/frcb/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#7 /home/frcb/public_html/index.php(87): Mage::run('', 'store')
#8 {main}";s:3:"url";s:23:"/index.php/admin/cache/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

Best Answer

This means patch's 'admin_setup' update script was executed before and somehow it was overwritten at core_resource table, so Magento trying to run it again but getting exception, thrown initially by Mysql as tables that this upgrade script trying to create is already there.

I'd follow below steps to fix it:

  • Check app/code/core/Mage/Admin/sql/admin_setup/upgrade-1.6.1.1-1.6.1.2.php and figure out what are new tables and data being added/updated.
  • Backup your current database to be safe
  • Cross check with database if all table, data already present.
  • If yes, update core_resource table for code : admin_setup, set version and data_version to 1.6.1.2 , clear cache and you are done
  • If database table/data not matching with upgrade script, this means upgrade was not finished properly when last executed, to fix it, Delete table that was created by partial upgrade,e.g for your case permission_variable and clear cache to run upgrade script again.

Hope it helps.

Related Topic