本文整理汇总了PHP中Mage_Core_Model_Resource_Setup::startSetup方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Resource_Setup::startSetup方法的具体用法?PHP Mage_Core_Model_Resource_Setup::startSetup怎么用?PHP Mage_Core_Model_Resource_Setup::startSetup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Resource_Setup
的用法示例。
在下文中一共展示了Mage_Core_Model_Resource_Setup::startSetup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installSampleDB_
/**
* Instal Sample database
*
* $data = array(
* [db_host]
* [db_name]
* [db_user]
* [db_pass]
* )
*
* @param array $data
*/
public function installSampleDB_($data)
{
$config = array('host' => $data['db_host'], 'username' => $data['db_user'], 'password' => $data['db_pass'], 'dbname' => $data['db_name']);
$connection = Mage::getSingleton('core/resource')->createConnection('core_setup', $this->_getConnenctionType(), $config);
$installer = new Mage_Core_Model_Resource_Setup('core_setup');
$installer->startSetup();
//Get content from sample data
//Default sample data
//$tablePrefix = (string)Mage::getConfig()->getTablePrefix();
$tablePrefix = $data['db_prefix'];
$base_url = $data['unsecure_base_url'];
$base_surl = $base_url;
if (!empty($data['use_secure'])) {
$base_surl = $data['secure_base_url'];
}
/* Run sample_data.sql if found, by pass default sample data from Magento */
$file = Mage::getConfig()->getBaseDir() . '/sql/sample_data.sql';
if (is_file($file) && ($sqls = file_get_contents($file))) {
$sqls = str_replace('#__', $tablePrefix, $sqls);
$installer->run($sqls);
} else {
$file = Mage::getConfig()->getBaseDir() . '/sql/magento_sample_data_for_1.2.0.sql';
if (is_file($file) && ($sqls = file_get_contents($file))) {
$sqls = str_replace('#__', $tablePrefix, $sqls);
$installer->run($sqls);
}
}
$installer->run("\n\t\t\tUPDATE `{$tablePrefix}core_config_data` SET `value`='{$base_url}' where `path`='web/unsecure/base_url';\n\t\t\tUPDATE `{$tablePrefix}core_config_data` SET `value`='{$base_surl}' where `path`='web/secure/base_url';\n\t\t");
$installer->endSetup();
}
示例2: installQuickstartDB_
public function installQuickstartDB_ ($data) {
$config = array(
'host' => $data['db_host'],
'username' => $data['db_user'],
'password' => $data['db_pass'],
'dbname' => $data['db_name']
);
$connection = Mage::getSingleton('core/resource')->createConnection('core_setup', $this->_getConnenctionType(), $config);
$installer = new Mage_Core_Model_Resource_Setup('core_setup');
$installer->startSetup();
//Get content from quickstart data
$tablePrefix = $data['db_prefix'];
$base_url = $data['unsecure_base_url'];
$base_surl = $base_url;
if (!empty($data['use_secure'])) $base_surl = $data['secure_base_url'];
$file = Mage::getConfig()->getBaseDir().'/sql/'.$this->quickstart_db_name;
if (is_file($file) && ($sqls = file_get_contents ($file))) {
$sqls = str_replace ('#__', $tablePrefix, $sqls);
$installer->run ($sqls);
}
$installer->run ("
UPDATE `{$tablePrefix}core_config_data` SET `value`='$base_url' where `path`='web/unsecure/base_url';
UPDATE `{$tablePrefix}core_config_data` SET `value`='$base_surl' where `path`='web/secure/base_url';
"
);
$installer->endSetup();
}
示例3: startSetup
public function startSetup()
{
return parent::startSetup();
}
示例4: reinstallAction
public function reinstallAction()
{
$installer = new Mage_Core_Model_Resource_Setup('core_setup');
$installer->startSetup();
$installer->run("\n\t\t\tDELETE FROM {$installer->getTable('core_resource')} WHERE `{$installer->getTable('core_resource')}`.`code` = 'webpos_setup';\n\t\t");
$installer->endSetup();
echo $this->__('Successfully! Please refresh magento cache to get the new version');
}
示例5: startSetup
public function startSetup()
{
$this->lock();
$this->beforeFileExecution();
return parent::startSetup();
}
示例6: updatedb23Action
public function updatedb23Action()
{
$installer = new Mage_Core_Model_Resource_Setup();
$installer->startSetup();
$webposHelper = Mage::helper("webpos");
if (!$webposHelper->columnExist($installer->getTable('sales_flat_order'), 'webpos_admin_id')) {
$installer->run("ALTER TABLE {$installer->getTable('sales_flat_order')} ADD COLUMN `webpos_admin_id` int(10) default NULL");
}
if (!$webposHelper->columnExist($installer->getTable('sales_flat_order'), 'webpos_admin_name')) {
$installer->run("ALTER TABLE {$installer->getTable('sales_flat_order')} ADD COLUMN `webpos_admin_name` varchar(255) default NULL");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_user'), 'store_ids')) {
$installer->run("ALTER TABLE {$installer->getTable('webpos_user')} ADD `store_ids` VARCHAR(255) NOT NULL AFTER `user_id`;");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_transaction'), 'user_id')) {
$installer->run("ALTER TABLE {$installer->getTable('webpos_transaction')} ADD `user_id` int(4) unsigned DEFAULT NULL;");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_transaction'), 'till_id')) {
$installer->run("ALTER TABLE {$installer->getTable('webpos_transaction')} ADD `till_id` unsigned NULL DEFAULT 0;");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_transaction'), 'location_id')) {
$installer->run("ALTER TABLE {$installer->getTable('webpos_transaction')} ADD `location_id` unsigned NULL DEFAULT 0;");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'till_id')) {
$installer->run(" ALTER TABLE {$installer->getTable('sales/order')} ADD `till_id` int(11) unsigned NOT NULL DEFAULT 0; ");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'location_id')) {
$installer->run(" ALTER TABLE {$installer->getTable('sales/order')} ADD `location_id` int(11) unsigned NOT NULL DEFAULT 0; ");
}
if (!$webposHelper->columnExist($installer->getTable('sales/quote_payment'), 'ccforpos_ref_no')) {
$installer->run(" ALTER TABLE {$installer->getTable('sales/quote_payment')} ADD `ccforpos_ref_no` VARCHAR( 255 ) NOT NULL; ");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order_payment'), 'ccforpos_ref_no')) {
$installer->run(" ALTER TABLE {$installer->getTable('sales/order_payment')} ADD `ccforpos_ref_no` VARCHAR( 255 ) NOT NULL; ");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_order'), 'till_id')) {
$installer->run(" ALTER TABLE {$installer->getTable('webpos_order')} ADD `till_id` int(11) unsigned NOT NULL DEFAULT 0; ");
}
if (!$webposHelper->columnExist($installer->getTable('webpos_order'), 'location_id')) {
$installer->run(" ALTER TABLE {$installer->getTable('webpos_order')} ADD `location_id` int(11) unsigned NOT NULL DEFAULT 0; ");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_cash')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_cash` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_cash')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_cash` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_cash')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_cash` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_cash')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_cash` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_ccforpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_ccforpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_ccforpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_ccforpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_ccforpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_ccforpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_ccforpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_ccforpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_cp1forpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_cp1forpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_cp1forpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_cp1forpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_cp1forpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_cp1forpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_cp1forpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_cp1forpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_cp2forpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_cp2forpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_cp2forpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_cp2forpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_cp2forpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_cp2forpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_cp2forpos')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_cp2forpos` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_change')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_change` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/order'), 'webpos_base_change')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/order')} ADD COLUMN `webpos_base_change` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_change')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_change` decimal(12,4) NOT NULL default '0'");
}
if (!$webposHelper->columnExist($installer->getTable('sales/invoice'), 'webpos_base_change')) {
$installer->run("ALTER TABLE {$installer->getTable('sales/invoice')} ADD COLUMN `webpos_base_change` decimal(12,4) NOT NULL default '0'");
//.........这里部分代码省略.........