diff options
author | Bart Visscher <bartv@thisnet.nl> | 2014-05-07 17:54:38 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2014-05-07 17:54:38 +0200 |
commit | f569c721a64486d0e7c7e307ed77ac0caed2dc2d (patch) | |
tree | df7b3399a858ffdae6bd6e66616746efbcee24bc /lib/private/cache | |
parent | 47d70da2f5cb55ad47023b061b68062dd8b8d8e2 (diff) | |
parent | 254fa5eb22efa5ba572702064377a6ad9eec9a53 (diff) | |
download | nextcloud-server-f569c721a64486d0e7c7e307ed77ac0caed2dc2d.tar.gz nextcloud-server-f569c721a64486d0e7c7e307ed77ac0caed2dc2d.zip |
Merge branch 'master' into optimize-startup-queries
Conflicts:
apps/files_sharing/lib/sharedstorage.php
tests/lib/group/manager.php
removed hasFilesSharedWith from lib/public/share.php and
sharedstorage.php to fix merge
Diffstat (limited to 'lib/private/cache')
-rw-r--r-- | lib/private/cache/file.php | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php index 8a6ef39f61b..feee9cc32b6 100644 --- a/lib/private/cache/file.php +++ b/lib/private/cache/file.php @@ -1,6 +1,7 @@ <?php /** * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl> + * Copyright (c) 2014 Vincent Petry <pvince81@owncloud.com> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -10,22 +11,22 @@ namespace OC\Cache; class File { protected $storage; + + /** + * Returns the cache storage for the logged in user + * @return \OC\Files\View cache storage + */ protected function getStorage() { if (isset($this->storage)) { return $this->storage; } if(\OC_User::isLoggedIn()) { \OC\Files\Filesystem::initMountPoints(\OC_User::getUser()); - $subdir = 'cache'; - $view = new \OC\Files\View('/' . \OC_User::getUser()); - if(!$view->file_exists($subdir)) { - $view->mkdir($subdir); - } - $this->storage = new \OC\Files\View('/' . \OC_User::getUser().'/'.$subdir); + $this->storage = new \OC\Files\View('/' . \OC_User::getUser() . '/cache'); return $this->storage; }else{ \OC_Log::write('core', 'Can\'t get cache storage, user not logged in', \OC_Log::ERROR); - return false; + throw new \OC\ForbiddenException('Can\t get cache storage, user not logged in'); } } @@ -83,11 +84,6 @@ class File { public function hasKey($key) { $storage = $this->getStorage(); if ($storage && $storage->is_file($key)) { - $mtime = $storage->filemtime($key); - if ($mtime < time()) { - $storage->unlink($key); - return false; - } return true; } return false; |