Exemple #1
0
 /**
  * @param User     $user
  * @param FilePath $lockPath
  *
  * @return bool
  *
  * @throws PageLockExpiredException
  */
 protected function assertHasLock(User $user, FilePath $lockPath)
 {
     if ($this->gitRepository->exists($lockPath) && !$this->isLockExpired($lockPath)) {
         $lockLogin = $this->getLockLogin($lockPath);
         if ($lockLogin == $user->getEmail($user)) {
             return true;
         }
     }
     throw new PageLockExpiredException();
 }
 protected function targetUrlExists($url)
 {
     try {
         $urlParts = parse_url($url);
         $urlPath = $urlParts['path'];
         $path = null;
         if (StringUtils::startsWith($urlPath, '/')) {
             /* Absolute paths won't work */
             return false;
         } else {
             $directoryPath = $this->path->getParentPath();
             $path = $directoryPath->appendPathString($urlPath);
         }
         $fileExists = $this->repository->exists($path);
         $this->linkedPaths[] = $path;
         return $fileExists;
     } catch (\Exception $e) {
     }
     return true;
 }