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


PHP GitRepository::load方法代码示例

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


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

示例1: process

 public function process()
 {
     $parameters = $this->getParametersAsArray();
     //repo id
     $repositoryId = '';
     if (!empty($parameters[0])) {
         $repositoryId = $parameters[0];
     } else {
         $this->error('Missing argument repository id');
         return false;
     }
     //repo access
     $repositoryAccess = '';
     if (!empty($parameters[1])) {
         $repositoryAccess = $parameters[1];
     } else {
         $this->error('Missing argument repository access');
         return false;
     }
     //save
     $repository = new GitRepository();
     $repository->setId($repositoryId);
     try {
         $repository->load();
         $repository->setAccess($repositoryAccess);
         $repository->changeAccess();
     } catch (GitDaoException $e) {
         $this->error($e->getMessage());
         return false;
     }
     $this->done();
 }
开发者ID:nterray,项目名称:tuleap,代码行数:32,代码来源:SystemEvent_GIT_REPO_ACCESS.class.php

示例2: getRepository

 /**
  * Wrapper for GitRepository for unit testing purpose
  *
  * @param array $row data of the repository to instantiate
  *
  * @return GitRepository
  */
 protected function getRepository($row)
 {
     $r = new GitRepository();
     $r->setId($row[GitDao::REPOSITORY_ID]);
     $r->load();
     return $r;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:14,代码来源:GitViewsRepositoriesTraversalStrategy.class.php

示例3: GitRepository

 function permission_user_allowed_to_change($params)
 {
     if (!$params['allowed']) {
         if (!$this->_cached_permission_user_allowed_to_change) {
             if (in_array($params['permission_type'], array('PLUGIN_GIT_READ', 'PLUGIN_GIT_WRITE', 'PLUGIN_GIT_WPLUS'))) {
                 require_once 'GitRepository.class.php';
                 $repository = new GitRepository();
                 $repository->setId($params['object_id']);
                 try {
                     $repository->load();
                     //Only project admin can update perms of project repositories
                     //Only repo owner can update perms of personal repositories
                     $user = UserManager::instance()->getCurrentUser();
                     $this->_cached_permission_user_allowed_to_change = $repository->belongsTo($user) || $user->isMember($repository->getProjectId(), 'A');
                 } catch (Exception $e) {
                     // do nothing
                 }
             }
         }
         $params['allowed'] = $this->_cached_permission_user_allowed_to_change;
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:22,代码来源:gitPlugin.class.php

示例4: _listOfMails

    /**
     * LIST OF MAILS TO NOTIFY
     */
    protected function _listOfMails()
    {
        $r = new GitRepository();
        $r->setId($this->repoId);
        $r->load();
        $mails = $r->getNotifiedMails();
        ?>
<h3><?php 
        echo $this->getText('notified_mails_title');
        ?>
</h3>
    <?php 
        if (!empty($mails)) {
            ?>
<form id="add_user_form" action="/plugins/git/" method="POST">
    <input type="hidden" id="action" name="action" value="remove_mail" />
    <input type="hidden" id="group_id" name="group_id" value="<?php 
            echo $this->groupId;
            ?>
" />
    <input type="hidden" id="repo_id" name="repo_id" value="<?php 
            echo $this->repoId;
            ?>
" />
    <table>
        <?php 
            $i = 0;
            foreach ($mails as $mail) {
                echo '<tr class="' . html_get_alt_row_color(++$i) . '">';
                echo '<td>' . $mail . '</td>';
                echo '<td>';
                echo '<input type="checkbox" name="mail[]" value="' . $this->HTMLPurifier->purify($mail) . '" />';
                echo '</a>';
                echo '</td>';
                echo '</tr>';
            }
            ?>
    </table>
    <input type="submit" value="<?php 
            echo $GLOBALS['Language']->getText('global', 'btn_delete');
            ?>
" />
</form>
        <?php 
        } else {
            ?>
<h4><?php 
            echo $this->getText('add_mail_existing');
            ?>
 </h4>
<?php 
        }
    }
开发者ID:nterray,项目名称:tuleap,代码行数:56,代码来源:GitViews.class.php

示例5: save

 /**
  * This method allows one to save any repository attribues changes from the web interface.
  * @param <type> $repoId
  * @param <type> $repoAccess
  * @param <type> $repoDescription
  * @return <type>
  */
 public function save($projectId, $repoId, $repoAccess, $repoDescription)
 {
     $c = $this->getController();
     if (empty($repoId)) {
         $c->addError($this->getText('actions_params_error'));
         $c->redirect('/plugins/git/?action=index&group_id=' . $projectId);
         return false;
     }
     if (empty($repoAccess) || empty($repoDescription)) {
         $c->addError($this->getText('actions_params_error'));
         $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $repoId . '/');
         return false;
     }
     $repository = new GitRepository();
     $repository->setId($repoId);
     try {
         $repository->load();
         if (!empty($repoAccess)) {
             if ($repository->getBackend() instanceof Git_Backend_Gitolite) {
                 $repository->getBackend()->savePermissions($repository, $repoAccess);
             } else {
                 if ($repository->getAccess() != $repoAccess) {
                     $this->systemEventManager->createEvent('GIT_REPO_ACCESS', $repoId . SystemEvent::PARAMETER_SEPARATOR . $repoAccess, SystemEvent::PRIORITY_HIGH);
                     $c->addInfo($this->getText('actions_repo_access'));
                 }
             }
         }
         if (strlen($repoDescription) > 1024) {
             $c->addError($this->getText('actions_long_description'));
         } elseif (!empty($repoDescription)) {
             $repository->setDescription($repoDescription);
         }
     } catch (GitDaoException $e) {
         $c->addError($this->getText('actions_repo_not_found'));
         $c->redirect('/plugins/git/?group_id=' . $projectId);
         return false;
     } catch (GitRepositoryException $e1) {
         die('GitRepositoryException');
         $c->addError($e1->getMessage());
         return false;
     }
     try {
         $repository->save();
     } catch (GitDaoException $e) {
         $c->addError($e->getMessage());
         $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $repoId . '/');
         return false;
     }
     $c->addInfo($this->getText('actions_save_repo_process'));
     $c->redirect('/plugins/git/index.php/' . $projectId . '/view/' . $repoId . '/');
     return;
 }
开发者ID:nickl-,项目名称:tuleap,代码行数:59,代码来源:GitActions.class.php

示例6: GitRepository

 function permission_user_allowed_to_change($params)
 {
     if (!$params['allowed']) {
         $user = $this->getCurrentUser();
         $project = $this->getProjectManager()->getProject($params['group_id']);
         if ($this->getGitPermissionsManager()->userIsGitAdmin($user, $project)) {
             $this->_cached_permission_user_allowed_to_change = true;
         }
         if (!$this->_cached_permission_user_allowed_to_change) {
             if (in_array($params['permission_type'], array('PLUGIN_GIT_READ', 'PLUGIN_GIT_WRITE', 'PLUGIN_GIT_WPLUS'))) {
                 $repository = new GitRepository();
                 $repository->setId($params['object_id']);
                 try {
                     $repository->load();
                     //Only project admin can update perms of project repositories
                     //Only repo owner can update perms of personal repositories
                     $this->_cached_permission_user_allowed_to_change = $repository->belongsTo($user) || $this->getPermissionsManager()->userIsGitAdmin($user, $project);
                 } catch (Exception $e) {
                     // do nothing
                 }
             }
         }
         $params['allowed'] = $this->_cached_permission_user_allowed_to_change;
     }
 }
开发者ID:LouisRenWeiWei,项目名称:tuleap,代码行数:25,代码来源:gitPlugin.class.php

示例7: process

 public function process()
 {
     $parameters = $this->getParametersAsArray();
     //print_r($parameters);
     $project = null;
     if (!empty($parameters[0])) {
         $project = $this->getProject($parameters[0]);
     } else {
         $this->error('Missing argument project id');
         return false;
     }
     $repositoryName = '';
     if (!empty($parameters[1])) {
         $repositoryName = $parameters[1];
     } else {
         $this->error('Missing argument repository name');
         return false;
     }
     $parentId = '';
     if (!empty($parameters[2])) {
         $parentId = $parameters[2];
     } else {
         $this->error('Missing argument parent id');
         return false;
     }
     $userId = 0;
     if (!empty($parameters[3])) {
         $userId = $parameters[3];
     } else {
         $this->error('Missing argument user id');
         return false;
     }
     try {
         $repository = new GitRepository();
         $repository->setProject($project);
         $repository->setId($parentId);
         //load before setting creator
         $repository->load();
         $user = null;
         if (!empty($userId)) {
             $user = UserManager::instance()->getUserById($userId);
         }
         if (!empty($user)) {
             $repository->setCreator($user);
         }
         $repository->forkShell($repositoryName);
         $this->done();
     } catch (GitDaoException $e1) {
         $this->error($e1->getMessage());
         return false;
     } catch (GitDriverException $e2) {
         $this->error($e2->getMessage());
         return false;
     } catch (GitBackendException $e3) {
         $this->error($e3->getMessage());
         return false;
     } catch (Exception $e4) {
         $this->error($e4->getMessage());
         return false;
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:61,代码来源:SystemEvent_GIT_REPO_CLONE.class.php

示例8: loadRepositoryFromId

 /**
  * Load a repository from its id. Mainly used as a wrapper for tests
  *
  * @param $repositoryId Id of the repository
  *
  * @return GitRepository
  */
 function loadRepositoryFromId($repositoryId)
 {
     $repository = new GitRepository();
     $repository->setId($repositoryId);
     $repository->load();
     return $repository;
 }
开发者ID:pdaniel-frk,项目名称:tuleap,代码行数:14,代码来源:Git_Backend_Gitolite.class.php


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