/** * @dataProvider expirationData * * @param string $retentionObligation * @param int $timeNow * @param int $timestamp * @param bool $quotaExceeded * @param string $expectedResult */ public function testExpiration($retentionObligation, $timeNow, $timestamp, $quotaExceeded, $expectedResult) { $mockedConfig = $this->getMockedConfig($retentionObligation); $mockedTimeFactory = $this->getMockedTimeFactory($timeNow); $expiration = new Expiration($mockedConfig, $mockedTimeFactory); $actualResult = $expiration->isExpired($timestamp, $quotaExceeded); $this->assertEquals($expectedResult, $actualResult); }
protected function run($argument) { $maxAge = $this->expiration->getMaxAgeAsTimestamp(); if (!$maxAge) { return; } $this->userManager->callForAllUsers(function (IUser $user) { $uid = $user->getUID(); if (!$this->setupFS($uid)) { return; } Storage::expireOlderThanMaxForUser($uid); }); }
protected function run($argument) { $maxAge = $this->expiration->getMaxAgeAsTimestamp(); if (!$maxAge) { return; } $users = $this->userManager->search(''); $isFSready = false; foreach ($users as $user) { $uid = $user->getUID(); if (!$isFSready) { if (!$this->setupFS($uid)) { continue; } $isFSready = true; } Storage::expireOlderThanMaxForUser($uid); } \OC_Util::tearDownFS(); }