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

github.com/nextcloud/documentserver_community.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-04-28 18:31:59 +0300
committerGitHub <noreply@github.com>2020-04-28 18:31:59 +0300
commit660b286c151fa6b7dc6b70cd938cc6f701a34889 (patch)
tree765379c72ef03c5f7236ca147dd3e342aa7e94f5
parent444e96b8a757ea99aca1b36bb3bf45aec1e4549a (diff)
parent63628ab1395c6d59ddcd31442fedec9cdbac1e9e (diff)
Merge pull request #113 from joequant/dev/flush-inactive-pages
add option to flush inactive pages / trap exceptions
-rw-r--r--lib/Command/FlushChanges.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/Command/FlushChanges.php b/lib/Command/FlushChanges.php
index 13a79d1..4483afe 100644
--- a/lib/Command/FlushChanges.php
+++ b/lib/Command/FlushChanges.php
@@ -25,6 +25,7 @@ use OC\Core\Command\Base;
use OCA\DocumentServer\Document\DocumentStore;
use OCA\DocumentServer\Document\SaveHandler;
use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class FlushChanges extends Base {
@@ -44,14 +45,27 @@ class FlushChanges extends Base {
protected function configure() {
$this
->setName('documentserver:flush')
- ->setDescription('Flush all pending changes made to documents');
+ ->setDescription('Flush all pending changes made to documents')
+ ->addOption(
+ 'inactive-pages',
+ null,
+ InputOption::VALUE_NONE,
+ 'Flush only inactive pages'
+ );
parent::configure();
}
protected function execute(InputInterface $input, OutputInterface $output) {
$documents = $this->documentStore->getOpenDocuments();
foreach ($documents as $documentId) {
- $this->saveHandler->flushChanges($documentId);
- }
+ if (!$input->getOption('inactive-pages') ||
+ !$this->sessionManager->isDocumentActive($documentId)) {
+ try {
+ $this->saveHandler->flushChanges($documentId);
+ } catch (\Exception $e) {
+ $this->logger->logException($e, ['app' => 'documentserver_community', 'message' => 'Error while applying changes for document ' . $documentId]);
+ }
+ }
+ }
}
}