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:
authorJoseph C Wang <joequant@gmail.com>2020-04-08 06:04:13 +0300
committerJoseph C Wang <joequant@gmail.com>2020-04-08 06:13:46 +0300
commit63628ab1395c6d59ddcd31442fedec9cdbac1e9e (patch)
tree2675a35ad3fe67041c90cf5d4a57c77edb9e5c53
parentd6a76d2ceae02f3c2cee087971147ee14e4ba0ef (diff)
add option to flush inactive pages / trap exceptions
This patch adds the ability to flush only inactive pages. It also attempts to flush changes for following files if there is an exception in parsing one particular file. Intended to provide diagnostics for nextcloud/documentserver_community#100 Signed-off-by: Joseph C Wang <joequant@gmail.com>
-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]);
+ }
+ }
+ }
}
}