Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/env/PhabricatorEnv.php
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | final class PhabricatorEnv extends Phobject { | ||||
private static $sourceStack; | private static $sourceStack; | ||||
private static $repairSource; | private static $repairSource; | ||||
private static $overrideSource; | private static $overrideSource; | ||||
private static $requestBaseURI; | private static $requestBaseURI; | ||||
private static $cache; | private static $cache; | ||||
private static $localeCode; | private static $localeCode; | ||||
private static $readOnly; | private static $readOnly; | ||||
private static $readOnlyReason; | |||||
const READONLY_CONFIG = 'config'; | |||||
/** | /** | ||||
* @phutil-external-symbol class PhabricatorStartup | * @phutil-external-symbol class PhabricatorStartup | ||||
*/ | */ | ||||
public static function initializeWebEnvironment() { | public static function initializeWebEnvironment() { | ||||
self::initializeCommonEnvironment(); | self::initializeCommonEnvironment(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 374 Lines • ▼ Show 20 Lines | /* -( Reading Configuration )---------------------------------------------- */ | ||||
public static function isReadOnly() { | public static function isReadOnly() { | ||||
if (self::$readOnly !== null) { | if (self::$readOnly !== null) { | ||||
return self::$readOnly; | return self::$readOnly; | ||||
} | } | ||||
return self::getEnvConfig('cluster.read-only'); | return self::getEnvConfig('cluster.read-only'); | ||||
} | } | ||||
public static function setReadOnly($read_only) { | public static function setReadOnly($read_only, $reason) { | ||||
self::$readOnly = $read_only; | self::$readOnly = $read_only; | ||||
self::$readOnlyReason = $reason; | |||||
} | |||||
public static function getReadOnlyMessage() { | |||||
return pht('Phabricator is currently in read-only mode.'); | |||||
} | |||||
public static function getReadOnlyURI() { | |||||
return urisprintf( | |||||
'/readonly/%s/', | |||||
self::getReadOnlyReason()); | |||||
} | |||||
public static function getReadOnlyReason() { | |||||
if (!self::isReadOnly()) { | |||||
return null; | |||||
} | |||||
if (self::$readOnlyReason !== null) { | |||||
return self::$readOnlyReason; | |||||
} | |||||
return self::READONLY_CONFIG; | |||||
} | } | ||||
/* -( Unit Test Support )-------------------------------------------------- */ | /* -( Unit Test Support )-------------------------------------------------- */ | ||||
/** | /** | ||||
* @task test | * @task test | ||||
▲ Show 20 Lines • Show All 349 Lines • Show Last 20 Lines |