当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Model_Resource_Setup::run方法代码示例

本文整理汇总了PHP中Mage_Core_Model_Resource_Setup::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Resource_Setup::run方法的具体用法?PHP Mage_Core_Model_Resource_Setup::run怎么用?PHP Mage_Core_Model_Resource_Setup::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Core_Model_Resource_Setup的用法示例。


在下文中一共展示了Mage_Core_Model_Resource_Setup::run方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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();
    }
开发者ID:amal-nibaya,项目名称:PB-BEERSHOP,代码行数:30,代码来源:Quickstart.php

示例2: 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();
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:42,代码来源:Sample.php

示例3: trySql

 /**
  * @param Mage_Core_Model_Resource_Setup $installer
  * @param string                         $sql
  */
 public function trySql($installer, $sql)
 {
     try {
         $installer->run($sql);
     } catch (Exception $e) {
         //            throw $e;
     }
 }
开发者ID:cesarfelip3,项目名称:clevermage_new,代码行数:12,代码来源:Migration.php

示例4: run

 public function run($sql)
 {
     if (trim($sql) == '') {
         return $this;
     }
     $sql = $this->prepareSql($sql);
     return parent::run($sql);
 }
开发者ID:ppkowalski,项目名称:M2E,代码行数:8,代码来源:MySqlSetup.php

示例5: getMovementReportCollection

 public function getMovementReportCollection($requestData)
 {
     //variable request data
     $report_type = isset($requestData['report_radio_select']) ? $requestData['report_radio_select'] : null;
     $warehouse = isset($requestData['warehouse_select']) ? $requestData['warehouse_select'] : null;
     $timeRange = Mage::helper('inventoryreports')->getTimeRange($requestData);
     /* Prepare Collection */
     //switch report type
     $dbResource = new Mage_Core_Model_Resource_Setup('core_setup');
     $dbResource->run('SET SESSION group_concat_max_len = 999999;');
     switch ($report_type) {
         case 'stock_in':
             return $this->getStockInCollection($timeRange['from'], $timeRange['to'], $warehouse);
         case 'stock_out':
             return $this->getStockOutCollection($timeRange['from'], $timeRange['to'], $warehouse);
     }
 }
开发者ID:javik223,项目名称:Evron-Magento,代码行数:17,代码来源:Stockmovement.php

示例6: perform

 public function perform()
 {
     $this->db->run($this->args['q']);
 }
开发者ID:zlik,项目名称:magento-resque,代码行数:4,代码来源:Job.php

示例7: 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');
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:8,代码来源:ProductController.php

示例8: run

 public function run($sql)
 {
     if (trim($sql) == '') {
         return $this;
     }
     foreach ($this->getTablesObject()->getAllHistoryEntities() as $tableNameFrom => $tableNameTo) {
         $tableNameFrom = $tableNameFrom == 'ess_config' ? $tableNameFrom : Ess_M2ePro_Model_Upgrade_Tables::M2E_PRO_TABLE_PREFIX . $tableNameFrom;
         $sql = str_replace(' `' . $tableNameFrom . '`', ' `' . $tableNameTo . '`', $sql);
         $sql = str_replace(' ' . $tableNameFrom, ' `' . $tableNameTo . '`', $sql);
     }
     return parent::run($sql);
 }
开发者ID:sergoslav,项目名称:magento-extension,代码行数:12,代码来源:MySqlSetup.php

示例9: 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'");
//.........这里部分代码省略.........
开发者ID:javik223,项目名称:Evron-Magento,代码行数:101,代码来源:ProductController.php


注:本文中的Mage_Core_Model_Resource_Setup::run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。