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
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-12-03 19:39:56 +0300
committerJulius Härtl <jus@bitgrid.net>2020-12-08 18:06:10 +0300
commitaefe8262023f5f3daaa33a33e6b31c8e12e33112 (patch)
treeb5a2ac75fcf2c63eb8e569009af36fabfff19359 /apps/federatedfilesharing/lib
parent98deb1bd071f9de1d307fd83f7fd8c11f5e426a6 (diff)
Adjust default
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/federatedfilesharing/lib')
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php2
-rw-r--r--apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php3
-rw-r--r--apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php18
-rw-r--r--apps/federatedfilesharing/lib/Notifications.php8
4 files changed, 25 insertions, 6 deletions
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index ffd76784bc3..0dc344ec9cf 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -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 7376c8d9e73..afd41c20f64 100644
--- a/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php
+++ b/apps/federatedfilesharing/lib/Migration/Version1010Date20200630191755.php
@@ -48,8 +48,9 @@ class Version1010Date20200630191755 extends SimpleMigrationStep {
'notnull' => true,
]);
$table->addColumn('remote_id', Types::STRING, [
- 'notnull' => true,
+ '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
index 1f32f2cced2..e89838c06f4 100644
--- a/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php
+++ b/apps/federatedfilesharing/lib/Migration/Version1011Date20201120125158.php
@@ -29,10 +29,19 @@ 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();
@@ -41,6 +50,7 @@ class Version1011Date20201120125158 extends SimpleMigrationStep {
$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('');
@@ -50,4 +60,12 @@ class Version1011Date20201120125158 extends SimpleMigrationStep {
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 63acc648d51..c683c8de8b3 100644
--- a/apps/federatedfilesharing/lib/Notifications.php
+++ b/apps/federatedfilesharing/lib/Notifications.php
@@ -133,12 +133,12 @@ class Notifications {
*
* @param string $token
* @param string $id remote Id
- * @param int $shareId internal share 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 array
+ * @return array|false
* @throws \OC\HintException
* @throws \OC\ServerNotAvailableException
*/
@@ -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
*/