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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-12-09 19:25:59 +0300
committerGitHub <noreply@github.com>2020-12-09 19:25:59 +0300
commita0444bc69cf1c2ffcb39616a2b258078737237bd (patch)
tree02ed41b19ac235c60af8de525c18749c39bd003a /apps
parent3749b706993107291321643aee0d874a9210a2d0 (diff)
parentb7326046c6395c50a6083b57f5f919882f5098b7 (diff)
Merge pull request #24247 from nextcloud/bugfix/noid/ocm-providerId-string
Diffstat (limited to 'apps')
-rw-r--r--apps/federatedfilesharing/composer/composer/autoload_classmap.php1
-rw-r--r--apps/federatedfilesharing/composer/composer/autoload_static.php1
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php8
-rw-r--r--apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php10
-rw-r--r--apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php71
-rw-r--r--apps/federatedfilesharing/lib/Notifications.php28
-rw-r--r--apps/files_sharing/appinfo/database.xml120
-rw-r--r--apps/files_sharing/composer/composer/autoload_classmap.php1
-rw-r--r--apps/files_sharing/composer/composer/autoload_static.php1
-rw-r--r--apps/files_sharing/lib/AppInfo/Application.php2
-rw-r--r--apps/files_sharing/lib/External/Manager.php8
-rw-r--r--apps/files_sharing/lib/Migration/Version11300Date20201120141438.php131
-rw-r--r--apps/files_sharing/tests/External/ManagerTest.php5
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php2
14 files changed, 239 insertions, 150 deletions
diff --git a/apps/federatedfilesharing/composer/composer/autoload_classmap.php b/apps/federatedfilesharing/composer/composer/autoload_classmap.php
index 1374c8b0eec..c4d891d9c24 100644
--- a/apps/federatedfilesharing/composer/composer/autoload_classmap.php
+++ b/apps/federatedfilesharing/composer/composer/autoload_classmap.php
@@ -16,6 +16,7 @@ return array(
'OCA\\FederatedFileSharing\\FederatedShareProvider' => $baseDir . '/../lib/FederatedShareProvider.php',
'OCA\\FederatedFileSharing\\Listeners\\LoadAdditionalScriptsListener' => $baseDir . '/../lib/Listeners/LoadAdditionalScriptsListener.php',
'OCA\\FederatedFileSharing\\Migration\\Version1010Date20200630191755' => $baseDir . '/../lib/Migration/Version1010Date20200630191755.php',
+ 'OCA\\FederatedFileSharing\\Migration\\Version1011Date20201120125158' => $baseDir . '/../lib/Migration/Version1011Date20201120125158.php',
'OCA\\FederatedFileSharing\\Notifications' => $baseDir . '/../lib/Notifications.php',
'OCA\\FederatedFileSharing\\Notifier' => $baseDir . '/../lib/Notifier.php',
'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => $baseDir . '/../lib/OCM/CloudFederationProviderFiles.php',
diff --git a/apps/federatedfilesharing/composer/composer/autoload_static.php b/apps/federatedfilesharing/composer/composer/autoload_static.php
index 52c7e01c9e8..25e8c027d9d 100644
--- a/apps/federatedfilesharing/composer/composer/autoload_static.php
+++ b/apps/federatedfilesharing/composer/composer/autoload_static.php
@@ -31,6 +31,7 @@ class ComposerStaticInitFederatedFileSharing
'OCA\\FederatedFileSharing\\FederatedShareProvider' => __DIR__ . '/..' . '/../lib/FederatedShareProvider.php',
'OCA\\FederatedFileSharing\\Listeners\\LoadAdditionalScriptsListener' => __DIR__ . '/..' . '/../lib/Listeners/LoadAdditionalScriptsListener.php',
'OCA\\FederatedFileSharing\\Migration\\Version1010Date20200630191755' => __DIR__ . '/..' . '/../lib/Migration/Version1010Date20200630191755.php',
+ 'OCA\\FederatedFileSharing\\Migration\\Version1011Date20201120125158' => __DIR__ . '/..' . '/../lib/Migration/Version1011Date20201120125158.php',
'OCA\\FederatedFileSharing\\Notifications' => __DIR__ . '/..' . '/../lib/Notifications.php',
'OCA\\FederatedFileSharing\\Notifier' => __DIR__ . '/..' . '/../lib/Notifier.php',
'OCA\\FederatedFileSharing\\OCM\\CloudFederationProviderFiles' => __DIR__ . '/..' . '/../lib/OCM/CloudFederationProviderFiles.php',
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index 395d34cc7e5..0dc344ec9cf 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -462,7 +462,7 @@ class FederatedShareProvider implements IShareProvider {
* @param $shareId
* @param $remoteId
*/
- public function storeRemoteId($shareId, $remoteId) {
+ public function storeRemoteId(int $shareId, string $remoteId): void {
$query = $this->dbConnection->getQueryBuilder();
$query->insert('federated_reshares')
->values(
@@ -478,10 +478,10 @@ class FederatedShareProvider implements IShareProvider {
* get share ID on remote server for federated re-shares
*
* @param IShare $share
- * @return int
+ * @return string
* @throws ShareNotFound
*/
- public function getRemoteId(IShare $share) {
+ public function getRemoteId(IShare $share): string {
$query = $this->dbConnection->getQueryBuilder();
$query->select('remote_id')->from('federated_reshares')
->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId())));
@@ -493,7 +493,7 @@ class FederatedShareProvider implements IShareProvider {
throw new ShareNotFound();
}
- return (int)$data['remote_id'];
+ return (string)$data['remote_id'];
}
/**
diff --git a/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php b/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php
index bf0d0f8eecd..afd41c20f64 100644
--- a/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php
+++ b/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php
@@ -44,13 +44,13 @@ class Version1010Date20200630191755 extends SimpleMigrationStep {
if (!$schema->hasTable('federated_reshares')) {
$table = $schema->createTable('federated_reshares');
- $table->addColumn('share_id', Types::INTEGER, [
+ $table->addColumn('share_id', Types::BIGINT, [
'notnull' => true,
- 'length' => 4,
]);
- $table->addColumn('remote_id', Types::INTEGER, [
- 'notnull' => true,
- 'length' => 4,
+ $table->addColumn('remote_id', Types::STRING, [
+ 'notnull' => false,
+ 'length' => 255,
+ 'default' => '',
]);
$table->setPrimaryKey(['share_id'], 'federated_res_pk');
// $table->addUniqueIndex(['share_id'], 'share_id_index');
diff --git a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php
new file mode 100644
index 00000000000..e89838c06f4
--- /dev/null
+++ b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php
@@ -0,0 +1,71 @@
+<?php
+/*
+ * @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
+ *
+ * @author Julius Härtl <jus@bitgrid.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+declare(strict_types=1);
+
+namespace OCA\FederatedFileSharing\Migration;
+
+use Closure;
+use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Types\Types;
+use OCP\DB\ISchemaWrapper;
+use OCP\IDBConnection;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+class Version1011Date20201120125158 extends SimpleMigrationStep {
+
+ /** @var IDBConnection */
+ private $connection;
+
+ public function __construct(IDBConnection $connection) {
+ $this->connection = $connection;
+ }
+
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ if ($schema->hasTable('federated_reshares')) {
+ $table = $schema->getTable('federated_reshares');
+ $remoteIdColumn = $table->getColumn('remote_id');
+ if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Types::STRING) {
+ $remoteIdColumn->setNotnull(false);
+ $remoteIdColumn->setType(Type::getType(Types::STRING));
+ $remoteIdColumn->setOptions(['length' => 255]);
+ $remoteIdColumn->setDefault('');
+ return $schema;
+ }
+ }
+
+ return null;
+ }
+
+ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
+ $qb = $this->connection->getQueryBuilder();
+ $qb->update('federated_reshares')
+ ->set('remote_id', $qb->createNamedParameter(''))
+ ->where($qb->expr()->eq('remote_id', $qb->createNamedParameter('-1')));
+ $qb->execute();
+ }
+}
diff --git a/apps/federatedfilesharing/lib/Notifications.php b/apps/federatedfilesharing/lib/Notifications.php
index 3dfb5de7230..c683c8de8b3 100644
--- a/apps/federatedfilesharing/lib/Notifications.php
+++ b/apps/federatedfilesharing/lib/Notifications.php
@@ -83,7 +83,7 @@ class Notifications {
* @param string $token
* @param string $shareWith
* @param string $name
- * @param int $remote_id
+ * @param string $remoteId
* @param string $owner
* @param string $ownerFederatedId
* @param string $sharedBy
@@ -93,7 +93,7 @@ class Notifications {
* @throws \OC\HintException
* @throws \OC\ServerNotAvailableException
*/
- public function sendRemoteShare($token, $shareWith, $name, $remote_id, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId, $shareType) {
+ public function sendRemoteShare($token, $shareWith, $name, $remoteId, $owner, $ownerFederatedId, $sharedBy, $sharedByFederatedId, $shareType) {
list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith);
if ($user && $remote) {
@@ -103,7 +103,7 @@ class Notifications {
'shareWith' => $user,
'token' => $token,
'name' => $name,
- 'remoteId' => $remote_id,
+ 'remoteId' => $remoteId,
'owner' => $owner,
'ownerFederatedId' => $ownerFederatedId,
'sharedBy' => $sharedBy,
@@ -132,13 +132,13 @@ class Notifications {
* ask owner to re-share the file with the given user
*
* @param string $token
- * @param int $id remote Id
- * @param int $shareId internal share Id
+ * @param string $id remote Id
+ * @param string $shareId internal share Id
* @param string $remote remote address of the owner
* @param string $shareWith
* @param int $permission
* @param string $filename
- * @return bool
+ * @return array|false
* @throws \OC\HintException
* @throws \OC\ServerNotAvailableException
*/
@@ -151,7 +151,7 @@ class Notifications {
];
$ocmFields = $fields;
- $ocmFields['remoteId'] = $id;
+ $ocmFields['remoteId'] = (string)$id;
$ocmFields['localId'] = $shareId;
$ocmFields['name'] = $filename;
@@ -171,7 +171,7 @@ class Notifications {
if ($httpRequestSuccessful && $ocsCallSuccessful && $validToken && $validRemoteId) {
return [
$status['ocs']['data']['token'],
- (int)$status['ocs']['data']['remoteId']
+ $status['ocs']['data']['remoteId']
];
}
@@ -182,7 +182,7 @@ class Notifications {
* send server-to-server unshare to remote server
*
* @param string $remote url
- * @param int $id share id
+ * @param string $id share id
* @param string $token
* @return bool
*/
@@ -194,7 +194,7 @@ class Notifications {
* send server-to-server unshare to remote server
*
* @param string $remote url
- * @param int $id share id
+ * @param string $id share id
* @param string $token
* @return bool
*/
@@ -206,7 +206,7 @@ class Notifications {
* send notification to remote server if the permissions was changed
*
* @param string $remote
- * @param int $remoteId
+ * @param string $remoteId
* @param string $token
* @param int $permissions
* @return bool
@@ -219,7 +219,7 @@ class Notifications {
* forward accept reShare to remote server
*
* @param string $remote
- * @param int $remoteId
+ * @param string $remoteId
* @param string $token
*/
public function sendAcceptShare($remote, $remoteId, $token) {
@@ -230,7 +230,7 @@ class Notifications {
* forward decline reShare to remote server
*
* @param string $remote
- * @param int $remoteId
+ * @param string $remoteId
* @param string $token
*/
public function sendDeclineShare($remote, $remoteId, $token) {
@@ -242,7 +242,7 @@ class Notifications {
*
* @param string $remote
* @param string $token
- * @param int $remoteId Share id on the remote host
+ * @param string $remoteId Share id on the remote host
* @param string $action possible actions: accept, decline, unshare, revoke, permissions
* @param array $data
* @param int $try
diff --git a/apps/files_sharing/appinfo/database.xml b/apps/files_sharing/appinfo/database.xml
deleted file mode 100644
index c3cfb9e1c88..00000000000
--- a/apps/files_sharing/appinfo/database.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<database>
- <name>*dbname*</name>
- <create>true</create>
- <overwrite>false</overwrite>
- <charset>utf8</charset>
- <table>
- <name>*dbprefix*share_external</name>
- <declaration>
- <field>
- <name>id</name>
- <type>integer</type>
- <default>0</default>
- <notnull>true</notnull>
- <autoincrement>1</autoincrement>
- <length>4</length>
- </field>
- <field>
- <name>parent</name>
- <type>integer</type>
- <default>-1</default>
- <length>4</length>
- </field>
- <field>
- <name>share_type</name>
- <type>integer</type>
- <length>4</length>
- </field>
- <field>
- <name>remote</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>512</length>
- <comments>Url of the remove owncloud instance</comments>
- </field>
- <field>
- <name>remote_id</name>
- <type>integer</type>
- <default>-1</default>
- <notnull>true</notnull>
- <length>4</length>
- </field>
- <field>
- <name>share_token</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>64</length>
- <comments>Public share token</comments>
- </field>
- <field>
- <name>password</name>
- <type>text</type>
- <notnull>false</notnull>
- <length>64</length>
- <comments>Optional password for the public share</comments>
- </field>
- <field>
- <name>name</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>64</length>
- <comments>Original name on the remote server</comments>
- </field>
- <field>
- <name>owner</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>64</length>
- <comments>User that owns the public share on the remote server</comments>
- </field>
- <field>
- <name>user</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>64</length>
- <comments>Local user which added the external share</comments>
- </field>
- <field>
- <name>mountpoint</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>4000</length>
- <comments>Full path where the share is mounted</comments>
- </field>
- <field>
- <name>mountpoint_hash</name>
- <type>text</type>
- <notnull>true</notnull>
- <length>32</length>
- <comments>md5 hash of the mountpoint</comments>
- </field>
- <field>
- <name>accepted</name>
- <type>integer</type>
- <default>0</default>
- <notnull>true</notnull>
- <length>4</length>
- </field>
- <index>
- <name>sh_external_user</name>
- <field>
- <name>user</name>
- <sorting>ascending</sorting>
- </field>
- </index>
- <index>
- <name>sh_external_mp</name>
- <unique>true</unique>
- <field>
- <name>user</name>
- <sorting>ascending</sorting>
- </field>
- <field>
- <name>mountpoint_hash</name>
- <sorting>ascending</sorting>
- </field>
- </index>
- </declaration>
- </table>
-</database>
diff --git a/apps/files_sharing/composer/composer/autoload_classmap.php b/apps/files_sharing/composer/composer/autoload_classmap.php
index f15f52d1840..887e77ef470 100644
--- a/apps/files_sharing/composer/composer/autoload_classmap.php
+++ b/apps/files_sharing/composer/composer/autoload_classmap.php
@@ -63,6 +63,7 @@ return array(
'OCA\\Files_Sharing\\Migration\\OwncloudGuestShareType' => $baseDir . '/../lib/Migration/OwncloudGuestShareType.php',
'OCA\\Files_Sharing\\Migration\\SetAcceptedStatus' => $baseDir . '/../lib/Migration/SetAcceptedStatus.php',
'OCA\\Files_Sharing\\Migration\\SetPasswordColumn' => $baseDir . '/../lib/Migration/SetPasswordColumn.php',
+ 'OCA\\Files_Sharing\\Migration\\Version11300Date20201120141438' => $baseDir . '/../lib/Migration/Version11300Date20201120141438.php',
'OCA\\Files_Sharing\\MountProvider' => $baseDir . '/../lib/MountProvider.php',
'OCA\\Files_Sharing\\Notification\\Listener' => $baseDir . '/../lib/Notification/Listener.php',
'OCA\\Files_Sharing\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
diff --git a/apps/files_sharing/composer/composer/autoload_static.php b/apps/files_sharing/composer/composer/autoload_static.php
index 4d524565507..a3499b4125c 100644
--- a/apps/files_sharing/composer/composer/autoload_static.php
+++ b/apps/files_sharing/composer/composer/autoload_static.php
@@ -78,6 +78,7 @@ class ComposerStaticInitFiles_Sharing
'OCA\\Files_Sharing\\Migration\\OwncloudGuestShareType' => __DIR__ . '/..' . '/../lib/Migration/OwncloudGuestShareType.php',
'OCA\\Files_Sharing\\Migration\\SetAcceptedStatus' => __DIR__ . '/..' . '/../lib/Migration/SetAcceptedStatus.php',
'OCA\\Files_Sharing\\Migration\\SetPasswordColumn' => __DIR__ . '/..' . '/../lib/Migration/SetPasswordColumn.php',
+ 'OCA\\Files_Sharing\\Migration\\Version11300Date20201120141438' => __DIR__ . '/..' . '/../lib/Migration/Version11300Date20201120141438.php',
'OCA\\Files_Sharing\\MountProvider' => __DIR__ . '/..' . '/../lib/MountProvider.php',
'OCA\\Files_Sharing\\Notification\\Listener' => __DIR__ . '/..' . '/../lib/Notification/Listener.php',
'OCA\\Files_Sharing\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php
index fd71f58f121..078a0a5f59d 100644
--- a/apps/files_sharing/lib/AppInfo/Application.php
+++ b/apps/files_sharing/lib/AppInfo/Application.php
@@ -168,7 +168,7 @@ class Application extends App {
protected function setupSharingMenus() {
$config = \OC::$server->getConfig();
- if ($config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
+ if ($config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes' || !class_exists('\OCA\Files\App')) {
return;
}
diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php
index 87146dd4268..d02ac97ba39 100644
--- a/apps/files_sharing/lib/External/Manager.php
+++ b/apps/files_sharing/lib/External/Manager.php
@@ -126,12 +126,12 @@ class Manager {
* @param int $shareType
* @param boolean $accepted
* @param string $user
- * @param int $remoteId
+ * @param string $remoteId
* @param int $parent
* @return Mount|null
* @throws \Doctrine\DBAL\DBALException
*/
- public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = -1, $parent = -1) {
+ public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = '', $parent = -1) {
$user = $user ? $user : $this->uid;
$accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING;
$name = Filesystem::normalizePath('/' . $name);
@@ -347,7 +347,7 @@ class Manager {
*
* @param string $remote
* @param string $token
- * @param int $remoteId Share id on the remote host
+ * @param string $remoteId Share id on the remote host
* @param string $feedback
* @return boolean
*/
@@ -388,7 +388,7 @@ class Manager {
*
* @param string $remoteDomain
* @param string $token
- * @param $remoteId id of the share
+ * @param string $remoteId id of the share
* @param string $feedback
* @return bool
*/
diff --git a/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php
new file mode 100644
index 00000000000..dfc5bc68a07
--- /dev/null
+++ b/apps/files_sharing/lib/Migration/Version11300Date20201120141438.php
@@ -0,0 +1,131 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
+ *
+ * @author Julius Härtl <jus@bitgrid.net>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+namespace OCA\Files_Sharing\Migration;
+
+use Closure;
+use Doctrine\DBAL\Types\Type;
+use Doctrine\DBAL\Types\Types;
+use OCP\DB\ISchemaWrapper;
+use OCP\IDBConnection;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+class Version11300Date20201120141438 extends SimpleMigrationStep {
+
+ /** @var IDBConnection */
+ private $connection;
+
+ public function __construct(IDBConnection $connection) {
+ $this->connection = $connection;
+ }
+
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ if (!$schema->hasTable('share_external')) {
+ $table = $schema->createTable('share_external');
+ $table->addColumn('id', Types::BIGINT, [
+ 'autoincrement' => true,
+ 'notnull' => true,
+ ]);
+ $table->addColumn('parent', Types::BIGINT, [
+ 'notnull' => false,
+ 'default' => -1,
+ ]);
+ $table->addColumn('share_type', Types::INTEGER, [
+ 'notnull' => false,
+ 'length' => 4,
+ ]);
+ $table->addColumn('remote', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 512,
+ ]);
+ $table->addColumn('remote_id', Types::STRING, [
+ 'notnull' => false,
+ 'length' => 255,
+ 'default' => '',
+ ]);
+ $table->addColumn('share_token', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('password', Types::STRING, [
+ 'notnull' => false,
+ 'length' => 64,
+ ]);
+ $table->addColumn('name', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('owner', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('user', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 64,
+ ]);
+ $table->addColumn('mountpoint', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 4000,
+ ]);
+ $table->addColumn('mountpoint_hash', Types::STRING, [
+ 'notnull' => true,
+ 'length' => 32,
+ ]);
+ $table->addColumn('accepted', Types::INTEGER, [
+ 'notnull' => true,
+ 'length' => 4,
+ 'default' => 0,
+ ]);
+ $table->setPrimaryKey(['id']);
+ $table->addIndex(['user'], 'sh_external_user');
+ $table->addUniqueIndex(['user', 'mountpoint_hash'], 'sh_external_mp');
+ } else {
+ $table = $schema->getTable('share_external');
+ $remoteIdColumn = $table->getColumn('remote_id');
+ if ($remoteIdColumn && $remoteIdColumn->getType()->getName() !== Types::STRING) {
+ $remoteIdColumn->setNotnull(false);
+ $remoteIdColumn->setType(Type::getType(Types::STRING));
+ $remoteIdColumn->setOptions(['length' => 255]);
+ $remoteIdColumn->setDefault('');
+ }
+ }
+
+ return $schema;
+ }
+
+ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
+ $qb = $this->connection->getQueryBuilder();
+ $qb->update('share_external')
+ ->set('remote_id', $qb->createNamedParameter(''))
+ ->where($qb->expr()->eq('remote_id', $qb->createNamedParameter('-1')));
+ $qb->execute();
+ }
+}
diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php
index 22005c8fc6b..2734e3cce64 100644
--- a/apps/files_sharing/tests/External/ManagerTest.php
+++ b/apps/files_sharing/tests/External/ManagerTest.php
@@ -149,6 +149,7 @@ class ManagerTest extends TestCase {
'shareType' => IShare::TYPE_USER,
'accepted' => false,
'user' => $this->uid,
+ 'remote_id' => '2342'
];
$shareData2 = $shareData1;
$shareData2['token'] = 'token2';
@@ -158,8 +159,8 @@ class ManagerTest extends TestCase {
$this->userManager->expects($this->any())->method('get')->willReturn($this->user);
$this->groupManager->expects($this->any())->method(('getUserGroups'))->willReturn([]);
- $this->manager->expects($this->at(0))->method('tryOCMEndPoint')->with('http://localhost', 'token1', -1, 'accept')->willReturn(false);
- $this->manager->expects($this->at(1))->method('tryOCMEndPoint')->with('http://localhost', 'token3', -1, 'decline')->willReturn(false);
+ $this->manager->expects($this->at(0))->method('tryOCMEndPoint')->with('http://localhost', 'token1', '2342', 'accept')->willReturn(false);
+ $this->manager->expects($this->at(1))->method('tryOCMEndPoint')->with('http://localhost', 'token3', '2342', 'decline')->willReturn(false);
// Add a share for "user"
$this->assertSame(null, call_user_func_array([$this->manager, 'addShare'], $shareData1));
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index 1ebeb41adfb..1312346b96c 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -627,12 +627,14 @@ Raw output
'activity_mq' => ['mail_id'],
'authtoken' => ['id'],
'bruteforce_attempts' => ['id'],
+ 'federated_reshares' => ['share_id'],
'filecache' => ['fileid', 'storage', 'parent', 'mimetype', 'mimepart', 'mtime', 'storage_mtime'],
'filecache_extended' => ['fileid'],
'file_locks' => ['id'],
'jobs' => ['id'],
'mimetypes' => ['id'],
'mounts' => ['id', 'storage_id', 'root_id', 'mount_id'],
+ 'share_external' => ['id', 'parent'],
'storages' => ['numeric_id'],
];