Remove product literal strings in "pht()", part 18
[phabricator.git] / src / applications / config / schema / PhabricatorConfigDatabaseSchema.php
blobb9b407ee70a0005472a73f0e9d6ecd6f7a2d6555
1 <?php
3 final class PhabricatorConfigDatabaseSchema
4 extends PhabricatorConfigStorageSchema {
6 private $characterSet;
7 private $collation;
8 private $tables = array();
9 private $accessDenied;
11 public function addTable(PhabricatorConfigTableSchema $table) {
12 $key = $table->getName();
13 if (isset($this->tables[$key])) {
15 if ($key == 'application_application') {
16 // NOTE: This is a terrible hack to allow Application subclasses to
17 // extend LiskDAO so we can apply transactions to them.
18 return $this;
21 throw new Exception(
22 pht('Trying to add duplicate table "%s"!', $key));
24 $this->tables[$key] = $table;
25 return $this;
28 public function getTables() {
29 return $this->tables;
32 public function getTable($key) {
33 return idx($this->tables, $key);
36 protected function getSubschemata() {
37 return $this->getTables();
40 protected function compareToSimilarSchema(
41 PhabricatorConfigStorageSchema $expect) {
43 $issues = array();
44 if ($this->getAccessDenied()) {
45 $issues[] = self::ISSUE_ACCESSDENIED;
46 } else {
47 if ($this->getCharacterSet() != $expect->getCharacterSet()) {
48 $issues[] = self::ISSUE_CHARSET;
51 if ($this->getCollation() != $expect->getCollation()) {
52 $issues[] = self::ISSUE_COLLATION;
56 return $issues;
59 public function newEmptyClone() {
60 $clone = clone $this;
61 $clone->tables = array();
62 return $clone;
65 public function setCollation($collation) {
66 $this->collation = $collation;
67 return $this;
70 public function getCollation() {
71 return $this->collation;
74 public function setCharacterSet($character_set) {
75 $this->characterSet = $character_set;
76 return $this;
79 public function getCharacterSet() {
80 return $this->characterSet;
83 public function setAccessDenied($access_denied) {
84 $this->accessDenied = $access_denied;
85 return $this;
88 public function getAccessDenied() {
89 return $this->accessDenied;