Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/config/schema/PhabricatorConfigDatabaseSchema.php
12262 views
1
<?php
2
3
final class PhabricatorConfigDatabaseSchema
4
extends PhabricatorConfigStorageSchema {
5
6
private $characterSet;
7
private $collation;
8
private $tables = array();
9
private $accessDenied;
10
11
public function addTable(PhabricatorConfigTableSchema $table) {
12
$key = $table->getName();
13
if (isset($this->tables[$key])) {
14
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;
19
}
20
21
throw new Exception(
22
pht('Trying to add duplicate table "%s"!', $key));
23
}
24
$this->tables[$key] = $table;
25
return $this;
26
}
27
28
public function getTables() {
29
return $this->tables;
30
}
31
32
public function getTable($key) {
33
return idx($this->tables, $key);
34
}
35
36
protected function getSubschemata() {
37
return $this->getTables();
38
}
39
40
protected function compareToSimilarSchema(
41
PhabricatorConfigStorageSchema $expect) {
42
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;
49
}
50
51
if ($this->getCollation() != $expect->getCollation()) {
52
$issues[] = self::ISSUE_COLLATION;
53
}
54
}
55
56
return $issues;
57
}
58
59
public function newEmptyClone() {
60
$clone = clone $this;
61
$clone->tables = array();
62
return $clone;
63
}
64
65
public function setCollation($collation) {
66
$this->collation = $collation;
67
return $this;
68
}
69
70
public function getCollation() {
71
return $this->collation;
72
}
73
74
public function setCharacterSet($character_set) {
75
$this->characterSet = $character_set;
76
return $this;
77
}
78
79
public function getCharacterSet() {
80
return $this->characterSet;
81
}
82
83
public function setAccessDenied($access_denied) {
84
$this->accessDenied = $access_denied;
85
return $this;
86
}
87
88
public function getAccessDenied() {
89
return $this->accessDenied;
90
}
91
92
}
93
94