コード例 #1
0
ファイル: GitDao.class.php プロジェクト: blestab/tuleap
 public function delete(GitRepository $repository)
 {
     $id = $repository->getId();
     $projectId = $repository->getProjectId();
     $id = $this->da->escapeInt($id);
     $projectId = $this->da->escapeInt($projectId);
     if (empty($id) || empty($projectId)) {
         throw new GitDaoException($GLOBALS['Language']->getText('plugin_git', 'dao_delete_params'));
     }
     $deletionDate = $repository->getDeletionDate();
     $projectName = $repository->getProject()->getUnixName();
     $backup_path = str_replace('/', '_', $repository->getFullName());
     $backup_path .= '_' . strtotime($deletionDate);
     $backup_path = $projectName . '_' . $backup_path;
     $backup_path = $this->da->quoteSmart($backup_path);
     $deletionDate = $this->da->quoteSmart($deletionDate);
     $query = ' UPDATE ' . $this->getTable() . ' SET ' . self::REPOSITORY_DELETION_DATE . '=' . $deletionDate . ', ' . self::REPOSITORY_BACKUP_PATH . '=' . $backup_path . ' WHERE ' . self::REPOSITORY_ID . '=' . $id . ' AND ' . self::FK_PROJECT_ID . '=' . $projectId;
     $r = $this->update($query);
     $ar = $this->da->affectedRows();
     if ($r === false || $ar == 0) {
         throw new GitDaoException($GLOBALS['Language']->getText('plugin_git', 'dao_delete_error') . ' ' . $this->da->isError());
     }
     if ($ar == 1) {
         return true;
     }
     return false;
 }