Update info checker requirements

This commit is contained in:
Joas Schilling 2016-02-11 11:25:50 +01:00
parent 5165998723
commit 8cfdc62eae
2 changed files with 6 additions and 13 deletions

View File

@ -41,21 +41,22 @@ class InfoChecker extends BasicEmitter {
'bugs', 'bugs',
'category', 'category',
'default_enable', 'default_enable',
'dependencies', 'dependencies', // TODO: Mandatory as of ownCloud 11
'documentation', 'documentation',
'namespace', 'namespace',
'ocsid', 'ocsid',
'public', 'public',
'remote', 'remote',
'repository', 'repository',
'require',
'requiremin',
'types', 'types',
'version', 'version',
'website', 'website',
]; ];
private $deprecatedFields = [ private $deprecatedFields = [
'info', 'info',
'require',
'requiremax',
'requiremin',
'shipped', 'shipped',
'standalone', 'standalone',
]; ];
@ -137,7 +138,7 @@ class InfoChecker extends BasicEmitter {
$versionFile = $appPath . '/appinfo/version'; $versionFile = $appPath . '/appinfo/version';
if (is_file($versionFile)) { if (is_file($versionFile)) {
$version = trim(file_get_contents($versionFile)); $version = trim(file_get_contents($versionFile));
if(isset($info['version'])) { if (isset($info['version'])) {
if($info['version'] !== $version) { if($info['version'] !== $version) {
$this->emit('InfoChecker', 'differentVersions', $this->emit('InfoChecker', 'differentVersions',
[$version, $info['version']]); [$version, $info['version']]);
@ -152,14 +153,6 @@ class InfoChecker extends BasicEmitter {
} else { } else {
$this->emit('InfoChecker', 'migrateVersion', [$version]); $this->emit('InfoChecker', 'migrateVersion', [$version]);
} }
} else {
if(!isset($info['version'])) {
$this->emit('InfoChecker', 'mandatoryFieldMissing', ['version']);
$errors[] = [
'type' => 'mandatoryFieldMissing',
'field' => 'version',
];
}
} }
return $errors; return $errors;

View File

@ -54,7 +54,7 @@ class InfoCheckerTest extends TestCase {
['testapp-version', []], ['testapp-version', []],
['testapp-infoxml-version', []], ['testapp-infoxml-version', []],
['testapp-infoxml-version-different', [['type' => 'differentVersions', 'message' => 'appinfo/version: 1.2.4 - appinfo/info.xml: 1.2.3']]], ['testapp-infoxml-version-different', [['type' => 'differentVersions', 'message' => 'appinfo/version: 1.2.4 - appinfo/info.xml: 1.2.3']]],
['testapp-version-missing', [['type' => 'mandatoryFieldMissing', 'field' => 'version']]], ['testapp-version-missing', []],
['testapp-name-missing', [['type' => 'mandatoryFieldMissing', 'field' => 'name']]], ['testapp-name-missing', [['type' => 'mandatoryFieldMissing', 'field' => 'name']]],
]; ];
} }