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


PHP Git::enable_credential_cache方法代码示例

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


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

示例1: setupDevRepos

 /**
  * Setup GIT Repos from Stash
  *
  * Lists all repos from remote project and downloaded them, skipping devtools
  *
  * @param   string $directory Directory to work with
  * @param   bool $force True or False on whether to rm -Rf and then recreate the repo
  * @return  array
  */
 function setupDevRepos($directory, $force = false, $mode = 'ssh', $branch = 'master', $project_key = 'freepbx')
 {
     $skipr = array('devtools', 'moh_sounds', 'versionupgrade', 'fw_langpacks', 'custom-freepbx-modules', 'sipstation_module');
     $o = $this->stash->getAllRepos($project_key);
     if ($mode == 'http' && version_compare(Git::version(), '1.7.9', '<')) {
         freepbx::out("HTTP Mode is only supported with GIT 1.7.9 or Higher");
         die;
     } elseif ($mode == 'http') {
         Git::enable_credential_cache();
     }
     foreach ($o['values'] as $repos) {
         $dir = $directory . '/' . $repos['name'];
         if (in_array($repos['name'], $skipr)) {
             continue;
         }
         freepbx::outn("Cloning " . $repos['name'] . " into " . $dir . "...");
         if (file_exists($dir) && $force) {
             freepbx::out($dir . " Already Exists but force is enabled so deleting and restoring");
             exec('rm -Rf ' . $dir);
         } elseif (file_exists($dir)) {
             freepbx::out($dir . " Already Exists, Skipping (use --force to force)");
             continue;
         }
         $uri = $mode == 'http' ? $repos['cloneUrl'] : $repos['cloneSSH'];
         $repo = Git::create($dir, $uri);
         $repo->add_merge_driver();
         freepbx::out("Done");
         $obranch = $branch;
         while ($branch) {
             try {
                 freepbx::outn("\tChecking you out into the " . $branch . " branch...");
                 $repo->checkout($branch);
                 freepbx::out("Done");
                 break;
             } catch (Exception $e) {
                 freepbx::out("Doesnt Exist!");
                 $branch = $this->getLowerBranch($branch);
                 if ($branch === false) {
                     try {
                         freepbx::outn("\tChecking you out into the master branch...");
                         $repo->checkout('master');
                         freepbx::out("Done");
                     } catch (Exception $e) {
                         //TODO: error?
                     }
                 }
             }
         }
         $branch = $obranch;
         freepbx::out(" ");
     }
 }
开发者ID:FreePBX,项目名称:devtools,代码行数:61,代码来源:freepbx.php

示例2: elseif

 if (!file_exists($directory . '/' . $options['m'])) {
     if (empty($vars['username'])) {
         $username = freepbx::getInput("FreePBX Username");
     } else {
         $username = $vars['username'];
     }
     if (empty($vars['password'])) {
         $password = freepbx::getPassword("FreePBX Password", true);
     } else {
         $password = $vars['password'];
     }
     if ($mode == 'http' && version_compare(Git::version(), '1.7.9', '<')) {
         freepbx::out("HTTP Mode is only supported with GIT 1.7.9 or Higher");
         die;
     } elseif ($mode == 'http') {
         Git::enable_credential_cache();
     }
     if (isset($options['r'])) {
         $stash->project_key = $project;
         $repo = $stash->getRepo($options['r']);
         if ($repo === false) {
             freepbx::out("[ERROR] Unable to find " . $options['m']);
             exit(0);
         }
     } else {
         $stash = new Stash($username, $password);
         foreach ($projects as $project => $description) {
             $repo = $stash->getRepo($options['m'], $project);
             if ($repo === false) {
                 freepbx::out("[WARN] " . $options['m'] . " is NOT in the " . $description);
             } else {
开发者ID:FreePBX,项目名称:devtools,代码行数:31,代码来源:freepbx_git.php


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