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


PHP DeploymentConfig::isAvailable方法代码示例

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


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

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

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

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

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

示例5: testNotAvailableThenAvailable

 public function testNotAvailableThenAvailable()
 {
     $this->reader->expects($this->at(0))->method('load')->willReturn([]);
     $this->reader->expects($this->at(1))->method('load')->willReturn([ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE => 1]);
     $object = new DeploymentConfig($this->reader);
     $this->assertFalse($object->isAvailable());
     $this->assertTrue($object->isAvailable());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:8,代码来源:DeploymentConfigTest.php

示例6: testNotAvailableThenAvailable

 public function testNotAvailableThenAvailable()
 {
     $this->reader->expects($this->at(0))->method('load')->willReturn([]);
     $this->reader->expects($this->at(1))->method('load')->willReturn(['a' => 1]);
     $object = new DeploymentConfig($this->reader);
     $this->assertFalse($object->isAvailable());
     $this->assertTrue($object->isAvailable());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:8,代码来源:DeploymentConfigTest.php

示例7: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>Store settings can't be saved because the Magento application is not installed.</info>");
         return;
     }
     $installer = $this->installerFactory->create(new ConsoleLogger($output));
     $installer->installUserConfig($input->getOptions());
 }
开发者ID:opexsw,项目名称:magento2,代码行数:12,代码来源:InstallStoreConfigurationCommand.php

示例8: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>No information is available: the application is not installed.</info>");
         return;
     }
     $installer = $this->installFactory->create(new ConsoleLogger($output));
     $installer->installSchema();
 }
开发者ID:opexsw,项目名称:magento2,代码行数:12,代码来源:DbSchemaUpgradeCommand.php

示例9: 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>");
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $installer = $this->installFactory->create(new ConsoleLogger($output));
     $installer->installDataFixtures();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:DbDataUpgradeCommand.php

示例10: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln("<info>Store settings can't be saved because 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;
     }
     $errors = $this->validate($input);
     if ($errors) {
         $output->writeln($errors);
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $installer = $this->installerFactory->create(new ConsoleLogger($output));
     $installer->installUserConfig($input->getOptions());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:19,代码来源:InstallStoreConfigurationCommand.php

示例11: checkEnvironment

    /**
     * Checks that application is installed and DI resources are cleared
     *
     * @return string[]
     */
    private function checkEnvironment()
    {
        $messages = [];
        if (!$this->deploymentConfig->isAvailable()) {
            $messages[] = 'You cannot run this command because the Magento application is not installed.';
        }

        return $messages;
    }
开发者ID:rafaelstz,项目名称:magento2,代码行数:14,代码来源:DiCompileCommand.php

示例12: execute

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->deploymentConfig->isAvailable()) {
         $output->writeln('<error>You cannot run this command because the Magento application is not installed.</error>');
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $modules = $input->getArgument(self::INPUT_KEY_MODULES);
     // validate modules input
     $messages = $this->validate($modules);
     if (!empty($messages)) {
         $output->writeln($messages);
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     // check dependencies
     $dependencyMessages = $this->checkDependencies($modules);
     if (!empty($dependencyMessages)) {
         $output->writeln($dependencyMessages);
         // we must have an exit code higher than zero to indicate something was wrong
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     $helper = $this->getHelper('question');
     $question = new ConfirmationQuestion('You are about to remove code and/or database tables. Are you sure?[y/N]', false);
     if (!$helper->ask($input, $output, $question) && $input->isInteractive()) {
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
     try {
         $output->writeln('<info>Enabling maintenance mode</info>');
         $this->maintenanceMode->set(true);
         $this->takeBackup($input, $output);
         $dbBackupOption = $input->getOption(self::INPUT_KEY_BACKUP_DB);
         if ($input->getOption(self::INPUT_KEY_REMOVE_DATA)) {
             $this->removeData($modules, $output, $dbBackupOption);
         } else {
             if (!empty($this->collector->collectUninstall())) {
                 $question = new ConfirmationQuestion('You are about to remove a module(s) that might have database data. ' . 'Do you want to remove the data from database?[y/N]', false);
                 if ($helper->ask($input, $output, $question) || !$input->isInteractive()) {
                     $this->removeData($modules, $output, $dbBackupOption);
                 }
             } else {
                 $output->writeln('<info>You are about to remove a module(s) that might have database data. ' . 'Remove the database data manually after uninstalling, if desired.</info>');
             }
         }
         $this->moduleRegistryUninstaller->removeModulesFromDb($output, $modules);
         $this->moduleRegistryUninstaller->removeModulesFromDeploymentConfig($output, $modules);
         $this->moduleUninstaller->uninstallCode($output, $modules);
         $this->cleanup($input, $output);
         $output->writeln('<info>Disabling maintenance mode</info>');
         $this->maintenanceMode->set(false);
     } catch (\Exception $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
         $output->writeln('<error>Please disable maintenance mode after you resolved above issues</error>');
         return \Magento\Framework\Console\Cli::RETURN_FAILURE;
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:60,代码来源:ModuleUninstallCommand.php

示例13: checkEnvironment

 /**
  * Checks that application is installed and DI resources are cleared
  *
  * @return string[]
  */
 private function checkEnvironment()
 {
     $messages = [];
     if (!$this->deploymentConfig->isAvailable()) {
         $messages[] = 'You cannot run this command because the Magento application is not installed.';
     }
     /**
      * By the time the command is able to execute, the Object Management configuration is already contaminated
      * by old config info, and it's too late to just clear the files in code.
      *
      * TODO: reconfigure OM in runtime so DI resources can be cleared after command launches
      *
      */
     $path = $this->directoryList->getPath(DirectoryList::DI);
     if ($this->fileDriver->isExists($path)) {
         $messages[] = "DI configuration must be cleared before running compiler. Please delete '{$path}'.";
     }
     return $messages;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:24,代码来源:DiCompileCommand.php

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

示例15: 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>");
         return;
     }
     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;
         }
         $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>');
     } finally {
         $output->writeln('<info>Disabling maintenance mode</info>');
         $this->maintenanceMode->set(false);
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:26,代码来源:RollbackCommand.php


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