mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-02 11:42:42 +01:00
95dd9dbf43
Summary: Ref T11476. This is a bit hacky, but makes `Application` extend `LiskDAO` so we can apply transactions to it with an `Editor` class. Also fixes schema stuff so builds should produce a clean bill of health again. This might only get you slightly further, yell if you run into more trouble. Test Plan: - Ran `bin/storage upgrade -f` and got no warnings. - Browsed around, nothing exploded? Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T11476 Differential Revision: https://secure.phabricator.com/D17738
92 lines
2 KiB
PHP
92 lines
2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorConfigDatabaseSchema
|
|
extends PhabricatorConfigStorageSchema {
|
|
|
|
private $characterSet;
|
|
private $collation;
|
|
private $tables = array();
|
|
private $accessDenied;
|
|
|
|
public function addTable(PhabricatorConfigTableSchema $table) {
|
|
$key = $table->getName();
|
|
if (isset($this->tables[$key])) {
|
|
|
|
if ($key == 'application_application') {
|
|
// NOTE: This is a terrible hack to allow Application subclasses to
|
|
// extend LiskDAO so we can apply transactions to them.
|
|
return $this;
|
|
}
|
|
|
|
throw new Exception(
|
|
pht('Trying to add duplicate table "%s"!', $key));
|
|
}
|
|
$this->tables[$key] = $table;
|
|
return $this;
|
|
}
|
|
|
|
public function getTables() {
|
|
return $this->tables;
|
|
}
|
|
|
|
public function getTable($key) {
|
|
return idx($this->tables, $key);
|
|
}
|
|
|
|
protected function getSubschemata() {
|
|
return $this->getTables();
|
|
}
|
|
|
|
protected function compareToSimilarSchema(
|
|
PhabricatorConfigStorageSchema $expect) {
|
|
|
|
$issues = array();
|
|
if ($this->getAccessDenied()) {
|
|
$issues[] = self::ISSUE_ACCESSDENIED;
|
|
} else {
|
|
if ($this->getCharacterSet() != $expect->getCharacterSet()) {
|
|
$issues[] = self::ISSUE_CHARSET;
|
|
}
|
|
|
|
if ($this->getCollation() != $expect->getCollation()) {
|
|
$issues[] = self::ISSUE_COLLATION;
|
|
}
|
|
}
|
|
|
|
return $issues;
|
|
}
|
|
|
|
public function newEmptyClone() {
|
|
$clone = clone $this;
|
|
$clone->tables = array();
|
|
return $clone;
|
|
}
|
|
|
|
public function setCollation($collation) {
|
|
$this->collation = $collation;
|
|
return $this;
|
|
}
|
|
|
|
public function getCollation() {
|
|
return $this->collation;
|
|
}
|
|
|
|
public function setCharacterSet($character_set) {
|
|
$this->characterSet = $character_set;
|
|
return $this;
|
|
}
|
|
|
|
public function getCharacterSet() {
|
|
return $this->characterSet;
|
|
}
|
|
|
|
public function setAccessDenied($access_denied) {
|
|
$this->accessDenied = $access_denied;
|
|
return $this;
|
|
}
|
|
|
|
public function getAccessDenied() {
|
|
return $this->accessDenied;
|
|
}
|
|
|
|
}
|