summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-07-07 11:29:46 +0200
committerMorris Jobke <hey@morrisjobke.de>2016-07-07 11:29:46 +0200
commitba16fd0d337fa26114f55086198979d147a298c1 (patch)
tree39111cec77d17d5eeb60bd1b609e7a8419310459 /apps/files_versions
parent5ace43f43895cba4b398367e10731f92450d7da2 (diff)
parented28885d73181e61c06802639910014e8a265e42 (diff)
downloadnextcloud-server-ba16fd0d337fa26114f55086198979d147a298c1.tar.gz
nextcloud-server-ba16fd0d337fa26114f55086198979d147a298c1.zip
Merge branch 'master' into sync-master
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/appinfo/info.xml4
-rw-r--r--apps/files_versions/l10n/de.js2
-rw-r--r--apps/files_versions/l10n/de.json2
-rw-r--r--apps/files_versions/lib/Storage.php20
4 files changed, 16 insertions, 12 deletions
diff --git a/apps/files_versions/appinfo/info.xml b/apps/files_versions/appinfo/info.xml
index 03aa308bdb1..fb91edae0b3 100644
--- a/apps/files_versions/appinfo/info.xml
+++ b/apps/files_versions/appinfo/info.xml
@@ -5,8 +5,8 @@
<licence>AGPL</licence>
<author>Frank Karlitschek, Bjoern Schiessle</author>
<description>
- This application enables ownCloud to automatically maintain older versions of files that are changed. When enabled, a hidden versions folder is provisioned in every user’s directory and is used to store old file versions. A user can revert to an older version through the web interface at any time, with the replaced file becoming a version. ownCloud then automatically manages the versions folder to ensure the user doesn’t run out of Quota because of versions.
-In addition to the expiry of versions, ownCloud’s versions app makes certain never to use more than 50% of the user’s currently available free space. If stored versions exceed this limit, ownCloud will delete the oldest versions first until it meets this limit. More information is available in the Versions documentation.
+ This application automatically maintains older versions of files that are changed. When enabled, a hidden versions folder is provisioned in every user’s directory and is used to store old file versions. A user can revert to an older version through the web interface at any time, with the replaced file becoming a version. The app automatically manages the versions folder to ensure the user doesn’t run out of Quota because of versions.
+In addition to the expiry of versions, the versions app makes certain never to use more than 50% of the user’s currently available free space. If stored versions exceed this limit, the app will delete the oldest versions first until it meets this limit. More information is available in the Versions documentation.
</description>
<version>1.3.0</version>
diff --git a/apps/files_versions/l10n/de.js b/apps/files_versions/l10n/de.js
index 285e42517b3..d49a168a029 100644
--- a/apps/files_versions/l10n/de.js
+++ b/apps/files_versions/l10n/de.js
@@ -1,7 +1,7 @@
OC.L10N.register(
"files_versions",
{
- "Could not revert: %s" : "Konnte %s nicht zurücksetzen",
+ "Could not revert: %s" : "%s konnte nicht zurückgesetzt werden",
"Versions" : "Versionen",
"Failed to revert {file} to revision {timestamp}." : "Konnte {file} der Revision {timestamp} nicht rückgängig machen.",
"Restore" : "Wiederherstellen",
diff --git a/apps/files_versions/l10n/de.json b/apps/files_versions/l10n/de.json
index a1f3c12649f..8eff3bf1868 100644
--- a/apps/files_versions/l10n/de.json
+++ b/apps/files_versions/l10n/de.json
@@ -1,5 +1,5 @@
{ "translations": {
- "Could not revert: %s" : "Konnte %s nicht zurücksetzen",
+ "Could not revert: %s" : "%s konnte nicht zurückgesetzt werden",
"Versions" : "Versionen",
"Failed to revert {file} to revision {timestamp}." : "Konnte {file} der Revision {timestamp} nicht rückgängig machen.",
"Restore" : "Wiederherstellen",
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index 5857b064699..cd4830d5469 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -77,7 +77,7 @@ class Storage {
//until the end one version per week
6 => array('intervalEndsAfter' => -1, 'step' => 604800),
);
-
+
/** @var \OCA\Files_Versions\AppInfo\Application */
private static $application;
@@ -313,6 +313,7 @@ class Storage {
*
* @param string $file file name
* @param int $revision revision timestamp
+ * @return bool
*/
public static function rollback($file, $revision) {
@@ -323,15 +324,19 @@ class Storage {
if ($uid === null || trim($filename, '/') === '') {
return false;
}
+
$users_view = new View('/'.$uid);
$files_view = new View('/'. User::getUser().'/files');
- if (!$files_view->isUpdatable($filename)) {
+ $versionCreated = false;
+
+ $fileInfo = $files_view->getFileInfo($file);
+
+ // check if user has the permissions to revert a version
+ if (!$fileInfo->isUpdateable()) {
return false;
}
- $versionCreated = false;
-
//first create a new version
$version = 'files_versions'.$filename.'.v'.$users_view->filemtime('files'.$filename);
if (!$users_view->file_exists($version)) {
@@ -345,10 +350,9 @@ class Storage {
// This has to happen manually here since the file is manually copied below
$oldVersion = $users_view->getFileInfo($fileToRestore)->getEncryptedVersion();
$oldFileInfo = $users_view->getFileInfo($fileToRestore);
- $newFileInfo = $files_view->getFileInfo($filename);
- $cache = $newFileInfo->getStorage()->getCache();
+ $cache = $fileInfo->getStorage()->getCache();
$cache->update(
- $newFileInfo->getId(), [
+ $fileInfo->getId(), [
'encrypted' => $oldVersion,
'encryptedVersion' => $oldVersion,
'size' => $oldFileInfo->getSize()
@@ -688,7 +692,7 @@ class Storage {
public static function expire($filename) {
$config = \OC::$server->getConfig();
$expiration = self::getExpiration();
-
+
if($config->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' && $expiration->isEnabled()) {
if (!Filesystem::file_exists($filename)) {