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


PHP Mage_Core_Model_Resource_Setup类代码示例

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


在下文中一共展示了Mage_Core_Model_Resource_Setup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: setUp

 protected function setUp()
 {
     $installer = new Mage_Core_Model_Resource_Setup(Mage_Core_Model_Resource_Setup::DEFAULT_SETUP_CONNECTION);
     $this->_connection = $installer->getConnection();
     $this->_tableName = $installer->getTable('table_two_column_idx');
     $this->_oneColumnIdxName = $installer->getIdxName($this->_tableName, array('column1'));
     $this->_twoColumnIdxName = $installer->getIdxName($this->_tableName, array('column1', 'column2'));
     $table = $this->_connection->newTable($this->_tableName)->addColumn('id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), 'Id')->addColumn('column1', Varien_Db_Ddl_Table::TYPE_INTEGER)->addColumn('column2', Varien_Db_Ddl_Table::TYPE_INTEGER)->addIndex($this->_oneColumnIdxName, array('column1'))->addIndex($this->_twoColumnIdxName, array('column1', 'column2'));
     $this->_connection->createTable($table);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:10,代码来源:InterfaceTest.php

示例4: execute

 /**
  * @param InputInterface   $input
  * @param OutputInterface $output
  * @return int|null
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->getApplication()->setAutoExit(false);
     $this->detectMagento($output);
     if (!$this->initMagento()) {
         return;
     }
     try {
         if (false === $input->getOption('no-implicit-cache-flush')) {
             $this->flushCache();
         }
         /**
          * Put output in buffer. \Mage_Core_Model_Resource_Setup::_modifyResourceDb should print any error
          * directly to stdout. Use execption which will be thrown to show error
          */
         \ob_start();
         \Mage_Core_Model_Resource_Setup::applyAllUpdates();
         if (is_callable(array('\\Mage_Core_Model_Resource_Setup', 'applyAllDataUpdates'))) {
             \Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
         }
         \ob_end_clean();
         $output->writeln('<info>done</info>');
     } catch (Exception $e) {
         \ob_end_clean();
         $this->printException($output, $e);
         $this->printStackTrace($output, $e->getTrace());
         $this->printFile($output, $e);
         return 1;
         // exit with error status
     }
 }
开发者ID:netz98,项目名称:n98-magerun,代码行数:36,代码来源:RunCommand.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: replaceUniqueKey

 /**
  * Replace unique key
  * 
  * @param Mage_Core_Model_Resource_Setup $setup
  * @param string $tableName
  * @param string $keyName
  * @param array $keyAttributes
  * @return Innoexts_InnoCore_Helper_Database
  */
 public function replaceUniqueKey($setup, $tableName, $keyName, $keyAttributes)
 {
     $connection = $setup->getConnection();
     $versionHelper = $this->getVersionHelper();
     $table = $setup->getTable($tableName);
     if ($versionHelper->isGe1600()) {
         $indexTypeUnique = Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE;
         $indexes = $connection->getIndexList($table);
         foreach ($indexes as $index) {
             if ($index['INDEX_TYPE'] == $indexTypeUnique) {
                 $connection->dropIndex($table, $index['KEY_NAME']);
             }
         }
         $keyName = $setup->getIdxName($tableName, $keyAttributes, $indexTypeUnique);
         $connection->addIndex($table, $keyName, $keyAttributes, $indexTypeUnique);
     } else {
         $connection->addKey($table, $keyName, $keyAttributes, 'unique');
     }
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:29,代码来源:Database.php

示例7: resourceGetTableName

 /**
  * This is a first observer in magento
  * where we can update module list and configuration.
  *
  * @param $observer
  */
 public function resourceGetTableName($observer)
 {
     if ($observer->getTableName() !== 'core_website') {
         return;
     }
     try {
         Mage::getSingleton('eltrino_compatibility/modules')->loadModules();
         Mage_Core_Model_Resource_Setup::applyAllUpdates();
     } catch (Exception $e) {
         Mage::logException($e);
     }
 }
开发者ID:ThomasNegeli,项目名称:Compatibility,代码行数:18,代码来源:Observer.php

示例8: 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

示例9: execute

 /**
  * @see vendor/symfony/src/Symfony/Component/Console/Command/Symfony\Component\Console\Command.Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->preExecute($input, $output);
     $this->createExtensionFolder();
     foreach ($this->config->getExtensions() as $name => $extension) {
         $this->installExtension($name, $extension);
     }
     $this->initMagento();
     \Mage_Core_Model_Resource_Setup::applyAllUpdates();
     \Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
     \Mage::getModel('core/cache')->flush();
     Logger::notice('Done');
 }
开发者ID:nickw108,项目名称:jumpstorm,代码行数:16,代码来源:Extensions.php

示例10: execute

 public function execute()
 {
     Mage::app('admin');
     \Mage_Core_Model_Resource_Setup::applyAllUpdates();
     \Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
     try {
         $this->setup();
     } catch (Exception $e) {
         $msg .= $e->getMessage() . ' (' . $e->getFile() . ' l. ' . $e->getLine() . ")\n";
         Logger::error('An error occured while initializing InitGermanSetup:', array(), false);
         Logger::log('%s (%s, line %s)', array($e->getMessage(), $e->getFile(), $e->getLine()));
     }
 }
开发者ID:netresearch,项目名称:jumpstorm,代码行数:13,代码来源:InitGermanSetup.php

示例11: applyUpdates

 /**
  * Do not install module if Magento is not installed yet.
  * This prevents error during Mage_Cms data install.
  *
  * @see Mage_Core_Model_Resource_Setup::applyUpdates()
  */
 public function applyUpdates()
 {
     if (!Mage::isInstalled()) {
         $modules = Mage::getConfig()->getNode('modules')->children();
         $myModule = substr(__CLASS__, 0, strpos(__CLASS__, '_Model'));
         foreach ($modules as $moduleName => $moduleNode) {
             if ($moduleName != $myModule) {
                 Mage::getConfig()->addAllowedModules($moduleName);
             }
         }
         Mage::getConfig()->reinit();
         return $this;
     }
     return parent::applyUpdates();
 }
开发者ID:technomagegithub,项目名称:olgo.nl,代码行数:21,代码来源:Setup.php

示例12: flush

 /**
  * Flush an entire magento cache
  * 
  * @return Aitoc_Aitsys_Model_Core_Cache
  */
 public function flush()
 {
     if (version_compare(Mage::getVersion(), '1.4', '>=')) {
         Mage::app()->getCacheInstance()->flush();
     } else {
         Mage::app()->getCache()->clean();
     }
     Mage::getConfig()->reinit();
     if (sizeof(Mage::getConfig()->getNode('aitsys')->events)) {
         Mage::app()->addEventArea('aitsys');
     }
     if (!Mage::app()->getUpdateMode()) {
         Mage_Core_Model_Resource_Setup::applyAllUpdates();
     }
     return $this;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:21,代码来源:Cache.php

示例13: execute

 /**
  * @param InputInterface   $input
  * @param OutputInterface $output
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->getApplication()->setAutoExit(false);
     $this->detectMagento($output);
     if ($this->initMagento()) {
         try {
             /**
              * Get events before cache flush command is called.
              */
             $reflectionApp = new \ReflectionObject(\Mage::app());
             $appEventReflectionProperty = $reflectionApp->getProperty('_events');
             $appEventReflectionProperty->setAccessible(true);
             $eventsBeforeCacheFlush = $appEventReflectionProperty->getValue(\Mage::app());
             $this->getApplication()->run(new StringInput('cache:flush'), new NullOutput());
             /**
              * Restore initially loaded events which was reset during setup script run
              */
             $appEventReflectionProperty->setValue(\Mage::app(), $eventsBeforeCacheFlush);
             /**
              * Put output in buffer. \Mage_Core_Model_Resource_Setup::_modifyResourceDb should print any error
              * directly to stdout. Use execption which will be thrown to show error
              */
             \ob_start();
             \Mage_Core_Model_Resource_Setup::applyAllUpdates();
             if (is_callable(array('\\Mage_Core_Model_Resource_Setup', 'applyAllDataUpdates'))) {
                 \Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
             }
             \ob_end_clean();
             $output->writeln('<info>done</info>');
         } catch (\Exception $e) {
             \ob_end_clean();
             $this->printException($output, $e);
             $this->printStackTrace($output, $e->getTrace());
             $this->printFile($output, $e);
             return 1;
             // exit with error status
         }
     }
     return 0;
 }
开发者ID:lslab,项目名称:n98-magerun,代码行数:45,代码来源:RunCommand.php

示例14: endSetup

 public function endSetup()
 {
     $cacheKey = Mage::helper('M2ePro/Module')->getName() . '_VERSION_UPDATER';
     Mage::app()->getCache()->remove($cacheKey);
     Mage::helper('M2ePro/Data')->removeAllCacheValues();
     return parent::endSetup();
 }
开发者ID:par-orillonsoft,项目名称:app,代码行数:7,代码来源:MySqlSetup.php

示例15: endSetup

 public function endSetup()
 {
     $this->removeConfigDuplicates();
     $this->updateInstallationVersionHistory();
     Mage::helper('M2ePro/Module')->clearCache();
     return parent::endSetup();
 }
开发者ID:xiaoguizhidao,项目名称:ecommerce,代码行数:7,代码来源:MySqlSetup.php


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