2014-09-18 17:22:18 +02:00
|
|
|
<?php
|
|
|
|
|
2014-09-18 17:22:54 +02:00
|
|
|
final class PhabricatorConfigServerSchema
|
|
|
|
extends PhabricatorConfigStorageSchema {
|
2014-09-18 17:22:18 +02:00
|
|
|
|
2016-11-12 18:22:10 +01:00
|
|
|
private $ref;
|
2014-09-18 17:22:18 +02:00
|
|
|
private $databases = array();
|
|
|
|
|
2016-11-12 18:22:10 +01:00
|
|
|
public function setRef(PhabricatorDatabaseRef $ref) {
|
|
|
|
$this->ref = $ref;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRef() {
|
|
|
|
return $this->ref;
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:22:18 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:22:54 +02:00
|
|
|
protected function getSubschemata() {
|
|
|
|
return $this->getDatabases();
|
|
|
|
}
|
|
|
|
|
2015-01-06 21:33:52 +01:00
|
|
|
protected function compareToSimilarSchema(
|
2014-09-18 17:22:54 +02:00
|
|
|
PhabricatorConfigStorageSchema $expect) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function newEmptyClone() {
|
|
|
|
$clone = clone $this;
|
|
|
|
$clone->databases = array();
|
|
|
|
return $clone;
|
|
|
|
}
|
|
|
|
|
2014-09-18 17:22:18 +02:00
|
|
|
}
|