1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/config/schema/PhabricatorConfigServerSchema.php
epriestley bc15eee3f2 Update SchemaQuery and the web UI to accommodate multiple master databases
Summary:
Depends on D16115. Ref T11044. In the brave new world of multiple masters, we need to check the schemata on each master when looking for missing storage patches, keys, schema changes, etc.

This realigns all the "check out what's up with that schema" calls to work for multiple hosts, and updates the web UI to include a "Server" column and allow you to browse per-server.

This doesn't update `bin/storage`, so it breaks things on its own (and unit tests probably won't pass). I'll update that in the next change.

Test Plan: Configured local environment in cluster mode with multiple masters, saw both hosts' status reported in web UI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11044

Differential Revision: https://secure.phabricator.com/D16847
2016-11-12 16:36:52 -08:00

51 lines
1.1 KiB
PHP

<?php
final class PhabricatorConfigServerSchema
extends PhabricatorConfigStorageSchema {
private $ref;
private $databases = array();
public function setRef(PhabricatorDatabaseRef $ref) {
$this->ref = $ref;
return $this;
}
public function getRef() {
return $this->ref;
}
public function addDatabase(PhabricatorConfigDatabaseSchema $database) {
$key = $database->getName();
if (isset($this->databases[$key])) {
throw new Exception(
pht('Trying to add duplicate database "%s"!', $key));
}
$this->databases[$key] = $database;
return $this;
}
public function getDatabases() {
return $this->databases;
}
public function getDatabase($key) {
return idx($this->getDatabases(), $key);
}
protected function getSubschemata() {
return $this->getDatabases();
}
protected function compareToSimilarSchema(
PhabricatorConfigStorageSchema $expect) {
return array();
}
public function newEmptyClone() {
$clone = clone $this;
$clone->databases = array();
return $clone;
}
}