/** * @param $argument * @throws \Exception */ 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; } $dirContent = Helper::getTrashFiles('/', $uid, 'mtime'); Trashbin::deleteExpiredFiles($dirContent, $uid); }); \OC_Util::tearDownFS(); }
/** * @param OCP\Files\FileInfo[] $files * @param integer $limit */ public function dummyDeleteExpiredFiles($files, $limit) { // dummy value for $retention_obligation because it is not needed here return parent::deleteExpiredFiles($files, \Test_Trashbin::TEST_TRASHBIN_USER1, $limit, 0); }
/** * @param $argument * @throws \Exception */ protected function run($argument) { $maxAge = $this->expiration->getMaxAgeAsTimestamp(); if (!$maxAge) { return; } $offset = $this->config->getAppValue('files_trashbin', 'cronjob_user_offset', 0); $users = $this->userManager->search('', self::USERS_PER_SESSION, $offset); if (!count($users)) { // No users found, reset offset and retry $offset = 0; $users = $this->userManager->search('', self::USERS_PER_SESSION); } $offset += self::USERS_PER_SESSION; $this->config->setAppValue('files_trashbin', 'cronjob_user_offset', $offset); foreach ($users as $user) { $uid = $user->getUID(); if (!$this->setupFS($uid)) { continue; } $dirContent = Helper::getTrashFiles('/', $uid, 'mtime'); Trashbin::deleteExpiredFiles($dirContent, $uid); } \OC_Util::tearDownFS(); }