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

PHP App\DeploymentConfig类代码示例

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

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



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

示例1: __construct

 /**
  * @param \Magento\Framework\Math\Random $randomGenerator
  * @param DeploymentConfig $deploymentConfig
  */
 public function __construct(\Magento\Framework\Math\Random $randomGenerator, DeploymentConfig $deploymentConfig)
 {
     $this->randomGenerator = $randomGenerator;
     // load all possible keys
     $this->keys = preg_split('/\\s+/s', trim($deploymentConfig->get(self::PARAM_CRYPT_KEY)));
     $this->keyVersion = count($this->keys) - 1;
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:11,代码来源:Encryptor.php


示例2: testRemoveModulesFromDeploymentConfig

 public function testRemoveModulesFromDeploymentConfig()
 {
     $this->output->expects($this->atLeastOnce())->method('writeln');
     $this->deploymentConfig->expects($this->once())->method('getConfigData')->willReturn(['moduleA' => 1, 'moduleB' => 1, 'moduleC' => 1, 'moduleD' => 1]);
     $this->loader->expects($this->once())->method('load')->willReturn(['moduleC' => [], 'moduleD' => []]);
     $this->writer->expects($this->once())->method('saveConfig')->with([ConfigFilePool::APP_CONFIG => [ConfigOptionsListConstants::KEY_MODULES => ['moduleC' => 1, 'moduleD' => 1]]]);
     $this->moduleRegistryUninstaller->removeModulesFromDeploymentConfig($this->output, ['moduleA', 'moduleB']);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:ModuleRegistryUninstallerTest.php


示例3: __construct

 /**
  * @param \Magento\Backend\App\Config $config
  * @param DeploymentConfig $deploymentConfig
  * @param ScopeConfigInterface $configInterface
  */
 public function __construct(
     \Magento\Backend\App\Config $config,
     DeploymentConfig $deploymentConfig,
     ScopeConfigInterface $configInterface
 ) {
     $this->config = $config;
     $this->defaultFrontName = $deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_BACKEND_FRONTNAME);
     $this->configInterface = $configInterface;
 }
开发者ID:razbakov,项目名称:magento2,代码行数:14,代码来源:FrontNameResolver.php


示例4: __construct

 /**
  * @param Config\Reader $reader
  * @param \Magento\Framework\Config\ScopeInterface $configScope
  * @param \Magento\Framework\Config\CacheInterface $cache
  * @param \Magento\Framework\App\DeploymentConfig $deploymentConfig
  * @param string $cacheId
  * @throws \InvalidArgumentException
  */
 public function __construct(Config\Reader $reader, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\Config\CacheInterface $cache, \Magento\Framework\App\DeploymentConfig $deploymentConfig, $cacheId = 'resourcesCache')
 {
     parent::__construct($reader, $configScope, $cache, $cacheId);
     foreach ($deploymentConfig->getConfigData(ConfigOptionsList::KEY_RESOURCE) as $resourceName => $resourceData) {
         if (!isset($resourceData['connection'])) {
             throw new \InvalidArgumentException('Invalid initial resource configuration');
         }
         $this->_connectionNames[$resourceName] = $resourceData['connection'];
     }
 }
开发者ID:opexsw,项目名称:magento2,代码行数:18,代码来源:Config.php


示例5: __construct

 /**
  * Constructor
  *
  * @param SaveHandlerFactory $saveHandlerFactory
  * @param DeploymentConfig $deploymentConfig
  * @param string $default
  */
 public function __construct(SaveHandlerFactory $saveHandlerFactory, DeploymentConfig $deploymentConfig, $default = self::DEFAULT_HANDLER)
 {
     $saveMethod = $deploymentConfig->get(\Magento\Framework\Session\Config::PARAM_SESSION_SAVE_METHOD);
     try {
         $adapter = $saveHandlerFactory->create($saveMethod);
     } catch (SessionException $e) {
         $adapter = $saveHandlerFactory->create($default);
     }
     $this->saveHandlerAdapter = $adapter;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:17,代码来源:SaveHandler.php


示例6: setUp

 public function setUp()
 {
     $this->_connectionFactory = $this->getMockBuilder('Magento\\Framework\\Model\\Resource\\Type\\Db\\ConnectionFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->_config = $this->getMockBuilder('Magento\\Framework\\App\\Resource\\ConfigInterface')->disableOriginalConstructor()->setMethods(['getConnectionName'])->getMock();
     $this->_config->expects($this->any())->method('getConnectionName')->with(self::RESOURCE_NAME)->will($this->returnValue(self::CONNECTION_NAME));
     $this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $this->deploymentConfig->expects($this->any())->method('get')->will($this->returnValue(['default' => ['host' => 'localhost', 'dbname' => 'magento', 'username' => 'username'], self::CONNECTION_NAME => ['host' => 'localhost', 'dbname' => 'magento', 'username' => 'username']]));
     $this->connection = $this->getMockForAbstractClass('Magento\\Framework\\DB\\Adapter\\AdapterInterface');
     $this->connection->expects($this->any())->method('getTableName')->will($this->returnArgument(0));
     $this->resource = new Resource($this->_config, $this->_connectionFactory, $this->deploymentConfig, self::TABLE_PREFIX);
 }
开发者ID:kid17,项目名称:magento2,代码行数:11,代码来源:ResourceTest.php


示例7: removeModulesFromDeploymentConfig

 /**
  * Removes module from deployment configuration
  *
  * @param OutputInterface $output
  * @param string[] $modules
  * @return void
  */
 public function removeModulesFromDeploymentConfig(OutputInterface $output, array $modules)
 {
     $output->writeln('<info>Removing ' . implode(', ', $modules) . ' from module list in deployment configuration</info>');
     $configuredModules = $this->deploymentConfig->getConfigData(\Magento\Framework\Config\ConfigOptionsListConstants::KEY_MODULES);
     $existingModules = $this->loader->load($modules);
     $newModules = [];
     foreach (array_keys($existingModules) as $module) {
         $newModules[$module] = isset($configuredModules[$module]) ? $configuredModules[$module] : 0;
     }
     $this->writer->saveConfig([\Magento\Framework\Config\File\ConfigFilePool::APP_CONFIG => [\Magento\Framework\Config\ConfigOptionsListConstants::KEY_MODULES => $newModules]], true);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:ModuleRegistryUninstaller.php


示例8: createConfig

 /**
  * {@inheritdoc}
  */
 public function createConfig(array $options, DeploymentConfig $deploymentConfig)
 {
     $configData = new ConfigData(ConfigFilePool::APP_CONFIG);
     if (isset($options[self::INPUT_KEY_CUSTOM_OPTION])) {
         $configData->set(self::CONFIG_PATH_CUSTOM_OPTION, $options[self::INPUT_KEY_CUSTOM_OPTION]);
     } elseif ($deploymentConfig->get(self::CONFIG_PATH_CUSTOM_OPTION) === null) {
         // set to default value if it is not already set in deployment configuration
         $configData->set(self::CONFIG_PATH_CUSTOM_OPTION, 'default custom value');
     }
     return [$configData];
 }
开发者ID:imbrj,项目名称:magento2-samples,代码行数:14,代码来源:ConfigOptionsList.php


示例9: setUp

 public function setUp()
 {
     $this->connectionFactory = $this->getMockBuilder(ConnectionFactoryInterface::class)->setMethods(['create'])->getMockForAbstractClass();
     $this->config = $this->getMockBuilder('Magento\\Framework\\App\\ResourceConnection\\ConfigInterface')->disableOriginalConstructor()->setMethods(['getConnectionName'])->getMock();
     $this->config->expects($this->any())->method('getConnectionName')->with(self::RESOURCE_NAME)->will($this->returnValue(self::CONNECTION_NAME));
     $this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $this->deploymentConfig->expects($this->any())->method('get')->willReturnMap([[ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/connection-name', null, ['host' => 'localhost', 'dbname' => 'magento', 'username' => 'username']], [ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX, null, self::TABLE_PREFIX]]);
     $this->connection = $this->getMockForAbstractClass('Magento\\Framework\\DB\\Adapter\\AdapterInterface');
     $this->connection->expects($this->any())->method('getTableName')->will($this->returnArgument(0));
     $this->resource = new ResourceConnection($this->config, $this->connectionFactory, $this->deploymentConfig);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:11,代码来源:AclResourceTest.php


示例10: setUp

 public function setUp()
 {
     $this->collector = $this->getMock('Magento\\Setup\\Model\\ConfigOptionsListCollector', [], [], '', false);
     $this->writer = $this->getMock('Magento\\Framework\\App\\DeploymentConfig\\Writer', [], [], '', false);
     $this->deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false);
     $this->configOptionsList = $this->getMock('Magento\\Backend\\Setup\\ConfigOptionsList', [], [], '', false);
     $this->configData = $this->getMock('Magento\\Framework\\Config\\Data\\ConfigData', [], [], '', false);
     $this->filePermissions = $this->getMock('\\Magento\\Framework\\Setup\\FilePermissions', [], [], '', false);
     $this->deploymentConfig->expects($this->any())->method('get');
     $this->configModel = new ConfigModel($this->collector, $this->writer, $this->deploymentConfig, $this->filePermissions);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:ConfigModelTest.php


示例11: createConfig

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function createConfig(array $options, DeploymentConfig $deploymentConfig)
 {
     $configData = new ConfigData(ConfigFilePool::APP_ENV);
     if (!$deploymentConfig->get(self::CONFIG_PATH_BACKEND_FRONTNAME) && !isset($options[self::INPUT_KEY_BACKEND_FRONTNAME])) {
         $options[self::INPUT_KEY_BACKEND_FRONTNAME] = BackendFrontnameGenerator::generate();
     }
     if (isset($options[self::INPUT_KEY_BACKEND_FRONTNAME])) {
         $configData->set(self::CONFIG_PATH_BACKEND_FRONTNAME, $options[self::INPUT_KEY_BACKEND_FRONTNAME]);
     }
     return [$configData];
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:ConfigOptionsList.php


示例12: __construct

 /**
  * @param ServiceLocatorInterface $serviceLocator
  * @param DeploymentConfig $deploymentConfig
  */
 public function __construct(ServiceLocatorInterface $serviceLocator, DeploymentConfig $deploymentConfig)
 {
     if ($deploymentConfig->isAvailable()) {
         $this->navStates = $serviceLocator->get('config')[self::NAV_UPDATER];
         $this->navType = self::NAV_UPDATER;
         $this->titles = $serviceLocator->get('config')[self::NAV_UPDATER . 'Titles'];
     } else {
         $this->navStates = $serviceLocator->get('config')[self::NAV_INSTALLER];
         $this->navType = self::NAV_INSTALLER;
         $this->titles = $serviceLocator->get('config')[self::NAV_INSTALLER . 'Titles'];
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:Navigation.php


示例13: testCheckUpdate

 /**
  * @dataProvider checkUpdateDataProvider
  * @param bool $callInbox
  * @param string $curlRequest
  */
 public function testCheckUpdate($callInbox, $curlRequest)
 {
     $mockName = 'Test Product Name';
     $mockVersion = '0.0.0';
     $mockEdition = 'Test Edition';
     $mockUrl = 'http://test-url';
     $this->productMetadata->expects($this->once())->method('getName')->willReturn($mockName);
     $this->productMetadata->expects($this->once())->method('getVersion')->willReturn($mockVersion);
     $this->productMetadata->expects($this->once())->method('getEdition')->willReturn($mockEdition);
     $this->urlBuilder->expects($this->once())->method('getUrl')->with('*/*/*')->willReturn($mockUrl);
     $configValues = ['timeout' => 2, 'useragent' => $mockName . '/' . $mockVersion . ' (' . $mockEdition . ')', 'referer' => $mockUrl];
     $lastUpdate = 0;
     $this->cacheManager->expects($this->once())->method('load')->will($this->returnValue($lastUpdate));
     $this->curlFactory->expects($this->at(0))->method('create')->will($this->returnValue($this->curl));
     $this->curl->expects($this->once())->method('setConfig')->with($configValues)->willReturnSelf();
     $this->curl->expects($this->once())->method('read')->will($this->returnValue($curlRequest));
     $this->backendConfig->expects($this->at(0))->method('getValue')->will($this->returnValue('1'));
     $this->backendConfig->expects($this->once())->method('isSetFlag')->will($this->returnValue(false));
     $this->backendConfig->expects($this->at(1))->method('getValue')->will($this->returnValue('http://feed.magento.com'));
     $this->deploymentConfig->expects($this->once())->method('get')->with(ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE)->will($this->returnValue('Sat, 6 Sep 2014 16:46:11 UTC'));
     if ($callInbox) {
         $this->inboxFactory->expects($this->once())->method('create')->will($this->returnValue($this->inboxModel));
         $this->inboxModel->expects($this->once())->method('parse')->will($this->returnSelf());
     } else {
         $this->inboxFactory->expects($this->never())->method('create');
         $this->inboxModel->expects($this->never())->method('parse');
     }
     $this->feed->checkUpdate();
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:34,代码来源:FeedTest.php


示例14: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $notification = 'setup-cron: Please check var/log/update.log for execution summary.';
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln($notification);
         $this->status->add('Magento is not installed.', \Psr\Log\LogLevel::INFO);
         return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
     }
     if (!$this->checkRun()) {
         $output->writeln($notification);
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     try {
         $this->status->toggleUpdateInProgress();
     } catch (\RuntimeException $e) {
         $this->status->add($e->getMessage(), \Psr\Log\LogLevel::ERROR);
         $output->writeln($notification);
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $returnCode = $this->executeJobsFromQueue();
     if ($returnCode != \Magento\Framework\Console\Cli::RETURN_SUCCESS) {
         $output->writeln($notification);
     }
     return $returnCode;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:30,代码来源:CronRunCommand.php


示例15: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable() && ($input->getOption(self::INPUT_KEY_MEDIA) || $input->getOption(self::INPUT_KEY_DB))) {
         $output->writeln("<info>No information is available: the Magento application is not installed.</info>");
         return;
     }
     try {
         $inputOptionProvided = false;
         $output->writeln('<info>Enabling maintenance mode</info>');
         $this->maintenanceMode->set(true);
         $time = time();
         $backupHandler = $this->backupRollbackFactory->create($output);
         if ($input->getOption(self::INPUT_KEY_CODE)) {
             $backupHandler->codeBackup($time);
             $inputOptionProvided = true;
         }
         if ($input->getOption(self::INPUT_KEY_MEDIA)) {
             $backupHandler->codeBackup($time, Factory::TYPE_MEDIA);
             $inputOptionProvided = true;
         }
         if ($input->getOption(self::INPUT_KEY_DB)) {
             $backupHandler->dbBackup($time);
             $inputOptionProvided = true;
         }
         if (!$inputOptionProvided) {
             throw new \InvalidArgumentException('Not enough information provided to take backup.');
         }
     } catch (\Exception $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
     } finally {
         $output->writeln('<info>Disabling maintenance mode</info>');
         $this->maintenanceMode->set(false);
     }
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:37,代码来源:BackupCommand.php


示例16: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable() && ($input->getOption(self::INPUT_KEY_MEDIA_BACKUP_FILE) || $input->getOption(self::INPUT_KEY_DB_BACKUP_FILE))) {
         $output->writeln("<info>No information is available: the Magento application is not installed.</info>");
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $returnValue = \Magento\Framework\Console\Cli::RETURN_SUCCESS;
     try {
         $output->writeln('<info>Enabling maintenance mode</info>');
         $this->maintenanceMode->set(true);
         $helper = $this->getHelper('question');
         $question = new ConfirmationQuestion('<info>You are about to remove current code and/or database tables. Are you sure?[y/N]<info>', false);
         if (!$helper->ask($input, $output, $question) && $input->isInteractive()) {
             return \Magento\Framework\Console\Cli::RETURN_FAILURE;
         }
         $this->doRollback($input, $output);
         $output->writeln('<info>Please set file permission of bin/magento to executable</info>');
     } catch (\Exception $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
         // we must have an exit code higher than zero to indicate something was wrong
         $returnValue = \Magento\Framework\Console\Cli::RETURN_FAILURE;
     } finally {
         $output->writeln('<info>Disabling maintenance mode</info>');
         $this->maintenanceMode->set(false);
     }
     return $returnValue;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:31,代码来源:RollbackCommand.php


示例17: testExecuteNoOptions

 public function testExecuteNoOptions()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false));
     $this->tester->execute([]);
     $expected = 'Enabling maintenance mode' . PHP_EOL . 'Not enough information provided to take backup.' . PHP_EOL . 'Disabling maintenance mode' . PHP_EOL;
     $this->assertSame($expected, $this->tester->getDisplay());
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:7,代码来源:BackupCommandTest.php


示例18: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>No information is available: the Magento application is not installed.</info>");
         return;
     }
     /** @var DbVersionInfo $dbVersionInfo */
     $dbVersionInfo = $this->objectManagerProvider->get()->get('Magento\\Framework\\Module\\DbVersionInfo');
     $outdated = $dbVersionInfo->getDbVersionErrors();
     if (!empty($outdated)) {
         $output->writeln("<info>The module code base doesn't match the DB schema and data.</info>");
         $versionParser = new VersionParser();
         $codebaseUpdateNeeded = false;
         foreach ($outdated as $row) {
             if (!$codebaseUpdateNeeded && $row[DbVersionInfo::KEY_CURRENT] !== 'none') {
                 // check if module code base update is needed
                 $currentVersion = $versionParser->parseConstraints($row[DbVersionInfo::KEY_CURRENT]);
                 $requiredVersion = $versionParser->parseConstraints('>' . $row[DbVersionInfo::KEY_REQUIRED]);
                 if ($requiredVersion->matches($currentVersion)) {
                     $codebaseUpdateNeeded = true;
                 }
             }
             $output->writeln(sprintf("<info>%20s %10s: %11s  ->  %-11s</info>", $row[DbVersionInfo::KEY_MODULE], $row[DbVersionInfo::KEY_TYPE], $row[DbVersionInfo::KEY_CURRENT], $row[DbVersionInfo::KEY_REQUIRED]));
         }
         if ($codebaseUpdateNeeded) {
             $output->writeln('<info>Some modules use code versions newer or older than the database. ' . "First update the module code, then run 'setup:upgrade'.</info>");
             // we must have an exit code higher than zero to indicate something was wrong
             return \Magento\Framework\Console\Cli::RETURN_FAILURE;
         } else {
             $output->writeln("<info>Run 'setup:upgrade' to update your DB schema and data.</info>");
         }
     } else {
         $output->writeln('<info>All modules are up to date.</info>');
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:38,代码来源:DbStatusCommand.php


示例19: testExecuteNotInstalled

 public function testExecuteNotInstalled()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false));
     $this->installerFactory->expects($this->never())->method('create');
     $tester = new CommandTester($this->command);
     $tester->execute([]);
     $this->assertStringMatchesFormat("Store settings can't be saved because the Magento application is not installed.%w", $tester->getDisplay());
 }
开发者ID:opexsw,项目名称:magento2,代码行数:8,代码来源:InstallStoreConfigurationCommandTest.php


示例20: testExecuteNotInstalled

 public function testExecuteNotInstalled()
 {
     $this->deploymentConfig->expects($this->once())->method('isAvailable')->will($this->returnValue(false));
     $this->dbVersionInfo->expects($this->never())->method('getDbVersionErrors');
     $tester = new CommandTester($this->command);
     $tester->execute([]);
     $this->assertStringMatchesFormat('No information is available: the Magento application is not installed.%w', $tester->getDisplay());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:8,代码来源:DbStatusCommandTest.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP App\Filesystem类代码示例发布时间:2022-05-23
下一篇:
PHP App\CacheInterface类代码示例发布时间: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