diff options
author | Joas Schilling <coding@schilljs.com> | 2018-02-07 16:03:21 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-02-16 10:23:51 +0100 |
commit | 17a26dfcc1f4d02b54e6cbb500f41bbe25609f1e (patch) | |
tree | 045682f754bec9284239df359715660148251011 /core/Command | |
parent | 620ee00ac5d176e85ba0dd9dd10cff6d1ef5172f (diff) | |
download | nextcloud-server-17a26dfcc1f4d02b54e6cbb500f41bbe25609f1e.tar.gz nextcloud-server-17a26dfcc1f4d02b54e6cbb500f41bbe25609f1e.zip |
Validate the info.xml against the appstore schema file
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Command')
-rw-r--r-- | core/Command/App/CheckCode.php | 54 |
1 files changed, 4 insertions, 50 deletions
diff --git a/core/Command/App/CheckCode.php b/core/Command/App/CheckCode.php index 82a137e58e1..a129bcf1e10 100644 --- a/core/Command/App/CheckCode.php +++ b/core/Command/App/CheckCode.php @@ -44,20 +44,12 @@ use OC\App\CodeChecker\PrivateCheck; class CheckCode extends Command implements CompletionAwareInterface { - /** @var InfoParser */ - private $infoParser; - protected $checkers = [ 'private' => PrivateCheck::class, 'deprecation' => DeprecationCheck::class, 'strong-comparison' => StrongComparisonCheck::class, ]; - public function __construct(InfoParser $infoParser) { - parent::__construct(); - $this->infoParser = $infoParser; - } - protected function configure() { $this ->setName('app:check-code') @@ -134,50 +126,12 @@ class CheckCode extends Command implements CompletionAwareInterface { } if(!$input->getOption('skip-validate-info')) { - $infoChecker = new InfoChecker($this->infoParser); - - $infoChecker->listen('InfoChecker', 'mandatoryFieldMissing', function($key) use ($output) { - $output->writeln("<error>Mandatory field missing: $key</error>"); - }); - - $infoChecker->listen('InfoChecker', 'deprecatedFieldFound', function($key, $value) use ($output) { - if($value === [] || is_null($value) || $value === '') { - $output->writeln("<info>Deprecated field available: $key</info>"); - } else { - $output->writeln("<info>Deprecated field available: $key => $value</info>"); - } - }); - - $infoChecker->listen('InfoChecker', 'missingRequirement', function($minMax) use ($output) { - $output->writeln("<error>Nextcloud $minMax version requirement missing</error>"); - }); - - $infoChecker->listen('InfoChecker', 'differentVersions', function($versionFile, $infoXML) use ($output) { - $output->writeln("<error>Different versions provided (appinfo/version: $versionFile - appinfo/info.xml: $infoXML)</error>"); + // Can not inject because of circular dependency + $infoChecker = new InfoChecker(\OC::$server->getAppManager()); + $infoChecker->listen('InfoChecker', 'parseError', function($error) use ($output) { + $output->writeln("<error>Invalid appinfo.xml file found: $error</error>"); }); - $infoChecker->listen('InfoChecker', 'sameVersions', function($path) use ($output) { - $output->writeln("<info>Version file isn't needed anymore and can be safely removed ($path)</info>"); - }); - - $infoChecker->listen('InfoChecker', 'migrateVersion', function($version) use ($output) { - $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()) { - $infoChecker->listen('InfoChecker', 'mandatoryFieldFound', function($key, $value) use ($output) { - $output->writeln("<info>Mandatory field available: $key => $value</info>"); - }); - - $infoChecker->listen('InfoChecker', 'optionalFieldFound', function($key, $value) use ($output) { - $output->writeln("<info>Optional field available: $key => $value</info>"); - }); - - $infoChecker->listen('InfoChecker', 'unusedFieldFound', function($key, $value) use ($output) { - $output->writeln("<info>Unused field available: $key => $value</info>"); - }); - } - $infoErrors = $infoChecker->analyse($appId); $errors = array_merge($errors, $infoErrors); |