Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/cluster/PhabricatorDatabaseRef.php
| Show First 20 Lines • Show All 512 Lines • ▼ Show 20 Lines | public static function getMasterDatabaseRefs() { | ||||
| $refs = self::getAllMasterDatabaseRefs(); | $refs = self::getAllMasterDatabaseRefs(); | ||||
| return self::getEnabledRefs($refs); | return self::getEnabledRefs($refs); | ||||
| } | } | ||||
| public function isApplicationHost($database) { | public function isApplicationHost($database) { | ||||
| return isset($this->applicationMap[$database]); | return isset($this->applicationMap[$database]); | ||||
| } | } | ||||
| public function loadRawMySQLConfigValue($key) { | |||||
| $conn = $this->newManagementConnection(); | |||||
| try { | |||||
| $value = queryfx_one($conn, 'SELECT @@%Q', $key); | |||||
| $value = $value['@@'.$key]; | |||||
| } catch (AphrontQueryException $ex) { | |||||
| $value = null; | |||||
| } | |||||
| return $value; | |||||
| } | |||||
| public static function getMasterDatabaseRefForApplication($application) { | public static function getMasterDatabaseRefForApplication($application) { | ||||
| $masters = self::getMasterDatabaseRefs(); | $masters = self::getMasterDatabaseRefs(); | ||||
| $application_master = null; | $application_master = null; | ||||
| $default_master = null; | $default_master = null; | ||||
| foreach ($masters as $master) { | foreach ($masters as $master) { | ||||
| if ($master->isApplicationHost($application)) { | if ($master->isApplicationHost($application)) { | ||||
| $application_master = $master; | $application_master = $master; | ||||
| ▲ Show 20 Lines • Show All 132 Lines • Show Last 20 Lines | |||||