Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
| Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | return PhabricatorEnv::newObjectFromConfig( | ||||
| 'database' => $database, | 'database' => $database, | ||||
| 'retries' => 3, | 'retries' => 3, | ||||
| 'timeout' => 10, | 'timeout' => 10, | ||||
| ), | ), | ||||
| )); | )); | ||||
| } | } | ||||
| private function newClusterConnection($database, $mode) { | private function newClusterConnection($database, $mode) { | ||||
| $master = PhabricatorDatabaseRef::getMasterDatabaseRef(); | $master = PhabricatorDatabaseRef::getMasterDatabaseRefForDatabase( | ||||
| $database); | |||||
| if ($master && !$master->isSevered()) { | if ($master && !$master->isSevered()) { | ||||
| $connection = $master->newApplicationConnection($database); | $connection = $master->newApplicationConnection($database); | ||||
| if ($master->isReachable($connection)) { | if ($master->isReachable($connection)) { | ||||
| return $connection; | return $connection; | ||||
| } else { | } else { | ||||
| if ($mode == 'w') { | if ($mode == 'w') { | ||||
| $this->raiseImpossibleWrite($database); | $this->raiseImpossibleWrite($database); | ||||
| } | } | ||||
| PhabricatorEnv::setReadOnly( | PhabricatorEnv::setReadOnly( | ||||
| true, | true, | ||||
| PhabricatorEnv::READONLY_UNREACHABLE); | PhabricatorEnv::READONLY_UNREACHABLE); | ||||
| } | } | ||||
| } | } | ||||
| $replica = PhabricatorDatabaseRef::getReplicaDatabaseRef(); | $replica = PhabricatorDatabaseRef::getReplicaDatabaseRefForDatabase( | ||||
| $database); | |||||
| if ($replica) { | if ($replica) { | ||||
| $connection = $replica->newApplicationConnection($database); | $connection = $replica->newApplicationConnection($database); | ||||
| $connection->setReadOnly(true); | $connection->setReadOnly(true); | ||||
| if ($replica->isReachable($connection)) { | if ($replica->isReachable($connection)) { | ||||
| return $connection; | return $connection; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines | |||||