diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-16 22:56:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-16 22:56:10 +0100 |
commit | 57e0881a9eb206cb9c3894af600c5ccf4b8b8ff7 (patch) | |
tree | 5324fd4c47d74e24217fcd2b05558d5f300a5d69 /core | |
parent | 45e7bb7f409d8d4585ef6f8cea76b422e246c2de (diff) | |
parent | 211212f4b3f2897672e3eec26cd073bbcfe85043 (diff) | |
download | nextcloud-server-57e0881a9eb206cb9c3894af600c5ccf4b8b8ff7.tar.gz nextcloud-server-57e0881a9eb206cb9c3894af600c5ccf4b8b8ff7.zip |
Merge pull request #8232 from nextcloud/bugfix/8007/validate-appinfo-against-appstore-schema
Validate appinfo against appstore schema
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/App/CheckCode.php | 53 | ||||
-rw-r--r-- | core/register_command.php | 3 |
2 files changed, 4 insertions, 52 deletions
diff --git a/core/Command/App/CheckCode.php b/core/Command/App/CheckCode.php index 82a137e58e1..530c1d30ec0 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,11 @@ 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>"); + $infoChecker = new InfoChecker(); + $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); diff --git a/core/register_command.php b/core/register_command.php index 372d775dc14..578b4f799b6 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -40,8 +40,7 @@ $application->add(new \Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand()); $application->add(new OC\Core\Command\Status); $application->add(new OC\Core\Command\Check(\OC::$server->getSystemConfig())); -$infoParser = new \OC\App\InfoParser(); -$application->add(new OC\Core\Command\App\CheckCode($infoParser)); +$application->add(new OC\Core\Command\App\CheckCode()); $application->add(new OC\Core\Command\L10n\CreateJs()); $application->add(new \OC\Core\Command\Integrity\SignApp( \OC::$server->getIntegrityCodeChecker(), |