Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-08-03 10:10:59 +0300
committerGitHub <noreply@github.com>2021-08-03 10:10:59 +0300
commitff79ce2387057bd94e2f52dd19fdd97a014dc08a (patch)
treefa08a4d95b803e929d541f589849d85e3eeadf05
parent96e915911ec6cc59f840475ebf50b7c47f7557db (diff)
parentc92a695a0744cce4cdd35fe78a4abd7b98301213 (diff)
Merge pull request #1797 from nextcloud/backport/1796/stable22v22.1.022.1.0
[stable22] Make occ command return an integer as return code
-rw-r--r--lib/Command/ResetDocument.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Command/ResetDocument.php b/lib/Command/ResetDocument.php
index 9d50a852a..6e972f08e 100644
--- a/lib/Command/ResetDocument.php
+++ b/lib/Command/ResetDocument.php
@@ -47,7 +47,7 @@ class ResetDocument extends Command {
$this->sessionMapper = $sessionMapper;
}
- protected function configure() {
+ protected function configure(): void {
$this
->setName('text:reset')
->setDescription('Reset a text document')
@@ -68,15 +68,17 @@ class ResetDocument extends Command {
/**
* @param InputInterface $input
* @param OutputInterface $output
- * @return void
+ * @return int
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$fileId = $input->getArgument('file-id');
$fullReset = $input->getOption('full');
if ($fullReset) {
$output->writeln('Full document reset');
$this->documentService->resetDocument($fileId, true);
+
+ return 0;
} else {
$output->writeln('Trying to restore to last saved version');
$document = $this->documentMapper->find($fileId);
@@ -86,9 +88,13 @@ class ResetDocument extends Command {
$this->documentMapper->update($document);
$this->sessionMapper->deleteByDocumentId($fileId);
$output->writeln('Reverted document to the last saved version');
+
+ return 0;
} else {
$output->writeln('Failed revert changes that are newer than the last saved version');
}
+
+ return 1;
}
}
}