本文整理汇总了PHP中PhabricatorEnv::sourceStack方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorEnv::sourceStack方法的具体用法?PHP PhabricatorEnv::sourceStack怎么用?PHP PhabricatorEnv::sourceStack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorEnv
的用法示例。
在下文中一共展示了PhabricatorEnv::sourceStack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildConfigurationSourceStack
private static function buildConfigurationSourceStack($config_optional)
{
self::dropConfigCache();
$stack = new PhabricatorConfigStackSource();
self::$sourceStack = $stack;
$default_source = id(new PhabricatorConfigDefaultSource())->setName(pht('Global Default'));
$stack->pushSource($default_source);
$env = self::getSelectedEnvironmentName();
if ($env) {
$stack->pushSource(id(new PhabricatorConfigFileSource($env))->setName(pht("File '%s'", $env)));
}
$stack->pushSource(id(new PhabricatorConfigLocalSource())->setName(pht('Local Config')));
// If the install overrides the database adapter, we might need to load
// the database adapter class before we can push on the database config.
// This config is locked and can't be edited from the web UI anyway.
foreach (self::getEnvConfig('load-libraries') as $library) {
phutil_load_library($library);
}
// If custom libraries specify config options, they won't get default
// values as the Default source has already been loaded, so we get it to
// pull in all options from non-phabricator libraries now they are loaded.
$default_source->loadExternalOptions();
// If this install has site config sources, load them now.
$site_sources = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorConfigSiteSource')->setSortMethod('getPriority')->execute();
foreach ($site_sources as $site_source) {
$stack->pushSource($site_source);
}
$master = PhabricatorDatabaseRef::getMasterDatabaseRef();
if (!$master) {
self::setReadOnly(true, self::READONLY_MASTERLESS);
} else {
if ($master->isSevered()) {
$master->checkHealth();
if ($master->isSevered()) {
self::setReadOnly(true, self::READONLY_SEVERED);
}
}
}
try {
$stack->pushSource(id(new PhabricatorConfigDatabaseSource('default'))->setName(pht('Database')));
} catch (AphrontSchemaQueryException $exception) {
// If the database is not available, just skip this configuration
// source. This happens during `bin/storage upgrade`, `bin/conf` before
// schema setup, etc.
} catch (AphrontConnectionQueryException $ex) {
if (!$config_optional) {
throw $ex;
}
} catch (AphrontInvalidCredentialsQueryException $ex) {
if (!$config_optional) {
throw $ex;
}
}
}
示例2: buildConfigurationSourceStack
private static function buildConfigurationSourceStack()
{
self::dropConfigCache();
$stack = new PhabricatorConfigStackSource();
self::$sourceStack = $stack;
$default_source = id(new PhabricatorConfigDefaultSource())->setName(pht('Global Default'));
$stack->pushSource($default_source);
$env = self::getSelectedEnvironmentName();
if ($env) {
$stack->pushSource(id(new PhabricatorConfigFileSource($env))->setName(pht("File '%s'", $env)));
}
$stack->pushSource(id(new PhabricatorConfigLocalSource())->setName(pht('Local Config')));
// If the install overrides the database adapter, we might need to load
// the database adapter class before we can push on the database config.
// This config is locked and can't be edited from the web UI anyway.
foreach (self::getEnvConfig('load-libraries') as $library) {
phutil_load_library($library);
}
// If custom libraries specify config options, they won't get default
// values as the Default source has already been loaded, so we get it to
// pull in all options from non-phabricator libraries now they are loaded.
$default_source->loadExternalOptions();
// If this install has site config sources, load them now.
$site_sources = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorConfigSiteSource')->loadObjects();
$site_sources = msort($site_sources, 'getPriority');
foreach ($site_sources as $site_source) {
$stack->pushSource($site_source);
}
try {
$stack->pushSource(id(new PhabricatorConfigDatabaseSource('default'))->setName(pht('Database')));
} catch (AphrontQueryException $exception) {
// If the database is not available, just skip this configuration
// source. This happens during `bin/storage upgrade`, `bin/conf` before
// schema setup, etc.
}
}
示例3: buildConfigurationSourceStack
private static function buildConfigurationSourceStack($config_optional)
{
self::dropConfigCache();
$stack = new PhabricatorConfigStackSource();
self::$sourceStack = $stack;
$default_source = id(new PhabricatorConfigDefaultSource())->setName(pht('Global Default'));
$stack->pushSource($default_source);
$env = self::getSelectedEnvironmentName();
if ($env) {
$stack->pushSource(id(new PhabricatorConfigFileSource($env))->setName(pht("File '%s'", $env)));
}
$stack->pushSource(id(new PhabricatorConfigLocalSource())->setName(pht('Local Config')));
// If the install overrides the database adapter, we might need to load
// the database adapter class before we can push on the database config.
// This config is locked and can't be edited from the web UI anyway.
foreach (self::getEnvConfig('load-libraries') as $library) {
phutil_load_library($library);
}
// Drop any class map caches, since they will have generated without
// any classes from libraries. Without this, preflight setup checks can
// cause generation of a setup check cache that omits checks defined in
// libraries, for example.
PhutilClassMapQuery::deleteCaches();
// If custom libraries specify config options, they won't get default
// values as the Default source has already been loaded, so we get it to
// pull in all options from non-phabricator libraries now they are loaded.
$default_source->loadExternalOptions();
// If this install has site config sources, load them now.
$site_sources = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorConfigSiteSource')->setSortMethod('getPriority')->execute();
foreach ($site_sources as $site_source) {
$stack->pushSource($site_source);
}
$masters = PhabricatorDatabaseRef::getMasterDatabaseRefs();
if (!$masters) {
self::setReadOnly(true, self::READONLY_MASTERLESS);
} else {
// If any master is severed, we drop to readonly mode. In theory we
// could try to continue if we're only missing some applications, but
// this is very complex and we're unlikely to get it right.
foreach ($masters as $master) {
// Give severed masters one last chance to get healthy.
if ($master->isSevered()) {
$master->checkHealth();
}
if ($master->isSevered()) {
self::setReadOnly(true, self::READONLY_SEVERED);
break;
}
}
}
try {
$stack->pushSource(id(new PhabricatorConfigDatabaseSource('default'))->setName(pht('Database')));
} catch (AphrontSchemaQueryException $exception) {
// If the database is not available, just skip this configuration
// source. This happens during `bin/storage upgrade`, `bin/conf` before
// schema setup, etc.
} catch (AphrontConnectionQueryException $ex) {
if (!$config_optional) {
throw $ex;
}
} catch (AphrontInvalidCredentialsQueryException $ex) {
if (!$config_optional) {
throw $ex;
}
}
}