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


PHP PhabricatorEnv::getConfigSourceStack方法代码示例

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


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

示例1: executeChecks

 protected function executeChecks()
 {
     $ancient_config = self::getAncientConfig();
     $all_keys = PhabricatorEnv::getAllConfigKeys();
     $all_keys = array_keys($all_keys);
     sort($all_keys);
     $defined_keys = PhabricatorApplicationConfigOptions::loadAllOptions();
     foreach ($all_keys as $key) {
         if (isset($defined_keys[$key])) {
             continue;
         }
         if (isset($ancient_config[$key])) {
             $summary = pht('This option has been removed. You may delete it at your ' . 'convenience.');
             $message = pht("The configuration option '%s' has been removed. You may delete " . "it at your convenience." . "\n\n%s", $key, $ancient_config[$key]);
             $short = pht('Obsolete Config');
             $name = pht('Obsolete Configuration Option "%s"', $key);
         } else {
             $summary = pht('This option is not recognized. It may be misspelled.');
             $message = pht("The configuration option '%s' is not recognized. It may be " . "misspelled, or it might have existed in an older version of " . "Phabricator. It has no effect, and should be corrected or deleted.", $key);
             $short = pht('Unknown Config');
             $name = pht('Unknown Configuration Option "%s"', $key);
         }
         $issue = $this->newIssue('config.unknown.' . $key)->setShortName($short)->setName($name)->setSummary($summary);
         $stack = PhabricatorEnv::getConfigSourceStack();
         $stack = $stack->getStack();
         $found = array();
         $found_local = false;
         $found_database = false;
         foreach ($stack as $source_key => $source) {
             $value = $source->getKeys(array($key));
             if ($value) {
                 $found[] = $source->getName();
                 if ($source instanceof PhabricatorConfigDatabaseSource) {
                     $found_database = true;
                 }
                 if ($source instanceof PhabricatorConfigLocalSource) {
                     $found_local = true;
                 }
             }
         }
         $message = $message . "\n\n" . pht('This configuration value is defined in these %d ' . 'configuration source(s): %s.', count($found), implode(', ', $found));
         $issue->setMessage($message);
         if ($found_local) {
             $command = csprintf('phabricator/ $ ./bin/config delete %s', $key);
             $issue->addCommand($command);
         }
         if ($found_database) {
             $issue->addPhabricatorConfig($key);
         }
     }
     $this->executeManiphestFieldChecks();
 }
开发者ID:alexlis,项目名称:phabricator,代码行数:52,代码来源:PhabricatorExtraConfigSetupCheck.php

示例2: execute

 public function execute(PhutilArgumentParser $args)
 {
     $console = PhutilConsole::getConsole();
     $key_count = 0;
     $options = PhabricatorApplicationConfigOptions::loadAllOptions();
     $local_config = new PhabricatorConfigLocalSource();
     $database_config = new PhabricatorConfigDatabaseSource('default');
     $config_sources = PhabricatorEnv::getConfigSourceStack()->getStack();
     $console->writeOut("%s\n", pht('Migrating file-based config to more modern config...'));
     foreach ($config_sources as $config_source) {
         if (!$config_source instanceof PhabricatorConfigFileSource) {
             $console->writeOut("%s\n", pht('Skipping config of source type %s...', get_class($config_source)));
             continue;
         }
         $console->writeOut("%s\n", pht('Migrating file source...'));
         $all_keys = $config_source->getAllKeys();
         foreach ($all_keys as $key => $value) {
             $option = idx($options, $key);
             if (!$option) {
                 $console->writeOut("%s\n", pht('Skipping obsolete option: %s', $key));
                 continue;
             }
             $in_local = $local_config->getKeys(array($option->getKey()));
             if ($in_local) {
                 $console->writeOut("%s\n", pht('Skipping option "%s"; already in local config.', $key));
                 continue;
             }
             $is_locked = $option->getLocked();
             if ($is_locked) {
                 $local_config->setKeys(array($option->getKey() => $value));
                 $key_count++;
                 $console->writeOut("%s\n", pht('Migrated option "%s" from file to local config.', $key));
             } else {
                 $in_database = $database_config->getKeys(array($option->getKey()));
                 if ($in_database) {
                     $console->writeOut("%s\n", pht('Skipping option "%s"; already in database config.', $key));
                     continue;
                 } else {
                     $config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
                     $config_entry->setValue($value);
                     $config_entry->save();
                     $key_count++;
                     $console->writeOut("%s\n", pht('Migrated option "%s" from file to database config.', $key));
                 }
             }
         }
     }
     $console->writeOut("%s\n", pht('Done. Migrated %d keys.', $key_count));
     return 0;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:50,代码来源:PhabricatorConfigManagementMigrateWorkflow.php

示例3: renderDefaults

 private function renderDefaults(PhabricatorConfigOption $option, PhabricatorConfigEntry $entry)
 {
     $stack = PhabricatorEnv::getConfigSourceStack();
     $stack = $stack->getStack();
     $table = array();
     $table[] = phutil_tag('tr', array('class' => 'column-labels'), array(phutil_tag('th', array(), pht('Source')), phutil_tag('th', array(), pht('Value'))));
     foreach ($stack as $key => $source) {
         $value = $source->getKeys(array($option->getKey()));
         if (!array_key_exists($option->getKey(), $value)) {
             $value = phutil_tag('em', array(), pht('(empty)'));
         } else {
             $value = $this->getDisplayValue($option, $entry, $value[$option->getKey()]);
         }
         $table[] = phutil_tag('tr', array('class' => 'column-labels'), array(phutil_tag('th', array(), $source->getName()), phutil_tag('td', array(), $value)));
     }
     require_celerity_resource('config-options-css');
     return phutil_tag('table', array('class' => 'config-option-table'), $table);
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:18,代码来源:PhabricatorConfigEditController.php


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