当前位置: 首页>>代码示例>>PHP>>正文


PHP GitRepository::getBackupPath方法代码示例

本文整理汇总了PHP中GitRepository::getBackupPath方法的典型用法代码示例。如果您正苦于以下问题:PHP GitRepository::getBackupPath方法的具体用法?PHP GitRepository::getBackupPath怎么用?PHP GitRepository::getBackupPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GitRepository的用法示例。


在下文中一共展示了GitRepository::getBackupPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: archive

 /**
  *@todo move the archive to another directory
  * @param <type> $repository
  * @return <type>
  */
 public function archive(GitRepository $repository)
 {
     chdir($this->getGitRootPath());
     $path = $repository->getPath();
     $archiveName = $repository->getBackupPath() . '.tar.bz2';
     $cmd = ' tar cjf ' . $archiveName . ' ' . $path . ' 2>&1';
     $rcode = 0;
     $output = $this->system($cmd, $rcode);
     if ($rcode != 0) {
         throw new GitBackendException($cmd . ' -> ' . $output);
     }
     if (!empty($this->gitBackupDir) && is_dir($this->gitBackupDir)) {
         $this->system('mv ' . $this->getGitRootPath() . '/' . $archiveName . ' ' . $this->gitBackupDir . '/' . $archiveName);
     }
     return true;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:21,代码来源:GitBackend.class.php

示例2: save

 public function save(GitRepository $repository)
 {
     $id = (int) $repository->getId();
     $name = $repository->getName();
     $mailPrefix = $repository->getMailPrefix();
     $parentId = 0;
     $scope = $repository->getScope();
     $namespace = $repository->getNamespace();
     try {
         $parent = $repository->getParent();
         if (!empty($parent)) {
             $parentId = $parent->getId();
         }
     } catch (GitDaoException $e) {
     }
     $projectId = $repository->getProjectId();
     $description = $repository->getDescription();
     $path = $repository->getPath();
     $isInitialized = $repository->getIsInitialized();
     $creationUserId = $repository->getCreatorId();
     $access = $repository->getAccess();
     //protect parameters
     $id = $this->da->escapeInt($id);
     $name = $this->da->quoteSmart($name);
     $description = $this->da->quoteSmart($description);
     $path = $this->da->quoteSmart($path);
     $projectId = $this->da->escapeInt($projectId);
     $isInitialized = $this->da->escapeInt($isInitialized);
     $creationUserId = $this->da->escapeInt($creationUserId);
     $access = $this->da->quoteSmart($access);
     $mailPrefix = $this->da->quoteSmart($mailPrefix);
     $scope = $this->da->quoteSmart($scope);
     $namespace = $this->da->quoteSmart($namespace);
     $backup_path = $this->da->quoteSmart($repository->getBackupPath());
     $insert = false;
     if ($this->exists($id)) {
         $query = 'UPDATE ' . $this->getTable() . ' SET ' . self::REPOSITORY_DESCRIPTION . '=' . $description . ',' . self::REPOSITORY_IS_INITIALIZED . '=' . $isInitialized . ',' . self::REPOSITORY_ACCESS . '=' . $access . ',' . self::REPOSITORY_MAIL_PREFIX . '=' . $mailPrefix . ',' . self::REPOSITORY_BACKUP_PATH . '=' . $backup_path . 'WHERE ' . self::REPOSITORY_ID . '=' . $id;
     } else {
         if ($repository->getBackend() instanceof Git_Backend_Gitolite) {
             $backendType = self::BACKEND_GITOLITE;
         } else {
             $backendType = self::BACKEND_GITSHELL;
         }
         $insert = true;
         $creationDate = date('Y-m-d H:i:s');
         $query = 'INSERT INTO ' . $this->getTable() . '(' . self::REPOSITORY_NAME . ',' . self::REPOSITORY_PATH . ',' . self::REPOSITORY_PARENT . ',' . self::REPOSITORY_DESCRIPTION . ',' . self::FK_PROJECT_ID . ',' . self::REPOSITORY_CREATION_DATE . ',' . self::REPOSITORY_CREATION_USER_ID . ',' . self::REPOSITORY_IS_INITIALIZED . ',' . self::REPOSITORY_ACCESS . ',' . self::REPOSITORY_BACKEND_TYPE . ',' . self::REPOSITORY_SCOPE . ',' . self::REPOSITORY_NAMESPACE . ') values (' . "" . $name . "," . "" . $path . "," . "" . $parentId . "," . "" . $description . "," . $projectId . "," . "'" . $creationDate . "'," . $creationUserId . "," . $isInitialized . ',' . $access . ',' . $this->da->quoteSmart($backendType) . ',' . $scope . ',' . $namespace . ')';
     }
     if ($this->update($query) === false) {
         throw new GitDaoException($GLOBALS['Language']->getText('plugin_git', 'dao_update_error') . ' : ' . $this->da->isError());
     }
     if ($insert) {
         return $this->da->lastInsertId();
     }
     return true;
 }
开发者ID:blestab,项目名称:tuleap,代码行数:55,代码来源:GitDao.class.php

示例3: deleteArchivedRepository

 public function deleteArchivedRepository(GitRepository $repository)
 {
     $this->logger->debug('Delete backup ' . $repository->getBackupPath());
     $this->getDriver()->deleteBackup($repository, $this->getGitPlugin()->getConfigurationParameter('git_backup_dir'));
 }
开发者ID:pdaniel-frk,项目名称:tuleap,代码行数:5,代码来源:Git_Backend_Gitolite.class.php

示例4: getBackupPath

 private function getBackupPath(GitRepository $repository, $backup_directory)
 {
     return $backup_directory . '/' . $repository->getBackupPath() . '.tar.gz';
 }
开发者ID:superlinger,项目名称:tuleap,代码行数:4,代码来源:Git_GitoliteDriver.class.php

示例5: archiveBeforePurge

 /**
  * Invoque 'archive deleted item' hook in order to make a backup of the git repository archive
  *
  * @param GitRepository $repository
  *
  * @return Boolean
  */
 public function archiveBeforePurge(GitRepository $repository)
 {
     $backup = $this->getGitPlugin()->getConfigurationParameter('git_backup_dir');
     if (dirname($backup)) {
         $sourcePath = $backup . '/' . $repository->getBackupPath() . '.tar.gz';
         $status = true;
         $error = null;
         $params = array('source_path' => $sourcePath, 'archive_prefix' => self::PREFIX, 'status' => &$status, 'error' => &$error);
         $this->getEventManager()->processEvent('archive_deleted_item', $params);
         if ($params['status']) {
             $this->logger->info('The repository' . $repository->getName() . ' has been moved to the archiving area before purge ');
             return true;
         } else {
             $this->logger->warn('Can not move the repository' . $repository->getName() . ' to the archiving area before purge :[' . $params['error'] . ']');
             return false;
         }
     } else {
         $this->logger->error('An error occured: The backup ' . $backup . ' is not a directory or does not exist');
         return false;
     }
 }
开发者ID:blestab,项目名称:tuleap,代码行数:28,代码来源:Git_Backend_Gitolite.class.php


注:本文中的GitRepository::getBackupPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。