aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib/storage.php
diff options
context:
space:
mode:
authorVictor Dubiniuk <victor.dubiniuk@gmail.com>2015-08-20 18:32:41 +0300
committerVictor Dubiniuk <victor.dubiniuk@gmail.com>2015-09-15 17:08:54 +0300
commitc3e055549e79b59de19fac46d949f55225998f32 (patch)
tree8699878dbec738684e940e0e7a0d6565b94333b5 /apps/files_versions/lib/storage.php
parentb95d1e668370c74d027330cdabe5e65e242ef18d (diff)
downloadnextcloud-server-c3e055549e79b59de19fac46d949f55225998f32.tar.gz
nextcloud-server-c3e055549e79b59de19fac46d949f55225998f32.zip
Improvements
Diffstat (limited to 'apps/files_versions/lib/storage.php')
-rw-r--r--apps/files_versions/lib/storage.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php
index 269d43befb8..90fe308e970 100644
--- a/apps/files_versions/lib/storage.php
+++ b/apps/files_versions/lib/storage.php
@@ -480,11 +480,11 @@ class Storage {
* get list of files we want to expire
* @param array $versions list of versions
* @param integer $time
+ * @param bool $quotaExceeded is versions storage limit reached
* @return array containing the list of to deleted versions and the size of them
*/
protected static function getExpireList($time, $versions, $quotaExceeded = false) {
- $application = new Application();
- $expiration = $application->getContainer()->query('Expiration');
+ $expiration = self::getExpiration();
if ($expiration->shouldAutoExpire()) {
list($toDelete, $size) = self::getAutoExpireList($time, $versions);
@@ -568,8 +568,7 @@ class Storage {
*/
private static function scheduleExpire($uid, $fileName, $versionsSize = null, $neededSpace = 0) {
// let the admin disable auto expire
- $application = new Application();
- $expiration = $application->getContainer()->query('Expiration');
+ $expiration = self::getExpiration();
if ($expiration->isEnabled()) {
$command = new Expire($uid, $fileName, $versionsSize, $neededSpace);
\OC::$server->getCommandBus()->push($command);
@@ -586,8 +585,7 @@ class Storage {
*/
public static function expire($filename, $versionsSize = null, $offset = 0) {
$config = \OC::$server->getConfig();
- $application = new Application();
- $expiration = $application->getContainer()->query('Expiration');
+ $expiration = self::getExpiration();
if($config->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' && $expiration->isEnabled()) {
list($uid, $filename) = self::getUidAndFilename($filename);
@@ -706,4 +704,13 @@ class Storage {
}
}
+ /**
+ * Static workaround
+ * @return Expiration
+ */
+ protected static function getExpiration(){
+ $application = new Application();
+ return $application->getContainer()->query('Expiration');
+ }
+
}