Update the migration step to include federated shares
Now federated shares will also be updated to the flat reshare model.
This commit is contained in:
parent
97b2e19c78
commit
3c4e511792
4 changed files with 25 additions and 6 deletions
|
@ -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>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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']);
|
||||
|
|
Loading…
Reference in a new issue