summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-06-12 22:33:16 -0500
committerGitHub <noreply@github.com>2017-06-12 22:33:16 -0500
commit6a06df824e8527546e5374074efa2c51b1326a29 (patch)
tree3e97aa505a943f38280afa1ac5ce1881030e2364
parentea64cb00289a40ee3c12c195d7a2804ea1abe97e (diff)
parent02275e60c6a8bd9c5fe883c381cb78e49a2c04b7 (diff)
downloadnextcloud-server-6a06df824e8527546e5374074efa2c51b1326a29.tar.gz
nextcloud-server-6a06df824e8527546e5374074efa2c51b1326a29.zip
Merge pull request #5027 from nextcloud/require-nextcloud-version-as-per-docs
Version and dependency are now required
-rw-r--r--apps/oauth2/appinfo/info.xml4
-rw-r--r--core/Command/App/CheckCode.php8
-rw-r--r--core/shipped.json4
-rw-r--r--lib/private/App/CodeChecker/InfoChecker.php38
-rw-r--r--tests/apps/testapp-dependency-missing/appinfo/info.xml (renamed from tests/apps/testapp-infoxml-version-different/appinfo/info.xml)0
-rw-r--r--tests/apps/testapp-infoxml-version-different/appinfo/version1
-rw-r--r--tests/apps/testapp-infoxml-version/appinfo/info.xml9
-rw-r--r--tests/apps/testapp-infoxml-version/appinfo/version1
-rw-r--r--tests/apps/testapp-infoxml/appinfo/info.xml3
-rw-r--r--tests/apps/testapp-name-missing/appinfo/info.xml3
-rw-r--r--tests/apps/testapp-version-missing/appinfo/info.xml8
-rw-r--r--tests/apps/testapp-version/appinfo/info.xml3
-rw-r--r--tests/lib/App/CodeChecker/InfoCheckerTest.php10
13 files changed, 30 insertions, 62 deletions
diff --git a/apps/oauth2/appinfo/info.xml b/apps/oauth2/appinfo/info.xml
index ccddc9a8f71..fe8ce3a1289 100644
--- a/apps/oauth2/appinfo/info.xml
+++ b/apps/oauth2/appinfo/info.xml
@@ -15,6 +15,10 @@
<nextcloud min-version="13" max-version="13" />
</dependencies>
+ <dependencies>
+ <nextcloud min-version="12" max-version="12" />
+ </dependencies>
+
<settings>
<admin>OCA\OAuth2\Settings\Admin</admin>
</settings>
diff --git a/core/Command/App/CheckCode.php b/core/Command/App/CheckCode.php
index 46b9b748ada..48662409dcf 100644
--- a/core/Command/App/CheckCode.php
+++ b/core/Command/App/CheckCode.php
@@ -146,11 +146,7 @@ class CheckCode extends Command implements CompletionAwareInterface {
});
$infoChecker->listen('InfoChecker', 'missingRequirement', function($minMax) use ($output) {
- $output->writeln("<comment>Nextcloud $minMax version requirement missing (will be an error in Nextcloud 12 and later)</comment>");
- });
-
- $infoChecker->listen('InfoChecker', 'duplicateRequirement', function($minMax) use ($output) {
- $output->writeln("<error>Duplicate $minMax ownCloud version requirement found</error>");
+ $output->writeln("<error>Nextcloud $minMax version requirement missing</error>");
});
$infoChecker->listen('InfoChecker', 'differentVersions', function($versionFile, $infoXML) use ($output) {
@@ -162,7 +158,7 @@ class CheckCode extends Command implements CompletionAwareInterface {
});
$infoChecker->listen('InfoChecker', 'migrateVersion', function($version) use ($output) {
- $output->writeln("<info>Migrate the app version to appinfo/info.xml (add <version>$version</version> to appinfo/info.xml and remove appinfo/version)</info>");
+ $output->writeln("<error>Migrate the app version to appinfo/info.xml (add <version>$version</version> to appinfo/info.xml and remove appinfo/version)</error>");
});
if(OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
diff --git a/core/shipped.json b/core/shipped.json
index 83eb3a29787..0c09e53244b 100644
--- a/core/shipped.json
+++ b/core/shipped.json
@@ -21,15 +21,15 @@
"lookup_server_connector",
"nextcloud_announcements",
"notifications",
+ "oauth2",
"password_policy",
"provisioning_api",
"serverinfo",
"sharebymail",
"survey_client",
"systemtags",
- "templateeditor",
- "twofactor_backupcodes",
"theming",
+ "twofactor_backupcodes",
"updatenotification",
"user_external",
"user_ldap",
diff --git a/lib/private/App/CodeChecker/InfoChecker.php b/lib/private/App/CodeChecker/InfoChecker.php
index 1e617e3aeec..e8791bd7037 100644
--- a/lib/private/App/CodeChecker/InfoChecker.php
+++ b/lib/private/App/CodeChecker/InfoChecker.php
@@ -34,15 +34,16 @@ class InfoChecker extends BasicEmitter {
private $mandatoryFields = [
'author',
'description',
+ 'dependencies',
'id',
'licence',
'name',
+ 'version',
];
private $optionalFields = [
'bugs',
'category',
'default_enable',
- 'dependencies', // TODO: Mandatory as of ownCloud 11
'documentation',
'namespace',
'ocsid',
@@ -50,7 +51,6 @@ class InfoChecker extends BasicEmitter {
'remote',
'repository',
'types',
- 'version',
'website',
];
private $deprecatedFields = [
@@ -80,29 +80,19 @@ class InfoChecker extends BasicEmitter {
$info = $this->infoParser->parse($appPath . '/appinfo/info.xml');
- if (isset($info['dependencies']['owncloud']['@attributes']['min-version']) && (isset($info['requiremin']) || isset($info['require']))) {
- $this->emit('InfoChecker', 'duplicateRequirement', ['min']);
+ if (!isset($info['dependencies']['nextcloud']['@attributes']['min-version'])) {
$errors[] = [
- 'type' => 'duplicateRequirement',
+ 'type' => 'missingRequirement',
'field' => 'min',
];
- } else if (
- !isset($info['dependencies']['owncloud']['@attributes']['min-version']) &&
- !isset($info['dependencies']['nextcloud']['@attributes']['min-version'])
- ) {
$this->emit('InfoChecker', 'missingRequirement', ['min']);
}
- if (isset($info['dependencies']['owncloud']['@attributes']['max-version']) && isset($info['requiremax'])) {
- $this->emit('InfoChecker', 'duplicateRequirement', ['max']);
+ if (!isset($info['dependencies']['nextcloud']['@attributes']['max-version'])) {
$errors[] = [
- 'type' => 'duplicateRequirement',
+ 'type' => 'missingRequirement',
'field' => 'max',
];
- } else if (
- !isset($info['dependencies']['owncloud']['@attributes']['max-version']) &&
- !isset($info['dependencies']['nextcloud']['@attributes']['max-version'])
- ) {
$this->emit('InfoChecker', 'missingRequirement', ['max']);
}
@@ -145,21 +135,7 @@ class InfoChecker extends BasicEmitter {
$versionFile = $appPath . '/appinfo/version';
if (is_file($versionFile)) {
$version = trim(file_get_contents($versionFile));
- if (isset($info['version'])) {
- if($info['version'] !== $version) {
- $this->emit('InfoChecker', 'differentVersions',
- [$version, $info['version']]);
- $errors[] = [
- 'type' => 'differentVersions',
- 'message' => 'appinfo/version: ' . $version .
- ' - appinfo/info.xml: ' . $info['version'],
- ];
- } else {
- $this->emit('InfoChecker', 'sameVersions', [$versionFile]);
- }
- } else {
- $this->emit('InfoChecker', 'migrateVersion', [$version]);
- }
+ $this->emit('InfoChecker', 'migrateVersion', [$version]);
}
return $errors;
diff --git a/tests/apps/testapp-infoxml-version-different/appinfo/info.xml b/tests/apps/testapp-dependency-missing/appinfo/info.xml
index c765400a76f..c765400a76f 100644
--- a/tests/apps/testapp-infoxml-version-different/appinfo/info.xml
+++ b/tests/apps/testapp-dependency-missing/appinfo/info.xml
diff --git a/tests/apps/testapp-infoxml-version-different/appinfo/version b/tests/apps/testapp-infoxml-version-different/appinfo/version
deleted file mode 100644
index e8ea05db814..00000000000
--- a/tests/apps/testapp-infoxml-version-different/appinfo/version
+++ /dev/null
@@ -1 +0,0 @@
-1.2.4
diff --git a/tests/apps/testapp-infoxml-version/appinfo/info.xml b/tests/apps/testapp-infoxml-version/appinfo/info.xml
deleted file mode 100644
index c765400a76f..00000000000
--- a/tests/apps/testapp-infoxml-version/appinfo/info.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<info>
- <id>testapp-infoxml-version</id>
- <version>1.2.3</version>
- <author>Jane</author>
- <description>A b c</description>
- <licence>Abc</licence>
- <name>Test app</name>
-</info>
diff --git a/tests/apps/testapp-infoxml-version/appinfo/version b/tests/apps/testapp-infoxml-version/appinfo/version
deleted file mode 100644
index 0495c4a88ca..00000000000
--- a/tests/apps/testapp-infoxml-version/appinfo/version
+++ /dev/null
@@ -1 +0,0 @@
-1.2.3
diff --git a/tests/apps/testapp-infoxml/appinfo/info.xml b/tests/apps/testapp-infoxml/appinfo/info.xml
index cb63a0fc76e..d4df1c3cd3f 100644
--- a/tests/apps/testapp-infoxml/appinfo/info.xml
+++ b/tests/apps/testapp-infoxml/appinfo/info.xml
@@ -6,4 +6,7 @@
<description>A b c</description>
<licence>Abc</licence>
<name>Test app</name>
+ <dependencies>
+ <nextcloud min-version="12.0" max-version="12.0"/>
+ </dependencies>
</info>
diff --git a/tests/apps/testapp-name-missing/appinfo/info.xml b/tests/apps/testapp-name-missing/appinfo/info.xml
index f0a62b8d380..591c4361899 100644
--- a/tests/apps/testapp-name-missing/appinfo/info.xml
+++ b/tests/apps/testapp-name-missing/appinfo/info.xml
@@ -5,4 +5,7 @@
<author>Jane</author>
<description>A b c</description>
<licence>Abc</licence>
+ <dependencies>
+ <nextcloud min-version="12.0" max-version="12.0"/>
+ </dependencies>
</info>
diff --git a/tests/apps/testapp-version-missing/appinfo/info.xml b/tests/apps/testapp-version-missing/appinfo/info.xml
deleted file mode 100644
index d7da3e07e36..00000000000
--- a/tests/apps/testapp-version-missing/appinfo/info.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<info>
- <id>testapp-version</id>
- <author>Jane</author>
- <description>A b c</description>
- <licence>Abc</licence>
- <name>Test app</name>
-</info>
diff --git a/tests/apps/testapp-version/appinfo/info.xml b/tests/apps/testapp-version/appinfo/info.xml
index d7da3e07e36..28e2475800f 100644
--- a/tests/apps/testapp-version/appinfo/info.xml
+++ b/tests/apps/testapp-version/appinfo/info.xml
@@ -5,4 +5,7 @@
<description>A b c</description>
<licence>Abc</licence>
<name>Test app</name>
+ <dependencies>
+ <nextcloud min-version="12.0" max-version="12.0"/>
+ </dependencies>
</info>
diff --git a/tests/lib/App/CodeChecker/InfoCheckerTest.php b/tests/lib/App/CodeChecker/InfoCheckerTest.php
index c16874fbd33..760d9880739 100644
--- a/tests/lib/App/CodeChecker/InfoCheckerTest.php
+++ b/tests/lib/App/CodeChecker/InfoCheckerTest.php
@@ -50,10 +50,12 @@ class InfoCheckerTest extends TestCase {
public function appInfoData() {
return [
['testapp-infoxml', []],
- ['testapp-version', []],
- ['testapp-infoxml-version', []],
- ['testapp-infoxml-version-different', [['type' => 'differentVersions', 'message' => 'appinfo/version: 1.2.4 - appinfo/info.xml: 1.2.3']]],
- ['testapp-version-missing', []],
+ ['testapp-version', [['type' => 'mandatoryFieldMissing', 'field' => 'version']]],
+ ['testapp-dependency-missing', [
+ ['type' => 'missingRequirement', 'field' => 'min'],
+ ['type' => 'missingRequirement', 'field' => 'max'],
+ ['type' => 'mandatoryFieldMissing', 'field' => 'dependencies'],
+ ]],
['testapp-name-missing', [['type' => 'mandatoryFieldMissing', 'field' => 'name']]],
];
}