diff --git a/core/avatar/avatarcontroller.php b/core/avatar/avatarcontroller.php index 5ddd80c45af7de44ea42ba1c7887ea7ef8e4c340..19ea1f7a4d8ba0e53155a08160b5ebb48e1d445e 100644 --- a/core/avatar/avatarcontroller.php +++ b/core/avatar/avatarcontroller.php @@ -43,7 +43,7 @@ class AvatarController extends Controller { /** @var IAvatarManager */ protected $avatarManager; - /** @var ICache */ + /** @var \OC\Cache\File */ protected $cache; /** @var IL10N */ @@ -59,7 +59,7 @@ class AvatarController extends Controller { * @param string $appName * @param IRequest $request * @param IAvatarManager $avatarManager - * @param ICache $cache + * @param \OC\Cache\File $cache * @param IL10N $l10n * @param IUserManager $userManager * @param IUserSession $userSession @@ -67,7 +67,7 @@ class AvatarController extends Controller { public function __construct($appName, IRequest $request, IAvatarManager $avatarManager, - ICache $cache, + \OC\Cache\File $cache, IL10N $l10n, IUserManager $userManager, IUserSession $userSession) { diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php index bd3b5bc1cc1f6711d8a781b203a2e56ade4251a5..4742128ecbeec3c858722e4986e86b93a0846d32 100644 --- a/lib/private/cache/file.php +++ b/lib/private/cache/file.php @@ -42,6 +42,8 @@ class File { * Returns the cache storage for the logged in user * * @return \OC\Files\View cache storage + * @throws \OC\ForbiddenException + * @throws \OC\User\NoUserException */ protected function getStorage() { if (isset($this->storage)) { @@ -64,6 +66,8 @@ class File { /** * @param string $key + * @return mixed|null + * @throws \OC\ForbiddenException */ public function get($key) { $result = null; @@ -91,6 +95,10 @@ class File { /** * @param string $key + * @param mixed $value + * @param int $ttl + * @return bool|mixed + * @throws \OC\ForbiddenException */ public function set($key, $value, $ttl = 0) { $storage = $this->getStorage(); @@ -114,6 +122,11 @@ class File { return $result; } + /** + * @param string $key + * @return bool + * @throws \OC\ForbiddenException + */ public function hasKey($key) { $storage = $this->getStorage(); if ($storage && $storage->is_file($key) && $storage->isReadable($key)) { @@ -124,6 +137,8 @@ class File { /** * @param string $key + * @return bool|mixed + * @throws \OC\ForbiddenException */ public function remove($key) { $storage = $this->getStorage(); @@ -133,6 +148,11 @@ class File { return $storage->unlink($key); } + /** + * @param string $prefix + * @return bool + * @throws \OC\ForbiddenException + */ public function clear($prefix = '') { $storage = $this->getStorage(); if ($storage and $storage->is_dir('/')) { @@ -148,6 +168,10 @@ class File { return true; } + /** + * Runs GC + * @throws \OC\ForbiddenException + */ public function gc() { $storage = $this->getStorage(); if ($storage and $storage->is_dir('/')) { diff --git a/tests/core/avatar/avatarcontrollertest.php b/tests/core/avatar/avatarcontrollertest.php index c58d7febc3f3227bf264adb3ca071031cd93dbf1..0a85fbb27f181ae81f2eef8b7108d12e246b2cea 100644 --- a/tests/core/avatar/avatarcontrollertest.php +++ b/tests/core/avatar/avatarcontrollertest.php @@ -62,7 +62,7 @@ class AvatarControllerTest extends \Test\TestCase { $this->container['AppName'] = 'core'; $this->container['AvatarManager'] = $this->getMockBuilder('OCP\IAvatarManager') ->disableOriginalConstructor()->getMock(); - $this->container['Cache'] = $this->getMockBuilder('OCP\ICache') + $this->container['Cache'] = $this->getMockBuilder('OC\Cache\File') ->disableOriginalConstructor()->getMock(); $this->container['L10N'] = $this->getMockBuilder('OCP\IL10N') ->disableOriginalConstructor()->getMock();