diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-12-03 17:39:56 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-12-08 16:06:10 +0100 |
commit | aefe8262023f5f3daaa33a33e6b31c8e12e33112 (patch) | |
tree | b5a2ac75fcf2c63eb8e569009af36fabfff19359 /apps/federatedfilesharing/lib | |
parent | 98deb1bd071f9de1d307fd83f7fd8c11f5e426a6 (diff) | |
download | nextcloud-server-aefe8262023f5f3daaa33a33e6b31c8e12e33112.tar.gz nextcloud-server-aefe8262023f5f3daaa33a33e6b31c8e12e33112.zip |
Adjust default
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/federatedfilesharing/lib')
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 */ |