Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/cluster/PhabricatorDatabaseRef.php
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | public function setApplicationMap(array $application_map) { | ||||
$this->applicationMap = $application_map; | $this->applicationMap = $application_map; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getApplicationMap() { | public function getApplicationMap() { | ||||
return $this->applicationMap; | return $this->applicationMap; | ||||
} | } | ||||
public function getPartitionStateForCommit() { | |||||
$state = PhabricatorEnv::getEnvConfig('cluster.databases'); | |||||
foreach ($state as $key => $value) { | |||||
// Don't store passwords, since we don't care if they differ and | |||||
// users may find it surprising. | |||||
unset($state[$key]['pass']); | |||||
} | |||||
ksort($state); | |||||
return phutil_json_encode($state); | |||||
} | |||||
public function setMasterRef(PhabricatorDatabaseRef $master_ref) { | public function setMasterRef(PhabricatorDatabaseRef $master_ref) { | ||||
$this->masterRef = $master_ref; | $this->masterRef = $master_ref; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getMasterRef() { | public function getMasterRef() { | ||||
return $this->masterRef; | return $this->masterRef; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 302 Lines • ▼ Show 20 Lines | public static function getAllMasterDatabaseRefs() { | ||||
$refs = self::getClusterRefs(); | $refs = self::getClusterRefs(); | ||||
if (!$refs) { | if (!$refs) { | ||||
return array(self::getLiveIndividualRef()); | return array(self::getLiveIndividualRef()); | ||||
} | } | ||||
$masters = array(); | $masters = array(); | ||||
foreach ($refs as $ref) { | foreach ($refs as $ref) { | ||||
if ($ref->getDisabled()) { | |||||
continue; | |||||
} | |||||
if ($ref->getIsMaster()) { | if ($ref->getIsMaster()) { | ||||
$masters[] = $ref; | $masters[] = $ref; | ||||
} | } | ||||
} | } | ||||
return $masters; | return $masters; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |