Merge pull request #1535 from nextcloud/fix/noid/returns-int

command returns int
master
Carl Schwan 2022-11-21 10:21:45 +01:00 zatwierdzone przez GitHub
commit 188ffa5bd8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
13 zmienionych plików z 50 dodań i 25 usunięć

Wyświetl plik

@ -75,7 +75,7 @@ class AccountCreate extends Base {
/**
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$userId = $input->getArgument('userId');
if (($handle = $input->getOption('handle')) === null) {
@ -87,5 +87,7 @@ class AccountCreate extends Base {
}
$this->accountService->createActor($userId, $handle);
return 0;
}
}

Wyświetl plik

@ -76,7 +76,7 @@ class AccountFollowing extends Base {
/**
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$userId = $input->getArgument('userId');
$account = $input->getArgument('account');
@ -91,5 +91,7 @@ class AccountFollowing extends Base {
} else {
$this->followService->followAccount($actor, $account);
}
return 0;
}
}

Wyświetl plik

@ -67,7 +67,7 @@ class CacheRefresh extends Base {
/**
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$result = $this->accountService->blindKeyRotation();
$output->writeLn($result . ' key pairs refreshed');
@ -85,5 +85,7 @@ class CacheRefresh extends Base {
$result = $this->hashtagService->manageHashtags();
$output->writeLn($result . ' hashtags updated');
return 0;
}
}

Wyświetl plik

@ -31,7 +31,6 @@ declare(strict_types=1);
namespace OCA\Social\Command;
use OCA\Social\Tools\Traits\TArrayTools;
use Exception;
use OC\Core\Command\Base;
use OCA\Social\Db\StreamDestRequest;
@ -42,6 +41,7 @@ use OCA\Social\Service\CheckService;
use OCA\Social\Service\ConfigService;
use OCA\Social\Service\MiscService;
use OCA\Social\Service\PushService;
use OCA\Social\Tools\Traits\TArrayTools;
use OCP\IUserManager;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputInterface;
@ -97,9 +97,9 @@ class CheckInstall extends Base {
/**
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
if ($this->askRegenerateIndex($input, $output)) {
return;
return 0;
}
// if ($this->checkPushApp($input, $output)) {
@ -114,6 +114,8 @@ class CheckInstall extends Base {
$output->writeln('');
$output->writeln('- Your current configuration: ');
$output->writeln(json_encode($this->configService->getConfig(), JSON_PRETTY_PRINT));
return 0;
}
/**

Wyświetl plik

@ -69,11 +69,11 @@ class Fediverse extends Base {
/**
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->output = $output;
if ($this->typeAccess($input->getOption('type'))) {
return;
return 0;
}
$this->output->writeln(
@ -108,6 +108,8 @@ class Fediverse extends Base {
default:
throw new Exception('specify action: add, remove, list, reset');
}
return 0;
}
/**

Wyświetl plik

@ -130,7 +130,7 @@ class MigrateAlpha3 extends Base {
/**
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$tables = $this->checkTables();
if ($input->getOption('force-remove-old-tables')) {
@ -138,13 +138,13 @@ class MigrateAlpha3 extends Base {
$this->dropTable($table);
}
return;
return 0;
}
if (empty($tables)) {
$output->writeln('Nothing to migrate.');
return;
return 0;
}
$defTables = '';
@ -157,7 +157,7 @@ class MigrateAlpha3 extends Base {
);
if (!$this->confirmExecute($input, $output)) {
return;
return 0;
}
$this->done = [];
@ -166,6 +166,8 @@ class MigrateAlpha3 extends Base {
if ($input->getOption('remove-migrated-tables')) {
$this->dropDeprecatedTables($input, $output);
}
return 0;
}

Wyświetl plik

@ -85,7 +85,7 @@ class NoteBoost extends Base {
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$userId = $input->getArgument('user_id');
$noteId = $input->getArgument('note_id');
@ -101,5 +101,7 @@ class NoteBoost extends Base {
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
echo 'token: ' . $token . "\n";
return 0;
}
}

Wyświetl plik

@ -121,7 +121,7 @@ class NoteCreate extends Base {
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$userId = $input->getArgument('userid');
$content = $input->getArgument('content');
$to = $input->getOption('to');
@ -142,5 +142,7 @@ class NoteCreate extends Base {
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
echo 'token: ' . $token . "\n";
return 0;
}
}

Wyświetl plik

@ -97,7 +97,7 @@ class NoteLike extends Base {
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$userId = $input->getArgument('user_id');
$noteId = $input->getArgument('note_id');
@ -113,5 +113,7 @@ class NoteLike extends Base {
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
echo 'token: ' . $token . "\n";
return 0;
}
}

Wyświetl plik

@ -87,12 +87,13 @@ class QueueProcess extends Base {
* @param InputInterface $input
* @param OutputInterface $output
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$output->writeLn('processing requests queue');
$this->processRequestQueue($output);
$output->writeLn('processing stream queue');
$this->processStreamQueue($output);
return 0;
}

Wyświetl plik

@ -85,7 +85,7 @@ class QueueStatus extends Base {
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$token = $input->getOption('token');
if ($token === null) {
@ -97,5 +97,7 @@ class QueueStatus extends Base {
foreach ($requests as $request) {
$output->writeLn(json_encode($request));
}
return 0;
}
}

Wyświetl plik

@ -91,7 +91,7 @@ class Reset extends Base {
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$helper = $this->getHelper('question');
$output->writeln(
'<error>Beware, this operation will delete all content from the Social App.</error>'
@ -102,7 +102,7 @@ class Reset extends Base {
);
if (!$helper->ask($input, $output, $question)) {
return;
return 0;
}
$question = new ConfirmationQuestion(
@ -110,7 +110,7 @@ class Reset extends Base {
'/^(y|Y)/i'
);
if (!$helper->ask($input, $output, $question)) {
return;
return 0;
}
@ -124,7 +124,7 @@ class Reset extends Base {
$output->writeln('<error>' . $e->getMessage() . '</error>');
}
return;
return 0;
}
@ -136,7 +136,7 @@ class Reset extends Base {
} catch (Exception $e) {
$output->writeln('<error>' . $e->getMessage() . '</error>');
return;
return 0;
}
$this->checkService->checkInstallationStatus(true);
@ -152,13 +152,15 @@ class Reset extends Base {
$newCloudAddress = $helper->ask($input, $output, $question);
if ($newCloudAddress === $cloudAddress) {
return;
return 0;
}
$this->configService->setCloudUrl($newCloudAddress);
$output->writeln('');
$output->writeln('New address: <info>' . $newCloudAddress . '</info>');
return 0;
}

Wyświetl plik

@ -92,7 +92,7 @@ class StreamDetails extends ExtendedBase {
*
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output) {
protected function execute(InputInterface $input, OutputInterface $output): int {
$output = new ConsoleOutput();
$this->output = $output->section();
@ -110,7 +110,7 @@ class StreamDetails extends ExtendedBase {
if ($this->asJson) {
$this->output->writeln(json_encode($details, JSON_PRETTY_PRINT));
return;
return 0;
}
$this->outputStream($stream);
@ -133,5 +133,7 @@ class StreamDetails extends ExtendedBase {
$this->output->writeln('* <info>Direct</info>: ' . json_encode($direct, JSON_PRETTY_PRINT));
$this->output->writeln('* <info>Public</info>: ' . ($details->isPublic() ? 'true' : 'false'));
$this->output->writeln('* <info>Federated</info>: ' . ($details->isFederated() ? 'true' : 'false'));
return 0;
}
}