Skip to content

Instantly share code, notes, and snippets.

@mam08ixo
Forked from avoelkl/upgrade-0.1.67-0.1.68.php
Last active October 30, 2015 22:02
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mam08ixo/3937df764da7a6816a1d to your computer and use it in GitHub Desktop.
Save mam08ixo/3937df764da7a6816a1d to your computer and use it in GitHub Desktop.
SUPEE-6788 variable + block setup script. 1.) Create a new module or extend a current one. 2.) Create a new install or setup script with the variables and blocks which are not whitelisted yet.
<?php
/**
* @category Namespace
* @package Namespace_Module
* @author Anna Völkl
* @author Christoph Aßmann
* @author Fabian Schmengler
*/
/** @var Mage_Core_Model_Resource_Setup $installer */
$installer = $this;
// Make sure the upgrade is not performed on legacy installations with tables missing
$adminVersion = Mage::getConfig()->getModuleConfig('Mage_Admin')->version;
if (version_compare($adminVersion, '1.6.1.1', '>')) {
$connection = $installer->getConnection();
//---------------------------------------------------
// Add variables
//---------------------------------------------------
$table = $installer->getTable('admin/permission_variable');
$variableNames = array(
'design/email/logo_alt',
'design/email/logo_width',
'design/email/logo_height',
);
foreach ($variableNames as $variableName) {
$connection->insertIgnore($table, array(
'variable_name' => $variableName,
'is_allowed' => 1,
));
}
//---------------------------------------------------
// Add blocks
//---------------------------------------------------
$table = $installer->getTable('admin/permission_block');
$blockNames = array(
'cms/block',
'catalog/product_list',
'germany/impressum',
'page/html',
'magesetup/imprint_field',
'magesetup/imprint_content'
);
foreach ($blockNames as $blockName) {
$connection->insertIgnore($table, array(
'block_name' => $blockName,
'is_allowed' => 1,
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment