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


PHP Mage_Core_Model_Resource_Setup::applyAllUpdates方法代码示例

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


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

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

示例2: testApplyAllDataUpdates

 /**
  * @covers Mage_Core_Model_Resource_Setup::applyAllUpdates
  * @covers Mage_Core_Model_Resource_Setup::applyAllDataUpdates
  */
 public function testApplyAllDataUpdates()
 {
     /*reset versions*/
     Mage::getResourceModel('Mage_Core_Model_Resource_Resource')->setDbVersion('adminnotification_setup', false);
     Mage::getResourceModel('Mage_Core_Model_Resource_Resource')->setDataVersion('adminnotification_setup', false);
     $this->_model->deleteTableRow('core_resource', 'code', 'adminnotification_setup');
     $this->_model->getConnection()->dropTable($this->_model->getTable('adminnotification_inbox'));
     try {
         $this->_model->applyAllUpdates();
         $this->_model->applyAllDataUpdates();
     } catch (Exception $e) {
         $this->fail("Impossible to continue other tests, because database is broken: {$e}");
     }
     $this->assertNotEmpty($this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'version'));
     $this->assertNotEmpty($this->_model->getTableRow('core_resource', 'code', 'adminnotification_setup', 'data_version'));
 }
开发者ID:natxetee,项目名称:magento2,代码行数:20,代码来源:SetupTest.php

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

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

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

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

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

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

示例9: _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

示例10: init


//.........这里部分代码省略.........
     // check if local modules are disabled
     $disableLocalModules = (string) $this->getNode('global/disable_local_modules');
     $disableLocalModules = !empty($disableLocalModules) && ('true' === $disableLocalModules || '1' === $disableLocalModules);
     if ($disableLocalModules) {
         /**
          * Reset include path
          */
         set_include_path(BP . '/app/code/community' . PS . BP . '/app/code/core' . PS . BP . '/lib' . PS . Mage::registry('original_include_path'));
     }
     Varien_Profiler::start('config/load-cache');
     if (Mage::app()->isInstalled()) {
         if ($this->loadCache()) {
             if (!Mage::app()->useCache('config')) {
                 Mage::app()->removeCache($this->getCacheId());
             } else {
                 Varien_Profiler::stop('config/load-cache');
                 return $this;
             }
         }
         if (!Mage::app()->useCache('config')) {
             $saveCache = false;
         }
     } else {
         $saveCache = false;
     }
     Varien_Profiler::stop('config/load-cache');
     $mergeConfig = new Mage_Core_Model_Config_Base();
     /**
      * Load base configuration data
      */
     Varien_Profiler::start('config/load-base');
     $configFile = $etcDir . DS . 'config.xml';
     $this->loadFile($configFile);
     $moduleFiles = glob($etcDir . DS . 'modules' . DS . '*.xml');
     if ($moduleFiles) {
         foreach ($moduleFiles as $file) {
             $mergeConfig->loadFile($file);
             $this->extend($mergeConfig);
         }
     }
     Varien_Profiler::stop('config/load-base');
     /**
      * Load local configuration data
      */
     Varien_Profiler::start('config/load-local');
     $configFile = $etcDir . DS . 'local.xml';
     if (is_readable($configFile)) {
         $mergeConfig->loadFile($configFile);
         $this->extend($mergeConfig);
         $localConfigLoaded = true;
     } else {
         $localConfigLoaded = false;
     }
     Varien_Profiler::stop('config/load-local');
     if (!$localConfigLoaded) {
         Varien_Profiler::start('config/load-distro');
         $mergeConfig->loadString($this->loadDistroConfig());
         $this->extend($mergeConfig, true);
         Varien_Profiler::stop('config/load-distro');
         $saveCache = false;
     }
     /**
      * Load modules configuration data
      */
     Varien_Profiler::start('config/load-modules');
     $modules = $this->getNode('modules')->children();
     foreach ($modules as $modName => $module) {
         if ($module->is('active')) {
             if ($disableLocalModules && 'local' === (string) $module->codePool) {
                 continue;
             }
             $configFile = $this->getModuleDir('etc', $modName) . DS . 'config.xml';
             if ($mergeConfig->loadFile($configFile)) {
                 $this->extend($mergeConfig, true);
             }
         }
     }
     Varien_Profiler::stop('config/load-modules');
     Varien_Profiler::start('config/apply-extends');
     $this->applyExtends();
     Varien_Profiler::stop('config/apply-extends');
     /**
      * Load configuration from DB
      */
     if ($localConfigLoaded) {
         Varien_Profiler::start('dbUpdates');
         Mage_Core_Model_Resource_Setup::applyAllUpdates();
         Varien_Profiler::stop('dbUpdates');
         Varien_Profiler::start('config/load-db');
         $dbConf = Mage::getResourceModel('core/config');
         $dbConf->loadToXml($this);
         Varien_Profiler::stop('config/load-db');
     }
     if ($saveCache) {
         Varien_Profiler::start('config/save-cache');
         $this->saveCache();
         Varien_Profiler::stop('config/save-cache');
     }
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:101,代码来源:Config.php

示例11: _install

 /**
  * Install application using temporary directory and vendor-specific database settings
  *
  * @throws Magento_Exception
  */
 protected function _install()
 {
     $this->_ensureDirExists($this->_installDir);
     $this->_ensureDirExists($this->_installEtcDir);
     $this->_ensureDirExists($this->_installDir . DIRECTORY_SEPARATOR . 'media');
     $this->_ensureDirExists($this->_installDir . DIRECTORY_SEPARATOR . 'theme');
     /* Copy *.xml configuration files */
     $dirs = array($this->_installEtcDir => $this->_globalEtcFiles, $this->_installEtcDir . '/modules' => $this->_moduleEtcFiles);
     foreach ($dirs as $targetEtcDir => $sourceEtcFiles) {
         $this->_ensureDirExists($targetEtcDir);
         foreach ($sourceEtcFiles as $sourceEtcFile) {
             $targetEtcFile = $targetEtcDir . '/' . basename($sourceEtcFile);
             copy($sourceEtcFile, $targetEtcFile);
         }
     }
     /* Make sure that local.xml contains an invalid installation date */
     $installDate = (string) $this->_localXml->global->install->date;
     if ($installDate && strtotime($installDate)) {
         throw new Magento_Exception("Configuration file '{$this->_localXmlFile}' must contain an invalid installation date.");
     }
     /* Replace local.xml */
     $targetLocalXml = $this->_installEtcDir . '/local.xml';
     $this->_localXml->asNiceXml($targetLocalXml);
     /* Initialize an application in non-installed mode */
     $this->initialize();
     /* Run all install and data-install scripts */
     Mage_Core_Model_Resource_Setup::applyAllUpdates();
     Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
     /* Enable configuration cache by default in order to improve tests performance */
     Mage::app()->getCacheInstance()->saveOptions(array('config' => 1));
     /* Fill installation date in local.xml to indicate that application is installed */
     $localXml = file_get_contents($targetLocalXml);
     $localXml = str_replace($installDate, date('r'), $localXml, $replacementCount);
     if ($replacementCount != 1) {
         throw new Magento_Exception("Unable to replace installation date properly in '{$targetLocalXml}' file.");
     }
     file_put_contents($targetLocalXml, $localXml, LOCK_EX);
     /* Add predefined admin user to the system */
     $this->_createAdminUser();
     /* Switch an application to installed mode */
     $this->initialize();
 }
开发者ID:natxetee,项目名称:magento2,代码行数:47,代码来源:Bootstrap.php

示例12: endInstall

 /**
  * End install package(s)
  *
  */
 public function endInstall()
 {
     if ($this->isInstalled()) {
         try {
             if (!empty($_GET['clean_sessions'])) {
                 Mage::app()->cleanAllSessions();
             }
             Mage::app()->cleanCache();
         } catch (Exception $e) {
             $this->session()->addMessage('error', "Exception during cache and session cleaning: " . $e->getMessage());
         }
         // reinit config and apply all updates
         Mage::app()->getConfig()->reinit();
         Mage_Core_Model_Resource_Setup::applyAllUpdates();
         Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
     }
     if ($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());
         }
     }
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:33,代码来源:Controller.php

示例13: 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);
     }
     if (!empty($data['enable_charts'])) {
         $setupModel->setConfigData(Mage_Adminhtml_Block_Dashboard::XML_PATH_ENABLE_CHARTS, 1);
     } else {
         $setupModel->setConfigData(Mage_Adminhtml_Block_Dashboard::XML_PATH_ENABLE_CHARTS, 0);
     }
     if (!empty($data['admin_no_form_key'])) {
         $setupModel->setConfigData('admin/security/use_form_key', 0);
     }
     $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 = $this->getDataModel()->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']);
     }
     if (!empty($data['order_increment_prefix'])) {
         $this->_setOrderIncrementPrefix($setupModel, $data['order_increment_prefix']);
     }
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:58,代码来源:Installer.php

示例14: init

 /**
  * Initialization of core configuration
  *
  * @return Mage_Core_Model_Config
  */
 public function init($options = array())
 {
     $this->setCacheChecksum(null);
     $saveCache = true;
     $this->_options = new Mage_Core_Model_Config_Options($options);
     $etcDir = $this->getOptions()->getEtcDir();
     $this->_customEtcDir = $etcDir;
     $localConfigLoaded = $this->loadFile($etcDir . DS . 'local.xml');
     // check if local modules are disabled
     $disableLocalModules = (string) $this->getNode('global/disable_local_modules');
     $disableLocalModules = !empty($disableLocalModules) && ('true' === $disableLocalModules || '1' === $disableLocalModules);
     if ($disableLocalModules) {
         /**
          * Reset include path
          */
         $codeDir = $this->getOptions()->getCodeDir();
         $libDir = $this->getOptions()->getLibDir();
         set_include_path(BP . DS . 'app' . DS . 'code' . DS . 'community' . PS . BP . DS . 'app' . DS . 'code' . DS . 'core' . PS . BP . DS . 'lib' . PS . Mage::registry('original_include_path'));
     }
     if (Mage::isInstalled()) {
         if (Mage::app()->useCache('config')) {
             Varien_Profiler::start('mage::app::init::config::load_cache');
             $loaded = $this->loadCache();
             Varien_Profiler::stop('mage::app::init::config::load_cache');
             if ($loaded) {
                 return $this;
             }
         }
     }
     $mergeConfig = new Mage_Core_Model_Config_Base();
     /**
      * Load base configuration data
      */
     Varien_Profiler::start('config/load-base');
     $configFile = $etcDir . DS . 'config.xml';
     $this->loadFile($configFile);
     Varien_Profiler::stop('config/load-base');
     $this->_loadDeclaredModules($mergeConfig);
     /**
      * Load modules configuration data
      */
     Varien_Profiler::start('config/load-modules');
     $modules = $this->getNode('modules')->children();
     foreach ($modules as $modName => $module) {
         if ($module->is('active')) {
             if ($disableLocalModules && 'local' === (string) $module->codePool) {
                 continue;
             }
             $configFile = $this->getModuleDir('etc', $modName) . DS . 'config.xml';
             if ($mergeConfig->loadFile($configFile)) {
                 $this->extend($mergeConfig, true);
             }
         }
     }
     Varien_Profiler::stop('config/load-modules');
     /**
      * Load local configuration data
      */
     Varien_Profiler::start('config/load-local');
     $configFile = $etcDir . DS . 'local.xml';
     if (is_readable($configFile)) {
         $mergeConfig->loadFile($configFile);
         $this->extend($mergeConfig);
     }
     Varien_Profiler::stop('config/load-local');
     Varien_Profiler::start('config/apply-extends');
     $this->applyExtends();
     Varien_Profiler::stop('config/apply-extends');
     /**
      * Load configuration from DB
      */
     if ($localConfigLoaded) {
         Varien_Profiler::start('dbUpdates');
         Mage_Core_Model_Resource_Setup::applyAllUpdates();
         Varien_Profiler::stop('dbUpdates');
         Varien_Profiler::start('config/load-db');
         $dbConf = $this->getResourceModel();
         $dbConf->loadToXml($this);
         Varien_Profiler::stop('config/load-db');
     }
     if (Mage::app()->useCache('config')) {
         Varien_Profiler::start('config/save-cache');
         $this->saveCache(array('config'));
         Varien_Profiler::stop('config/save-cache');
     }
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:92,代码来源:Config.php

示例15: _runNamedSetupResource

 /**
  * Runs a single named setup resource
  *
  * This method nukes the global/resources node in the global config
  * and then repopulates it with **only** the $name resource. Then it
  * calls the standard Contao `applyAllUpdates` method.
  *
  * The benefit of this approach is we don't need to recreate the entire
  * setup resource running logic ourselves.  Yay for code reuse
  *
  * The downside is we should probably exit quickly, as anything else that
  * uses the global/resources node is going to behave weird.
  *
  * @todo Repopulate global config after running?  Non trivial since setNode escapes strings
  *
  * @param string $name
  * @param bool $needsUpdate
  * @param string $type
  * @throws \Exception
  * @internal param $string
  */
 protected function _runNamedSetupResource($name, $needsUpdate, $type)
 {
     $output = $this->_output;
     if (!in_array($type, array(self::TYPE_MIGRATION_STRUCTURE, self::TYPE_MIGRATION_DATA))) {
         throw new \Exception('Invalid Type [' . $type . ']: structure, data are valid');
     }
     if (!array_key_Exists($name, $needsUpdate)) {
         $output->writeln('<error>No updates to run for ' . $name . ', skipping </error>');
         return;
     }
     //remove all other setup resources from configuration
     //(in memory, do not persist this to cache)
     $realConfig = \Mage::getConfig();
     $resources = $realConfig->getNode('global/resources');
     foreach ($resources->children() as $resource) {
         if (!$resource->setup) {
             continue;
         }
         unset($resource->setup);
     }
     //recreate our specific node in <global><resources></resource></global>
     //allows for theoretical multiple runs
     $setupResource = $needsUpdate[$name];
     $setupResourceConfig = $this->_secondConfig->getNode('global/resources/' . $name);
     $moduleName = $setupResourceConfig->setup->module;
     $className = $setupResourceConfig->setup->class;
     $specificResource = $realConfig->getNode('global/resources/' . $name);
     $setup = $specificResource->addChild('setup');
     if ($moduleName) {
         $setup->addChild('module', $moduleName);
     } else {
         $output->writeln('<error>No module node configured for ' . $name . ', possible configuration error </error>');
     }
     if ($className) {
         $setup->addChild('class', $className);
     }
     //and finally, RUN THE UPDATES
     try {
         ob_start();
         if ($type == self::TYPE_MIGRATION_STRUCTURE) {
             $this->_stashEventContext();
             \Mage_Core_Model_Resource_Setup::applyAllUpdates();
             $this->_restoreEventContext();
         } else {
             if ($type == self::TYPE_MIGRATION_DATA) {
                 \Mage_Core_Model_Resource_Setup::applyAllDataUpdates();
             }
         }
         $exceptionOutput = ob_get_clean();
         $this->_output->writeln($exceptionOutput);
     } catch (\Exception $e) {
         $exceptionOutput = ob_get_clean();
         $this->_processExceptionDuringUpdate($e, $name, $setupResource, $exceptionOutput);
         if ($this->_input->getOption('stop-on-error')) {
             throw new \RuntimeException('Setup stopped with errors');
         }
     }
 }
开发者ID:iMi-digital,项目名称:imi-conrun,代码行数:79,代码来源:IncrementalCommand.php


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