summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_sharing/appinfo/info.xml2
-rw-r--r--apps/files_sharing/appinfo/update.php2
-rw-r--r--apps/files_sharing/lib/migration.php6
-rw-r--r--apps/files_sharing/tests/migrationtest.php21
-rw-r--r--apps/files_versions/lib/storage.php21
-rw-r--r--apps/files_versions/tests/versions.php4
-rw-r--r--core/js/update.js16
-rw-r--r--lib/private/files/config/usermountcache.php2
8 files changed, 52 insertions, 22 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']);
diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php
index 35b3110928b..88a4126dabd 100644
--- a/apps/files_versions/lib/storage.php
+++ b/apps/files_versions/lib/storage.php
@@ -52,6 +52,10 @@ class Storage {
const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
const VERSIONS_ROOT = 'files_versions/';
+ const DELETE_TRIGGER_MASTER_REMOVED = 0;
+ const DELETE_TRIGGER_RETENTION_CONSTRAINT = 1;
+ const DELETE_TRIGGER_QUOTA_EXCEEDED = 2;
+
// files for which we can remove the versions after the delete operation was successful
private static $deletedFiles = array();
@@ -210,9 +214,9 @@ class Storage {
$versions = self::getVersions($uid, $filename);
if (!empty($versions)) {
foreach ($versions as $v) {
- \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $path . $v['version']));
+ \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED));
self::deleteVersion($view, $filename . '.v' . $v['version']);
- \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path . $v['version']));
+ \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED));
}
}
}
@@ -309,6 +313,7 @@ class Storage {
Storage::scheduleExpire($uid, $file);
\OC_Hook::emit('\OCP\Versions', 'rollback', array(
'path' => $filename,
+ 'revision' => $revision,
));
return true;
} else if ($versionCreated) {
@@ -444,9 +449,9 @@ class Storage {
$view = new \OC\Files\View('/' . $uid . '/files_versions');
if (!empty($toDelete)) {
foreach ($toDelete as $version) {
- \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version']));
+ \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT));
self::deleteVersion($view, $version['path'] . '.v' . $version['version']);
- \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version']));
+ \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT));
}
}
}
@@ -705,9 +710,9 @@ class Storage {
}
foreach($toDelete as $key => $path) {
- \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $path));
+ \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED));
self::deleteVersion($versionsFileview, $path);
- \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path));
+ \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED));
unset($allVersions[$key]); // update array with the versions we keep
\OCP\Util::writeLog('files_versions', "Expire: " . $path, \OCP\Util::DEBUG);
}
@@ -722,9 +727,9 @@ class Storage {
reset($allVersions);
while ($availableSpace < 0 && $i < $numOfVersions) {
$version = current($allVersions);
- \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version']));
+ \OC_Hook::emit('\OCP\Versions', 'preDelete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED));
self::deleteVersion($versionsFileview, $version['path'] . '.v' . $version['version']);
- \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version']));
+ \OC_Hook::emit('\OCP\Versions', 'delete', array('path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED));
\OCP\Util::writeLog('files_versions', 'running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'] , \OCP\Util::DEBUG);
$versionsSize -= $version['size'];
$availableSpace += $version['size'];
diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php
index b85877cebd3..d7d9c7a4fb4 100644
--- a/apps/files_versions/tests/versions.php
+++ b/apps/files_versions/tests/versions.php
@@ -652,7 +652,9 @@ class Test_Files_Versioning extends \Test\TestCase {
'path' => '/sub/test.txt',
);
- $this->assertEquals($expectedParams, $params);
+ $this->assertEquals($expectedParams['path'], $params['path']);
+ $this->assertTrue(array_key_exists('revision', $params));
+ $this->assertTrue($params['revision'] > 0);
$this->assertEquals('version2', $this->rootView->file_get_contents($filePath));
$info2 = $this->rootView->getFileInfo($filePath);
diff --git a/core/js/update.js b/core/js/update.js
index 1626b6f2c49..77ac1bb20ff 100644
--- a/core/js/update.js
+++ b/core/js/update.js
@@ -60,12 +60,16 @@
updateEventSource.listen('failure', function(message) {
$(window).off('beforeunload.inprogress');
$('<span>').addClass('error').append(message).append('<br />').appendTo($el);
- $('<span>')
- .addClass('bold')
- .append(t('core', 'The update was unsuccessful. ' +
- 'Please report this issue to the ' +
- '<a href="https://github.com/owncloud/core/issues" target="_blank">ownCloud community</a>.'))
- .appendTo($el);
+ var span = $('<span>')
+ .addClass('bold');
+ if(message === 'Exception: Updates between multiple major versions and downgrades are unsupported.') {
+ span.append(t('core', 'The update was unsuccessful. For more information <a href="{url}">check our forum post</a> covering this issue.', {'url': 'https://forum.owncloud.org/viewtopic.php?f=17&t=32087'}));
+ } else {
+ span.append(t('core', 'The update was unsuccessful. ' +
+ 'Please report this issue to the ' +
+ '<a href="https://github.com/owncloud/core/issues" target="_blank">ownCloud community</a>.'));
+ }
+ span.appendTo($el);
});
updateEventSource.listen('done', function() {
$(window).off('beforeunload.inprogress');
diff --git a/lib/private/files/config/usermountcache.php b/lib/private/files/config/usermountcache.php
index a2da3e9f528..35f40353190 100644
--- a/lib/private/files/config/usermountcache.php
+++ b/lib/private/files/config/usermountcache.php
@@ -129,7 +129,7 @@ class UserMountCache implements IUserMountCache {
'root_id' => $mount->getRootId(),
'user_id' => $mount->getUser()->getUID(),
'mount_point' => $mount->getMountPoint()
- ]);
+ ], ['root_id', 'user_id']);
}
private function setMountPoint(ICachedMountInfo $mount) {