зеркало из https://github.com/nextcloud/news.git
move databases into dependencies section
This commit is contained in:
Родитель
261572a980
Коммит
29000e2d6f
|
@ -34,9 +34,9 @@
|
|||
"hooks": {
|
||||
"OC_User::pre_deleteUser": "OCA\\News\\Hooks\\User::deleteUser"
|
||||
},
|
||||
"databases": ["pgsql", "sqlite3", "mysql"],
|
||||
"categories": ["Multimedia"],
|
||||
"dependencies": {
|
||||
"databases": ["pgsql", "sqlite3", "mysql"],
|
||||
"php": ">=5.4",
|
||||
"owncloud": ">=7.0.3",
|
||||
"libs": {
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
3.405
|
|
@ -150,9 +150,9 @@ class AppConfig {
|
|||
}
|
||||
|
||||
|
||||
private function testDatabaseDependencies() {
|
||||
if(array_key_exists('databases', $this->config)) {
|
||||
$databases = $this->config['databases'];
|
||||
private function testDatabaseDependencies($deps) {
|
||||
if(array_key_exists('databases', $deps)) {
|
||||
$databases = $deps['databases'];
|
||||
$databaseType = $this->databaseType;
|
||||
|
||||
if(!in_array($databaseType, $databases)) {
|
||||
|
@ -161,41 +161,33 @@ class AppConfig {
|
|||
implode(', ', $databases);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
private function testPHPDependencies() {
|
||||
if(array_key_exists('dependencies', $this->config)) {
|
||||
|
||||
$deps = $this->config['dependencies'];
|
||||
|
||||
if (array_key_exists('php', $deps)) {
|
||||
return $this->requireVersion($this->phpVersion, $deps['php'],
|
||||
'PHP');
|
||||
}
|
||||
|
||||
private function testPHPDependencies($deps) {
|
||||
if (array_key_exists('php', $deps)) {
|
||||
return $this->requireVersion($this->phpVersion, $deps['php'],
|
||||
'PHP');
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
private function testLibraryDependencies() {
|
||||
if(array_key_exists('dependencies', $this->config)) {
|
||||
|
||||
$deps = $this->config['dependencies'];
|
||||
|
||||
if (array_key_exists('libs', $deps)) {
|
||||
foreach ($deps['libs'] as $lib => $versions) {
|
||||
if(array_key_exists($lib, $this->installedExtensions)) {
|
||||
return $this->requireVersion($this->installedExtensions[$lib],
|
||||
$versions, 'PHP extension ' . $lib);
|
||||
} else {
|
||||
return 'PHP extension ' . $lib . ' required but not installed';
|
||||
}
|
||||
private function testLibraryDependencies($deps) {
|
||||
if (array_key_exists('libs', $deps)) {
|
||||
foreach ($deps['libs'] as $lib => $versions) {
|
||||
if(array_key_exists($lib, $this->installedExtensions)) {
|
||||
return $this->requireVersion($this->installedExtensions[$lib],
|
||||
$versions, 'PHP extension ' . $lib);
|
||||
} else {
|
||||
return 'PHP extension ' . $lib . ' required but not installed';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -205,12 +197,16 @@ class AppConfig {
|
|||
* @throws DependencyException if one version is not satisfied
|
||||
*/
|
||||
public function testDependencies() {
|
||||
$msg = $this->testDatabaseDependencies();
|
||||
$msg .= $this->testPHPDependencies();
|
||||
$msg .= $this->testLibraryDependencies();
|
||||
if(array_key_exists('dependencies', $this->config)) {
|
||||
$deps = $this->config['dependencies'];
|
||||
|
||||
if($msg !== '') {
|
||||
throw new DependencyException($msg);
|
||||
$msg = $this->testDatabaseDependencies($deps);
|
||||
$msg .= $this->testPHPDependencies($deps);
|
||||
$msg .= $this->testLibraryDependencies($deps);
|
||||
|
||||
if($msg !== '') {
|
||||
throw new DependencyException($msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -115,19 +115,11 @@
|
|||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"databases": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["pgsql", "mysql", "sqlite3", "mssql", "oracle"]
|
||||
},
|
||||
"uniqueItems": true
|
||||
},
|
||||
"categories": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["Filesystem", "Authentication", "PIM", "Multimedia",
|
||||
"enum": ["Filesystem", "Authentication", "PIM", "Multimedia",
|
||||
"Productivity", "Games", "Tools", "Other"]
|
||||
},
|
||||
"minItems": 1,
|
||||
|
@ -136,6 +128,14 @@
|
|||
"dependencies": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"databases": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["pgsql", "mysql", "sqlite3", "mssql", "oracle"]
|
||||
},
|
||||
"uniqueItems": true
|
||||
},
|
||||
"php": {
|
||||
"type": "string",
|
||||
"pattern": "^((=|<|>|<=|>=)?[0-9]+(\\.[0-9]+)*(,(=|<|>|<=|>=)?[0-9]+(\\.[0-9]+)*)*|\\*)$"
|
||||
|
@ -167,11 +167,11 @@
|
|||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"id",
|
||||
"description",
|
||||
"licence",
|
||||
"version",
|
||||
"name",
|
||||
"id",
|
||||
"description",
|
||||
"licence",
|
||||
"version",
|
||||
"authors",
|
||||
"repository"
|
||||
],
|
||||
|
|
|
@ -180,8 +180,8 @@ class AppConfigTest extends \PHPUnit_Framework_TestCase {
|
|||
*/
|
||||
public function testSupportedDb() {
|
||||
$this->config->loadConfig([
|
||||
'databases' => [
|
||||
'pgsql', 'sqlite'
|
||||
'dependencies' => [
|
||||
"databases" => ['pgsql', 'sqlite']
|
||||
]
|
||||
]);
|
||||
$this->config->testDependencies();
|
||||
|
|
Загрузка…
Ссылка в новой задаче