/**
  * return a user specific instance of \OCP\IAvatar
  * @see \OCP\IAvatar
  * @param string $userId the ownCloud user id
  * @return \OCP\IAvatar
  * @throws \Exception In case the username is potentially dangerous
  * @throws NotFoundException In case there is no user folder yet
  */
 public function getAvatar($userId)
 {
     $user = $this->userManager->get($userId);
     if (is_null($user)) {
         throw new \Exception('user does not exist');
     }
     /*
      * Fix for #22119
      * Basically we do not want to copy the skeleton folder
      */
     \OC\Files\Filesystem::initMountPoints($userId);
     $dir = '/' . $userId;
     /** @var Folder $folder */
     $folder = $this->rootFolder->get($dir);
     return new Avatar($folder, $this->l, $user, $this->logger);
 }
Exemple #2
0
 /**
  * delete versions for the given user
  *
  * @param string $user
  */
 protected function deleteVersions($user)
 {
     \OC_Util::tearDownFS();
     \OC_Util::setupFS($user);
     if ($this->rootFolder->nodeExists('/' . $user . '/files_versions')) {
         $this->rootFolder->get('/' . $user . '/files_versions')->delete();
     }
 }
Exemple #3
0
 /**
  * remove deleted files for the given user
  *
  * @param string $uid
  */
 protected function removeDeletedFiles($uid)
 {
     \OC_Util::tearDownFS();
     \OC_Util::setupFS($uid);
     if ($this->rootFolder->nodeExists('/' . $uid . '/files_trashbin')) {
         $this->rootFolder->get('/' . $uid . '/files_trashbin')->delete();
         $query = $this->dbConnection->getQueryBuilder();
         $query->delete('files_trash')->where($query->expr()->eq('user', $query->createParameter('uid')))->setParameter('uid', $uid);
         $query->execute();
     }
 }