diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-08 15:11:48 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-08 15:11:48 +0100 |
commit | 3c4e51179242b4a8cfe741034cdd4d0f1e21229f (patch) | |
tree | dd4dd7bd2d45952974751c468ff99624c508ce99 | |
parent | 97b2e19c786e037acd99e31aabbf193c805617dd (diff) | |
download | nextcloud-server-3c4e51179242b4a8cfe741034cdd4d0f1e21229f.tar.gz nextcloud-server-3c4e51179242b4a8cfe741034cdd4d0f1e21229f.zip |
Update the migration step to include federated shares
Now federated shares will also be updated to the flat
reshare model.
-rw-r--r-- | apps/files_sharing/appinfo/info.xml | 2 | ||||
-rw-r--r-- | apps/files_sharing/appinfo/update.php | 2 | ||||
-rw-r--r-- | apps/files_sharing/lib/migration.php | 6 | ||||
-rw-r--r-- | apps/files_sharing/tests/migrationtest.php | 21 |
4 files changed, 25 insertions, 6 deletions
diff --git a/apps/files_sharing/appinfo/info.xml b/apps/files_sharing/appinfo/info.xml index 17826be47b4..29ae15e4722 100644 --- a/apps/files_sharing/appinfo/info.xml +++ b/apps/files_sharing/appinfo/info.xml @@ -10,7 +10,7 @@ Turning the feature off removes shared files and folders on the server for all s <licence>AGPL</licence> <author>Michael Gapczynski, Bjoern Schiessle</author> <default_enable/> - <version>0.9.0</version> + <version>0.9.1</version> <types> <filesystem/> </types> diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php index d754a95705c..ced227a107b 100644 --- a/apps/files_sharing/appinfo/update.php +++ b/apps/files_sharing/appinfo/update.php @@ -25,7 +25,7 @@ use OCA\Files_Sharing\Migration; $installedVersion = \OC::$server->getConfig()->getAppValue('files_sharing', 'installed_version'); // Migration OC8.2 -> OC9 -if (version_compare($installedVersion, '0.9.0', '<')) { +if (version_compare($installedVersion, '0.9.1', '<')) { $m = new Migration(\OC::$server->getDatabaseConnection()); $m->removeReShares(); $m->updateInitiatorInfo(); diff --git a/apps/files_sharing/lib/migration.php b/apps/files_sharing/lib/migration.php index 90e0dead480..e7346385510 100644 --- a/apps/files_sharing/lib/migration.php +++ b/apps/files_sharing/lib/migration.php @@ -142,7 +142,8 @@ class Migration { [ \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_GROUP, - \OCP\Share::SHARE_TYPE_LINK + \OCP\Share::SHARE_TYPE_LINK, + \OCP\Share::SHARE_TYPE_REMOTE, ], Connection::PARAM_INT_ARRAY ) @@ -185,7 +186,8 @@ class Migration { [ \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_GROUP, - \OCP\Share::SHARE_TYPE_LINK + \OCP\Share::SHARE_TYPE_LINK, + \OCP\Share::SHARE_TYPE_REMOTE, ], Connection::PARAM_INT_ARRAY ) diff --git a/apps/files_sharing/tests/migrationtest.php b/apps/files_sharing/tests/migrationtest.php index e1c047e0342..8a40b76a642 100644 --- a/apps/files_sharing/tests/migrationtest.php +++ b/apps/files_sharing/tests/migrationtest.php @@ -209,6 +209,23 @@ class MigrationTest extends TestCase { $this->assertSame(1, $query->execute() ); + $parent = $query->getLastInsertId(); + // third re-share, should be attached to the first user share after migration + $query->setParameter('share_type', \OCP\Share::SHARE_TYPE_REMOTE) + ->setParameter('share_with', 'user@server.com') + ->setParameter('uid_owner', 'user3') + ->setParameter('uid_initiator', '') + ->setParameter('parent', $parent) + ->setParameter('item_type', 'file') + ->setParameter('item_source', '2') + ->setParameter('item_target', '/2') + ->setParameter('file_source', 2) + ->setParameter('file_target', '/foobar') + ->setParameter('permissions', 31) + ->setParameter('stime', time()); + $this->assertSame(1, + $query->execute() + ); } public function testRemoveReShares() { @@ -221,7 +238,7 @@ class MigrationTest extends TestCase { $query = $this->connection->getQueryBuilder(); $query->select('*')->from($this->table)->orderBy('id'); $result = $query->execute()->fetchAll(); - $this->assertSame(8, count($result)); + $this->assertSame(9, count($result)); // shares which shouldn't be modified for ($i = 0; $i < 4; $i++) { @@ -238,7 +255,7 @@ class MigrationTest extends TestCase { $this->assertEmpty($result[5]['uid_initiator']); $this->assertNull($result[5]['parent']); // flatted re-shares - for($i = 6; $i < 8; $i++) { + for($i = 6; $i < 9; $i++) { $this->assertSame('owner2', $result[$i]['uid_owner']); $user = 'user' . ($i - 5); $this->assertSame($user, $result[$i]['uid_initiator']); |