From 2b302fa1af99ccc05c38c9b29f57570e3a52fac2 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Thu, 31 Mar 2016 16:24:16 +0200 Subject: [PATCH] local file access method is deprecated by WOPI --- appinfo/routes.php | 4 -- controller/documentcontroller.php | 95 ------------------------------- owncloud-collabora-online.spec.in | 7 --- 3 files changed, 106 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index 91044804..408bf0c9 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -32,10 +32,6 @@ $application->registerRoutes($this, [ ['name' => 'document#rename', 'url' => 'ajax/documents/rename/{fileId}', 'verb' => 'POST'], ['name' => 'document#listAll', 'url' => 'ajax/documents/list', 'verb' => 'GET'], ['name' => 'document#download', 'url' => 'ajax/download.php', 'verb' => 'GET'], - //documents - for CloudSuite access - ['name' => 'document#localLoad', 'url' => 'load/{fileId}', 'verb' => 'POST'], - ['name' => 'document#localSave', 'url' => 'save/{fileId}', 'verb' => 'POST'], - ['name' => 'document#localClose', 'url' => 'close/{fileId}', 'verb' => 'POST'], //documents - for WOPI access ['name' => 'document#wopiGetToken', 'url' => 'wopi/token/{fileId}', 'verb' => 'GET'], ['name' => 'document#wopiCheckFileInfo', 'url' => 'wopi/files/{fileId}', 'verb' => 'GET'], diff --git a/controller/documentcontroller.php b/controller/documentcontroller.php index 0758f511..8353cc41 100644 --- a/controller/documentcontroller.php +++ b/controller/documentcontroller.php @@ -39,7 +39,6 @@ class DocumentController extends Controller{ private $logger; const ODT_TEMPLATE_PATH = '/assets/odttemplate.odt'; - const CLOUDSUITE_TMP_PATH = '/documents-tmp/'; public function __construct($appName, IRequest $request, IConfig $settings, IL10N $l10n, $uid, ICacheFactory $cache, ILogger $logger){ parent::__construct($appName, $request); @@ -206,100 +205,6 @@ class DocumentController extends Controller{ return $response; } - /** - * @NoAdminRequired - * @PublicPage - * Copy the file to a temporary location that is shared between the - * cloudsuite server part and owncloud. - */ - public function localLoad($fileId){ - $view = \OC\Files\Filesystem::getView(); - $path = $view->getPath($fileId); - - if (!$view->is_file($path)) { - return array( - 'status' => 'error', - 'message' => (string) $this->l10n->t('Unable to copy document for CloudSuite access.') - ); - } - - $filename = dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH . 'ccs-' . $fileId; - if (file_exists($filename)) { - return array( - 'status' => 'success', 'filename' => $filename, - 'basename' => basename($filename) - ); - } - - $content = $view->file_get_contents($path); - - file_put_contents($filename, $content); - - // set the needed attribs - chmod($filename, 0660); - $modified = $view->filemtime($path); - if ($modified !== false) - touch($filename, $modified); - - return array( - 'status' => 'success', 'filename' => $filename, - 'basename' => basename($filename) - ); - } - - /** - * @NoAdminRequired - * @PublicPage - * Copy the file to a temporary location that is shared between the - * cloudsuite server part and owncloud. - */ - public function localSave($fileId){ - // get really just the basename for the case somebody tries to trick us - $basename = basename($this->request->post['basename']); - - $filename = dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH . $basename; - - $view = \OC\Files\Filesystem::getView(); - $path = $view->getPath($fileId); - - if (!is_file($filename) || !$view->is_file($path)) { - return array( - 'status' => 'error', - 'message' => (string) $this->l10n->t('Unable to copy the document back from CloudSuite.') - ); - } - - $content = file_get_contents($filename); - - $view->file_put_contents($path, $content); - - return array( - 'status' => 'success' - ); - } - - /** - * @NoAdminRequired - * @PublicPage - * Remove the temporary local copy of the document. - */ - public function localClose($fileId){ - // get really just the basename for the case somebody tries to trick us - $basename = basename($this->request->post['basename']); - - $filename = dirname(__DIR__) . self::CLOUDSUITE_TMP_PATH . $basename; - - // remove temp file only when all edit instances are closed - $stat = stat($filename); - if ($stat['nlink'] == 1){ - unlink($filename); - } - - return array( - 'status' => 'success' - ); - } - /** * @NoAdminRequired * Generates and returns an access token for a given fileId. diff --git a/owncloud-collabora-online.spec.in b/owncloud-collabora-online.spec.in index 27ce5700..a7c87861 100644 --- a/owncloud-collabora-online.spec.in +++ b/owncloud-collabora-online.spec.in @@ -47,13 +47,6 @@ tar cf - . | (cd %{buildroot}/srv/www/htdocs/owncloud/apps/richdocuments && tar chown -R wwwrun:www /srv/www/htdocs/owncloud/apps su -s /bin/bash -c "php /srv/www/htdocs/owncloud/occ app:enable richdocuments" wwwrun -getent group loolwww >/dev/null || groupadd -r loolwww -usermod -a -G loolwww wwwrun -usermod -a -G loolwww lool -mkdir -p /srv/www/htdocs/owncloud/apps/richdocuments/documents-tmp -chown wwwrun:loolwww /srv/www/htdocs/owncloud/apps/richdocuments/documents-tmp -chmod g+ws /srv/www/htdocs/owncloud/apps/richdocuments/documents-tmp -chmod o-rwx /srv/www/htdocs/owncloud/apps/richdocuments/documents-tmp systemctl restart apache2.service %changelog