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


PHP DeploymentConfig::get方法代码示例

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


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

示例1: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $value = $this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_CUSTOM_OPTION);
     if ($value) {
         $output->writeln('<info>The custom deployment configuration value is ' . $value . '</info>');
     } else {
         $output->writeln('<info>The custom deployment configuration value is not set.</info>');
     }
 }
开发者ID:imbrj,项目名称:magento2-samples,代码行数:12,代码来源:ShowCustomDeploymentConfigCommand.php

示例2: toOptionArray

 /**
  * Returns list of available resources
  *
  * @return array
  */
 public function toOptionArray()
 {
     $resourceOptions = [];
     $resourceConfig = $this->deploymentConfig->get(ConfigOptionsListConstants::KEY_RESOURCE);
     if (null !== $resourceConfig) {
         foreach (array_keys($resourceConfig) as $resourceName) {
             $resourceOptions[] = ['value' => $resourceName, 'label' => $resourceName];
         }
         sort($resourceOptions);
         reset($resourceOptions);
     }
     return $resourceOptions;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:18,代码来源:Database.php

示例3: getUris

 /**
  * Get cache servers' Uris
  *
  * @return Uri[]
  */
 public function getUris()
 {
     $servers = [];
     $configuredHosts = $this->config->get(ConfigOptionsListConstants::CONFIG_PATH_CACHE_HOSTS);
     if (null == $configuredHosts) {
         $httpHost = $this->request->getHttpHost();
         $servers[] = $httpHost ? UriFactory::factory('')->setHost($httpHost)->setPort(self::DEFAULT_PORT)->setScheme('http') : UriFactory::factory($this->urlBuilder->getUrl('*', ['_nosid' => true]))->setScheme('http')->setPath(null)->setQuery(null);
     } else {
         foreach ($configuredHosts as $host) {
             $servers[] = UriFactory::factory('')->setHost($host['host'])->setPort(isset($host['port']) ? $host['port'] : self::DEFAULT_PORT)->setScheme('http');
         }
     }
     return $servers;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:Server.php

示例4: addDeploymentInfo

 protected function addDeploymentInfo()
 {
     $this->infos['Application Mode'] = $this->deploymentConfig->get(AppState::PARAM_MODE);
     $this->infos['Session'] = $this->deploymentConfig->get('session/save');
     $this->infos['Crypt Key'] = $this->deploymentConfig->get('crypt/key');
     $this->infos['Install Date'] = $this->deploymentConfig->get('install/date');
 }
开发者ID:jsiefer,项目名称:n98-magerun2,代码行数:7,代码来源:InfoCommand.php

示例5: getTablePrefix

 /**
  * Get table prefix
  *
  * @return string
  */
 private function getTablePrefix()
 {
     if (null === $this->_tablePrefix) {
         $this->_tablePrefix = (string) $this->deploymentConfig->get(self::PARAM_TABLE_PREFIX);
     }
     return $this->_tablePrefix;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:12,代码来源:Resource.php

示例6: getAvailableOptions

 /**
  * Gets available config options
  *
  * @return AbstractConfigOption[]
  */
 public function getAvailableOptions()
 {
     /** @var AbstractConfigOption[] $optionCollection */
     $optionCollection = [];
     $optionLists = $this->collector->collectOptionsLists();
     foreach ($optionLists as $optionList) {
         $optionCollection = array_merge($optionCollection, $optionList->getOptions());
     }
     foreach ($optionCollection as $option) {
         $currentValue = $this->deploymentConfig->get($option->getConfigPath());
         if ($currentValue !== null) {
             $option->setDefault();
         }
     }
     return $optionCollection;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:21,代码来源:ConfigModel.php

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

示例8: loadConfigData

 /**
  * Loads configuration data only
  *
  * @return void
  */
 private function loadConfigData()
 {
     $this->config->resetData();
     if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) {
         $this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES);
     }
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:ModuleList.php

示例9: getTablePrefix

 /**
  * Get table prefix
  *
  * @return string
  */
 private function getTablePrefix()
 {
     if (null === $this->_tablePrefix) {
         $this->_tablePrefix = (string) $this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_DB_PREFIX);
     }
     return $this->_tablePrefix;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:12,代码来源:Resource.php

示例10: checkUpdate

    /**
     * Check feed for modification
     *
     * @return $this
     */
    public function checkUpdate()
    {
        if ($this->getFrequency() + $this->getLastUpdate() > time()) {
            return $this;
        }

        $feedData = [];

        $feedXml = $this->getFeedData();

        $installDate = strtotime($this->_deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE));

        if ($feedXml && $feedXml->channel && $feedXml->channel->item) {
            foreach ($feedXml->channel->item as $item) {
                if ($installDate <= strtotime((string)$item->pubDate)) {
                    $feedData[] = [
                        'severity' => (int)$item->severity,
                        'date_added' => $this->getDate((string)$item->pubDate),
                        'title' => (string)$item->title,
                        'description' => (string)$item->description,
                        'url' => (string)$item->link,
                    ];
                }
            }

            if ($feedData) {
                $this->_inboxFactory->create()->parse(array_reverse($feedData));
            }
        }
        $this->setLastUpdate();

        return $this;
    }
开发者ID:razbakov,项目名称:magento2,代码行数:38,代码来源:Feed.php

示例11: __destruct

 /**
  * As per http://php.net/manual/en/language.oop5.decon.php:
  * The destructor method will be called as soon as there are no other references to a particular object,
  * or in any order during the shutdown sequence.
  *
  * As randomly tested accross the code, triggering exist and exceptions, the __destruct is called in cases of:
  *  - successful execution
  *  - exit() being called anywhere later on
  *  - exception being thrown anywhere later on
  *
  * This is a nice example of catching all query logs, which we populated first within the logStats method.
  *
  * Within the __destruct we initiate the new Database connection, from DB parameters read from config.
  * This new DB connection is using the DB\Logger\Quiet so we don't fall into a loop of logging the
  * SQL queries for SQL query logger :)
  *
  * This way, we agregated all of the individual query logs on request, and did one insertMultiple.
  */
 public function __destruct()
 {
     try {
         /**
          * Note, logStats still executes. It is not possible to include DB read config in there as it executes
          * right after first DB connection, and Magento does not have config value just yet.
          * Thus we check here. Hopefully the performance impact is not too big within the logStats.
          */
         if (!$this->helper->isQueryLogActive()) {
             return;
         }
         $config = $this->deploymentConfig->get(\Magento\Framework\Config\ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT);
         $connection = new \Magento\Framework\Model\ResourceModel\Type\Db\Pdo\Mysql(new \Magento\Framework\Stdlib\StringUtils(), new \Magento\Framework\Stdlib\DateTime(), $config);
         /*
          * Here we init the new DB connection with
          * Magento config and directly set the dummy Quiet logger to it.
          */
         $connection = $connection->getConnection(new \Magento\Framework\DB\Logger\Quiet());
         $uniqueId = $this->helper->getHttpRequestUniqueId();
         $logCallStack = $this->helper->getQueryLogCallStack();
         $logQueryTime = $this->helper->getQueryLogQueryTime();
         $logAllQueries = $this->helper->getQueryLogAllQueries();
         $logQueryChunks = $this->helper->getQueryLogQueryChunks();
         $this->queryLogs = array_map(create_function('$arr', '$arr["request_id"] = "' . $uniqueId . '"; return $arr;'), $this->queryLogs);
         $queryLogChunks = array_chunk($this->queryLogs, $logQueryChunks);
         /* Breaks in between 80 & 90 */
         foreach ($queryLogChunks as $queryLogChunk) {
             if (!$logCallStack) {
                 $queryLogChunk = array_map(create_function('$arr', 'unset($arr["backtrace"]); return $arr;'), $queryLogChunk);
             }
             $queryLogChunk = array_map(create_function('$arr', 'unset($arr["backtrace"]); return $arr;'), $queryLogChunk);
             if ($logQueryTime && !$logAllQueries) {
                 $queryLogChunk = array_map(create_function('$arr', 'if($arr["time"] >= ' . $logQueryTime . ') { return $arr; }'), $queryLogChunk);
             }
             /* @todo Exclude the foggyline_sentinel_query_log table from logging itself */
             /* $queryLogChunk = array_map(create_function('$arr', 'if (!strstr($arr["sql"], "foggyline_sentinel_query_log")) { return $arr; }'), $queryLogChunk); */
             if ($queryLogChunk = array_filter($queryLogChunk)) {
                 /* @todo There is a bug here, DB name is without possible prefix/suffix, needs proper handling */
                 $connection->insertMultiple('foggyline_sentinel_query_log', $queryLogChunk);
             }
         }
         /**
            CREATE TABLE `foggyline_sentinel_query_log` (
            `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
            `type` text,
            `time` decimal(12,4) DEFAULT NULL,
            `sql` text,
            `bind` text,
            `row_count` int(11) DEFAULT NULL,
            `request_id` text,
            `backtrace` text,
            PRIMARY KEY (`id`)
            ) ENGINE=InnoDB AUTO_INCREMENT=81 DEFAULT CHARSET=utf8;
         */
     } catch (\Exception $e) {
         //Silently do nothing :)
         //var_dump($e->getMessage());
     }
 }
开发者ID:ajzele,项目名称:Foggyline_Sentinel,代码行数:77,代码来源:File.php

示例12: createXFrameConfig

 /**
  * Creates x-frame-options header config data
  *
  * @return ConfigData
  */
 public function createXFrameConfig()
 {
     $configData = new ConfigData(ConfigFilePool::APP_ENV);
     if ($this->deploymentConfig->get(ConfigOptionsListConstants::CONFIG_PATH_X_FRAME_OPT) === null) {
         $configData->set(ConfigOptionsListConstants::CONFIG_PATH_X_FRAME_OPT, 'SAMEORIGIN');
     }
     return $configData;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:ConfigGenerator.php

示例13: createResourceConfig

 /**
  * Creates resource config data
  *
  * @return ConfigData
  */
 public function createResourceConfig()
 {
     $configData = new ConfigData(ConfigFilePool::APP_CONFIG);
     if ($this->deploymentConfig->get(ConfigOptionsList::CONFIG_PATH_RESOURCE_DEFAULT_SETUP) === null) {
         $configData->set(ConfigOptionsList::CONFIG_PATH_RESOURCE_DEFAULT_SETUP, 'default');
     }
     return $configData;
 }
开发者ID:opexsw,项目名称:magento2,代码行数:13,代码来源:ConfigGenerator.php

示例14: createModeConfig

 /**
  * Create default entry for mode config option
  *
  * @return ConfigData
  */
 public function createModeConfig()
 {
     $configData = new ConfigData(ConfigFilePool::APP_ENV);
     if ($this->deploymentConfig->get(State::PARAM_MODE) === null) {
         $configData->set(State::PARAM_MODE, State::MODE_DEFAULT);
     }
     return $configData;
 }
开发者ID:hientruong90,项目名称:magento2_installer,代码行数:13,代码来源:ConfigGenerator.php

示例15: checkEnvironment

 /**
  * Checks that application is installed and DI resources are cleared
  *
  * @return string[]
  */
 private function checkEnvironment()
 {
     $messages = [];
     $config = $this->deploymentConfig->get(ConfigOptionsListConstants::KEY_MODULES);
     if (!$config) {
         $messages[] = 'You cannot run this command because modules are not enabled. You can enable modules by' . ' running the \'module:enable --all\' command.';
     }
     return $messages;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:DiCompileCommand.php


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