• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mage_Core_Model_Resource_Setup类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: cleanCache

 protected function cleanCache()
 {
     $result = true;
     $message = '';
     try {
         if ($this->isInstalled()) {
             if (!empty($_REQUEST['clean_sessions'])) {
                 Mage::app()->cleanAllSessions();
                 $message .= 'Session cleaned successfully. ';
             }
             Mage::app()->cleanCache();
             // reinit config and apply all updates
             Mage::app()->getConfig()->reinit();
             Mage_Core_Model_Resource_Setup::applyAllUpdates();
             Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
             $message .= 'Cache cleaned successfully';
         } else {
             $result = true;
         }
     } catch (Exception $e) {
         $result = false;
         $message = "Exception during cache and session cleaning: " . $e->getMessage();
         $this->session()->addMessage('error', $message);
     }
     if ($result && $this->_getMaintenanceFlag()) {
         $maintenance_filename = 'maintenance.flag';
         $config = $this->config();
         if (!$this->isWritable() && strlen($config->__get('remote_config')) > 0) {
             $ftpObj = new Mage_Connect_Ftp();
             $ftpObj->connect($config->__get('remote_config'));
             $ftpObj->delete($maintenance_filename);
             $ftpObj->close();
         } else {
             @unlink($this->_getMaintenanceFilePath());
         }
     }
     return array('result' => $result, 'message' => $message);
 }
开发者ID:lightyoruichi,项目名称:Magento-Pre-Patched-Files,代码行数:38,代码来源:Controller.php


示例15: installDb

 /**
  * Database installation
  *
  * @return Mage_Install_Model_Installer
  */
 public function installDb()
 {
     Mage_Core_Model_Resource_Setup::applyAllUpdates();
     $data = $this->getDataModel()->getConfigData();
     /**
      * Saving host information into DB
      */
     $setupModel = new Mage_Core_Model_Resource_Setup('core_setup');
     if (!empty($data['use_rewrites'])) {
         $setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_USE_REWRITES, 1);
     }
     $unsecureBaseUrl = Mage::getBaseUrl('web');
     if (!empty($data['unsecure_base_url'])) {
         $unsecureBaseUrl = $data['unsecure_base_url'];
         $setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_UNSECURE_BASE_URL, $unsecureBaseUrl);
     }
     if (!empty($data['use_secure'])) {
         $setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_IN_FRONTEND, 1);
         $setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL, $data['secure_base_url']);
         if (!empty($data['use_secure_admin'])) {
             $setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_IN_ADMINHTML, 1);
         }
     } elseif (!empty($data['unsecure_base_url'])) {
         $setupModel->setConfigData(Mage_Core_Model_Store::XML_PATH_SECURE_BASE_URL, $unsecureBaseUrl);
     }
     /**
      * Saving locale information into DB
      */
     $locale = Mage::getSingleton('install/session')->getLocaleData();
     if (!empty($locale['locale'])) {
         $setupModel->setConfigData(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $locale['locale']);
     }
     if (!empty($locale['timezone'])) {
         $setupModel->setConfigData(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE, $locale['timezone']);
     }
     if (!empty($locale['currency'])) {
         $setupModel->setConfigData(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE, $locale['currency']);
         $setupModel->setConfigData(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_DEFAULT, $locale['currency']);
         $setupModel->setConfigData(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_ALLOW, $locale['currency']);
     }
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:47,代码来源:Installer.php


示例16: install

 /**
  * Install Magento
  *
  * @param array $options
  * @return string|boolean
  */
 public function install(array $options)
 {
     try {
         $options = $this->_getInstallOptions($options);
         if (!$options) {
             return false;
         }
         /**
          * Check if already installed
          */
         if (Mage::isInstalled()) {
             $this->addError('ERROR: Magento is already installed.');
             return false;
         }
         /**
          * Skip URL validation, if set
          */
         $this->_getDataModel()->setSkipUrlValidation($options['skip_url_validation']);
         $this->_getDataModel()->setSkipBaseUrlValidation($options['skip_url_validation']);
         /**
          * Locale settings
          */
         $this->_getDataModel()->setLocaleData(array('locale' => $options['locale'], 'timezone' => $options['timezone'], 'currency' => $options['default_currency']));
         /**
          * Database and web config
          */
         $this->_getDataModel()->setConfigData(array('db_model' => $options['db_model'], 'db_host' => $options['db_host'], 'db_name' => $options['db_name'], 'db_user' => $options['db_user'], 'db_pass' => $options['db_pass'], 'db_prefix' => $options['db_prefix'], 'use_rewrites' => $this->_getFlagValue($options['use_rewrites']), 'use_secure' => $this->_getFlagValue($options['use_secure']), 'unsecure_base_url' => $options['url'], 'secure_base_url' => $options['secure_base_url'], 'use_secure_admin' => $this->_getFlagValue($options['use_secure_admin']), 'session_save' => $this->_checkSessionSave($options['session_save']), 'backend_frontname' => $this->_checkBackendFrontname($options['backend_frontname']), 'admin_no_form_key' => $this->_getFlagValue($options['admin_no_form_key']), 'skip_url_validation' => $this->_getFlagValue($options['skip_url_validation']), 'enable_charts' => $this->_getFlagValue($options['enable_charts']), 'order_increment_prefix' => $options['order_increment_prefix']));
         /**
          * Primary admin user
          */
         $this->_getDataModel()->setAdminData(array('firstname' => $options['admin_firstname'], 'lastname' => $options['admin_lastname'], 'email' => $options['admin_email'], 'username' => $options['admin_username'], 'new_password' => $options['admin_password']));
         $installer = $this->_getInstaller();
         /**
          * Install configuration
          */
         $installer->installConfig($this->_getDataModel()->getConfigData());
         if (!empty($options['cleanup_database'])) {
             $this->_cleanUpDatabase();
         }
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Install database
          */
         $installer->installDb();
         if ($this->hasErrors()) {
             return false;
         }
         // apply data updates
         Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
         /**
          * Validate entered data for administrator user
          */
         $user = $installer->validateAndPrepareAdministrator($this->_getDataModel()->getAdminData());
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Prepare encryption key and validate it
          */
         $encryptionKey = empty($options['encryption_key']) ? $this->generateEncryptionKey() : $options['encryption_key'];
         $this->_getDataModel()->setEncryptionKey($encryptionKey);
         $installer->validateEncryptionKey($encryptionKey);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Create primary administrator user
          */
         $installer->createAdministrator($user);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Save encryption key or create if empty
          */
         $installer->installEnryptionKey($encryptionKey);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Installation finish
          */
         $installer->finish();
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Change directories mode to be writable by apache user
          */
         $this->_filesystem->changePermissions(Mage::getBaseDir('var'), 0777, true);
         return $encryptionKey;
     } catch (Exception $e) {
//.........这里部分代码省略.........
开发者ID:natxetee,项目名称:magento2,代码行数:101,代码来源:Console.php


示例17: define

<?php

define('_TEST', true);
require_once '../app/Mage.php';
Mage::app("default")->setUseSessionInUrl(false);
Mage::setIsDeveloperMode(true);
Mage_Core_Model_Resource_Setup::applyAllUpdates();
if (!function_exists('test_autoload')) {
    function test_autoload($class)
    {
        $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
        if (file_exists($file)) {
            require_once $file;
        }
    }
    spl_autoload_register('test_autoload');
}
Mana_Core_Test_Case::installTestData();
开发者ID:vivek0198,项目名称:Mana_Core,代码行数:18,代码来源:Bootstrap.php


示例18: _initModules

 /**
  * Initialize active modules configuration and data
  *
  * @return Mage_Core_Model_App
  */
 protected function _initModules()
 {
     if (!$this->_config->loadModulesCache()) {
         $this->_config->loadModules();
         if ($this->_config->isLocalConfigLoaded() && !$this->_shouldSkipProcessModulesUpdates()) {
             Varien_Profiler::start('mage::app::init::apply_db_schema_updates');
             Mage_Core_Model_Resource_Setup::applyAllUpdates();
             Varien_Profiler::stop('mage::app::init::apply_db_schema_updates');
         }
         $this->_config->loadDb();
         $this->_config->saveCache();
     }
     return $this;
 }
开发者ID:mswebdesign,项目名称:Mswebdesign_Magento_1_Community_Edition,代码行数:19,代码来源:App.php


示例19: install

 /**
  * Install Magento
  *
  * @return boolean
  */
 public function install()
 {
     try {
         /**
          * Check if already installed
          */
         if (Mage::isInstalled()) {
             $this->addError('ERROR: Magento is already installed');
             return false;
         }
         /**
          * Skip URL validation, if set
          */
         $this->_getDataModel()->setSkipUrlValidation($this->_args['skip_url_validation']);
         $this->_getDataModel()->setSkipBaseUrlValidation($this->_args['skip_url_validation']);
         /**
          * Prepare data
          */
         $this->_prepareData();
         if ($this->hasErrors()) {
             return false;
         }
         $installer = $this->_getInstaller();
         /**
          * Install configuration
          */
         $installer->installConfig($this->_getDataModel()->getConfigData());
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Reinitialize configuration (to use new config data)
          */
         $this->_app->cleanCache();
         Mage::getConfig()->reinit();
         /**
          * Install database
          */
         $installer->installDb();
         if ($this->hasErrors()) {
             return false;
         }
         // apply data updates
         Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
         /**
          * Validate entered data for administrator user
          */
         $user = $installer->validateAndPrepareAdministrator($this->_getDataModel()->getAdminData());
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Prepare encryption key and validate it
          */
         $encryptionKey = empty($this->_args['encryption_key']) ? md5(Mage::helper('core')->getRandomString(10)) : $this->_args['encryption_key'];
         $this->_getDataModel()->setEncryptionKey($encryptionKey);
         $installer->validateEncryptionKey($encryptionKey);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Create primary administrator user
          */
         $installer->createAdministrator($user);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Save encryption key or create if empty
          */
         $installer->installEnryptionKey($encryptionKey);
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Installation finish
          */
         $installer->finish();
         if ($this->hasErrors()) {
             return false;
         }
         /**
          * Change directories mode to be writable by apache user
          */
         @chmod('var/cache', 0777);
         @chmod('var/session', 0777);
     } catch (Exception $e) {
         $this->addError('ERROR: ' . $e->getMessage());
         return false;
     }
     return true;
 }
开发者ID:okite11,项目名称:frames21,代码行数:97,代码来源:Console.php


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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mage_Core_Model_Session_Abstract类代码示例发布时间:2022-05-23
下一篇:
PHP Mage_Core_Model_Resource_Db_Collection_Abstract类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap