Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/cluster/PhabricatorDatabaseRef.php
Show First 20 Lines • Show All 551 Lines • ▼ Show 20 Lines | final class PhabricatorDatabaseRef | ||||
public function isApplicationHost($database) { | public function isApplicationHost($database) { | ||||
return isset($this->applicationMap[$database]); | return isset($this->applicationMap[$database]); | ||||
} | } | ||||
public function loadRawMySQLConfigValue($key) { | public function loadRawMySQLConfigValue($key) { | ||||
$conn = $this->newManagementConnection(); | $conn = $this->newManagementConnection(); | ||||
try { | try { | ||||
$value = queryfx_one($conn, 'SELECT @@%Q', $key); | $value = queryfx_one($conn, 'SELECT @@%C', $key); | ||||
$value = $value['@@'.$key]; | |||||
// NOTE: Although MySQL allows us to escape configuration values as if | |||||
// they are column names, the escaping is included in the column name | |||||
// of the return value: if we select "@@`x`", we get back a column named | |||||
// "@@`x`", not "@@x" as we might expect. | |||||
$value = head($value); | |||||
} catch (AphrontQueryException $ex) { | } catch (AphrontQueryException $ex) { | ||||
$value = null; | $value = null; | ||||
} | } | ||||
return $value; | return $value; | ||||
} | } | ||||
public static function getMasterDatabaseRefForApplication($application) { | public static function getMasterDatabaseRefForApplication($application) { | ||||
▲ Show 20 Lines • Show All 169 Lines • Show Last 20 Lines |