summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorTom Needham <tom@owncloud.com>2013-03-09 00:04:33 +0000
committerTom Needham <tom@owncloud.com>2013-03-09 00:04:33 +0000
commite58dbd46fc4648ca6f33b83e7ce7745f07217477 (patch)
treee71722b44bf58d64e30addc4e6685855d62c5db5 /apps/files_versions
parent370f202251df2425ec49c78265859a804a88433f (diff)
parent546fb72b25fb8ebdc70aa75ccc7a095d7d83b174 (diff)
downloadnextcloud-server-e58dbd46fc4648ca6f33b83e7ce7745f07217477.tar.gz
nextcloud-server-e58dbd46fc4648ca6f33b83e7ce7745f07217477.zip
Merge in master
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/appinfo/app.php6
-rw-r--r--apps/files_versions/l10n/da.php1
-rw-r--r--apps/files_versions/l10n/nl.php1
-rw-r--r--apps/files_versions/l10n/pt_BR.php3
-rw-r--r--apps/files_versions/l10n/pt_PT.php1
-rw-r--r--apps/files_versions/l10n/uk.php1
-rw-r--r--apps/files_versions/lib/versions.php20
7 files changed, 23 insertions, 10 deletions
diff --git a/apps/files_versions/appinfo/app.php b/apps/files_versions/appinfo/app.php
index 761e0b723af..9be1c889682 100644
--- a/apps/files_versions/appinfo/app.php
+++ b/apps/files_versions/appinfo/app.php
@@ -1,9 +1,9 @@
<?php
//require_once 'files_versions/versions.php';
-OC::$CLASSPATH['OCA\Files_Versions\Storage'] = 'apps/files_versions/lib/versions.php';
-OC::$CLASSPATH['OCA\Files_Versions\Hooks'] = 'apps/files_versions/lib/hooks.php';
-OC::$CLASSPATH['OCA\Files_Versions\Capabilities'] = 'apps/files_versions/lib/capabilities.php';
+OC::$CLASSPATH['OCA\Files_Versions\Storage'] = 'files_versions/lib/versions.php';
+OC::$CLASSPATH['OCA\Files_Versions\Hooks'] = 'files_versions/lib/hooks.php';
+OC::$CLASSPATH['OCA\Files_Versions\Capabilities'] = 'files_versions/lib/capabilities.php';
OCP\Util::addscript('files_versions', 'versions');
diff --git a/apps/files_versions/l10n/da.php b/apps/files_versions/l10n/da.php
index 76ababe665a..447a3d2b85d 100644
--- a/apps/files_versions/l10n/da.php
+++ b/apps/files_versions/l10n/da.php
@@ -6,5 +6,6 @@
"File %s could not be reverted to version %s" => "Filen %s blev genskabt til version: %s",
"No old versions available" => "Ingen gamle version tilgængelige",
"No path specified" => "Ingen sti specificeret",
+"Versions" => "Versioner",
"Revert a file to a previous version by clicking on its revert button" => "Genskab en fil til en tidligere version ved at klikke på denne genskab knap."
);
diff --git a/apps/files_versions/l10n/nl.php b/apps/files_versions/l10n/nl.php
index c50f76c7add..92088522121 100644
--- a/apps/files_versions/l10n/nl.php
+++ b/apps/files_versions/l10n/nl.php
@@ -6,5 +6,6 @@
"File %s could not be reverted to version %s" => "Bestand %s kon niet worden teruggedraaid naar versie %s",
"No old versions available" => "Geen oudere versies beschikbaar",
"No path specified" => "Geen pad opgegeven",
+"Versions" => "Versies",
"Revert a file to a previous version by clicking on its revert button" => "Draai een bestand terug naar een voorgaande versie door te klikken op de terugdraai knop"
);
diff --git a/apps/files_versions/l10n/pt_BR.php b/apps/files_versions/l10n/pt_BR.php
index f68197ef092..f13b7931d4b 100644
--- a/apps/files_versions/l10n/pt_BR.php
+++ b/apps/files_versions/l10n/pt_BR.php
@@ -1,10 +1,11 @@
<?php $TRANSLATIONS = array(
-"Could not revert: %s" => "Não foi possível reverter: %s",
+"Could not revert: %s" => "Impossível reverter: %s",
"success" => "sucesso",
"File %s was reverted to version %s" => "Arquivo %s revertido à versão %s",
"failure" => "falha",
"File %s could not be reverted to version %s" => "Arquivo %s não pôde ser revertido à versão %s",
"No old versions available" => "Nenhuma versão antiga disponível",
"No path specified" => "Nenhum caminho especificado",
+"Versions" => "Versões",
"Revert a file to a previous version by clicking on its revert button" => "Reverta um arquivo a uma versão anterior clicando no botão reverter"
);
diff --git a/apps/files_versions/l10n/pt_PT.php b/apps/files_versions/l10n/pt_PT.php
index 2baccf3def8..93379547295 100644
--- a/apps/files_versions/l10n/pt_PT.php
+++ b/apps/files_versions/l10n/pt_PT.php
@@ -6,5 +6,6 @@
"File %s could not be reverted to version %s" => "Não foi possível reverter o ficheiro %s para a versão %s",
"No old versions available" => "Não existem versões mais antigas",
"No path specified" => "Nenhum caminho especificado",
+"Versions" => "Versões",
"Revert a file to a previous version by clicking on its revert button" => "Reverter um ficheiro para uma versão anterior clicando no seu botão reverter."
);
diff --git a/apps/files_versions/l10n/uk.php b/apps/files_versions/l10n/uk.php
index bfee066c63d..e722d95497b 100644
--- a/apps/files_versions/l10n/uk.php
+++ b/apps/files_versions/l10n/uk.php
@@ -6,5 +6,6 @@
"File %s could not be reverted to version %s" => "Файл %s не може бути відновлений до версії %s",
"No old versions available" => "Старі версії недоступні",
"No path specified" => "Шлях не вказаний",
+"Versions" => "Версії",
"Revert a file to a previous version by clicking on its revert button" => "Відновити файл на попередню версію, натиснувши на кнопку Відновити"
);
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 178ef722735..20611c61ec7 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -61,7 +61,7 @@ class Storage {
}
return false;
}
-
+
/**
* write to the database how much space is in use for versions
*
@@ -82,6 +82,14 @@ class Storage {
*/
public static function store($filename) {
if(\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
+
+ // if the file gets streamed we need to remove the .part extension
+ // to get the right target
+ $ext = pathinfo($filename, PATHINFO_EXTENSION);
+ if ($ext === 'part') {
+ $filename = substr($filename, 0, strlen($filename)-5);
+ }
+
list($uid, $filename) = self::getUidAndFilename($filename);
$files_view = new \OC\Files\View('/'.$uid .'/files');
@@ -442,12 +450,12 @@ class Storage {
}
}
- // check if enough space is available after versions are rearranged.
- // if not we delete the oldest versions until we meet the size limit for versions
- $numOfVersions = count($all_versions);
+ // Check if enough space is available after versions are rearranged.
+ // If not we delete the oldest versions until we meet the size limit for versions,
+ // but always keep the two latest versions
+ $numOfVersions = count($all_versions) -2 ;
$i = 0;
- while ($availableSpace < 0) {
- if ($i = $numOfVersions-2) break; // keep at least the last version
+ while ($availableSpace < 0 && $i < $numOfVersions) {
$versions_fileview->unlink($all_versions[$i]['path'].'.v'.$all_versions[$i]['version']);
$versionsSize -= $all_versions[$i]['size'];
$availableSpace += $all_versions[$i]['size'];