Exemplo n.º 1
0
 public function Login()
 {
     global $scm_username, $scm_password;
     // do login
     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, $scm_username);
     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, $scm_password);
 }
Exemplo n.º 2
0
 /**
  * Defaukt constructor.
  *
  * @param array $options
  */
 public function __construct(array $options = array())
 {
     $this->log = Hoborg_Log::getLogger(__CLASS__);
     $this->options = $options;
     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, $options['user']);
     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, $options['password']);
     $this->log->debug('SVN client version: ' . svn_client_version());
 }
Exemplo n.º 3
0
 function __construct($repoPath)
 {
     parent::__construct($repoPath);
     global $wgSubversionUser, $wgSubversionPassword;
     if ($wgSubversionUser) {
         svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, $wgSubversionUser);
         svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, $wgSubversionPassword);
     }
 }
Exemplo n.º 4
0
 private function auth()
 {
     svn_auth_set_parameter(PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS, true);
     svn_auth_set_parameter(SVN_AUTH_PARAM_NON_INTERACTIVE, true);
     svn_auth_set_parameter(SVN_AUTH_PARAM_NO_AUTH_CACHE, true);
     if ($this->user) {
         svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, $this->user);
     }
     if ($this->pass) {
         svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, $this->pass);
     }
 }
Exemplo n.º 5
0
 public function testhasSpecFileReturnsSpec()
 {
     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, 'pearfarm');
     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, 'mmm_pears');
     svn_auth_set_parameter(SVN_AUTH_PARAM_DONT_STORE_PASSWORDS, true);
     svn_auth_set_parameter(SVN_AUTH_PARAM_NO_AUTH_CACHE, true);
     $this->svn = new PearfarmSvn(self::TESTREPO);
     $tags = $this->svn->get_tags();
     $tag = array_pop($tags);
     $spec = $this->svn->has_spec($tag);
     $this->assertTrue(strpos($spec, '$spec') !== false);
 }
Exemplo n.º 6
0
 /**
  * Initialize repository
  *
  * Initialize repository from the given URL. Optionally username and
  * password may be passed to the method, if required for the repository.
  *
  * @param string $url 
  * @param string $user 
  * @param string $password 
  * @return void
  */
 public function initialize($url, $user = null, $password = null)
 {
     if ($user !== null) {
         svn_auth_set_parameter(SVN_AUTH_PARAM_NON_INTERACTIVE, true);
         svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, $user);
         if ($password !== null) {
             svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, $password);
         }
     }
     if (svn_checkout($url, $this->root) === false || ($this->currentVersion = (string) svn_update($this->root)) === false) {
         throw new vcsCheckoutFailedException($url);
     }
 }
Exemplo n.º 7
0
 protected static function write($decodedArray)
 {
     // Update Version
     if (isset($decodedArray[0]['attribs']['version'])) {
         $versionNumberStr = $decodedArray[0]['attribs']['version'];
         if (@intval($versionNumberStr) != null) {
             // Increment Version Number
             $versionNumberInt = intval($versionNumberStr) + 1;
             $decodedArray[0]['attribs']['version'] = $versionNumberInt;
         }
     }
     // Encode XML
     $xmlEncoder = new XMLEncoder();
     $xmlFileContent = $xmlEncoder->encode($decodedArray);
     // Write To File
     $file = fopen('sites.xml', 'w+');
     fputs($file, iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $xmlFileContent));
     fclose($file);
     // Commit New Changes
     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, SITES_XML_SVN_USERNAME);
     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, SITES_XML_SVN_PASSWORD);
     svn_commit('PHP Commit', './');
 }
Exemplo n.º 8
0
 /**
  *
  * 调用svn或git的log,获取版本号和更新文字日志
  * @param $src_path 地址
  * @param $type='svn' svn或者git
  * @param $auth=null  帐号密码
  * @param $limit=10 数量
  * @param $last=''  从某版本开始查询
  */
 public function get_log($src_path, $type = 'svn', $auth = null, $limit = 10, $last = '')
 {
     //如果last没指定,则取最新limit个
     //如果指定了,则取limit+1个,去掉last
     $out = array();
     switch ($type) {
         case 'svn':
             if (function_exists('svn_log')) {
                 if ($auth) {
                     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, $auth['username']);
                     svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, $auth['password']);
                 }
                 if ($last) {
                     $_return = svn_log($src_path, $last, 1, $limit + 1, SVN_STOP_ON_COPY);
                 } else {
                     $_return = svn_log($src_path, null, null, $limit, SVN_STOP_ON_COPY);
                 }
                 foreach ($_return as $_log) {
                     $out[$_log['rev']] = "{$_log['author']}:{$_log['msg']}";
                 }
             } else {
                 $cmd = "svn log {$src_path} --xml --non-interactive --stop-on-copy";
                 if (!empty($auth)) {
                     $cmd .= " --username {$auth['username']} --password {$auth['password']}";
                 }
                 if ($last) {
                     $cmd .= " -r {$last}:1 --limit " . ($limit + 1);
                 } else {
                     $cmd .= " --limit {$limit}";
                 }
                 $cmdresult = exec($cmd);
                 $loadxml = simplexml_load_string(trim($cmdresult), 'SimpleXMLElement', LIBXML_NOCDATA);
                 foreach ($loadxml->children() as $elem) {
                     $out[(string) $elem->attributes()->revision] = $elem->author . ":" . $elem->msg;
                 }
             }
             if ($last && isset($out[$last])) {
                 unset($out[$last]);
             }
             return $out;
         case 'git':
             break;
         default:
             return null;
     }
 }
<?php

svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, 'vahagn');
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, 'Vahagn123');
if ($_REQUEST["checkout"]) {
    echo svn_checkout('http://*****:*****@naghashyan.com/svn/pcstore', "/var/www/pcstore");
} else {
    echo svn_update("/var/www/pcstore");
}
Exemplo n.º 10
0
<?php

include './Header.php';
echo '<h1>Gestor de Actualizaciones</h1>';
echo '<p>Buscar e instalar. <a href="?doUpdate=true">&raquo; Actualizaciones...?</a></p>';
$doUpdate = filter_input(INPUT_GET, "doUpdate");
svn_auth_set_parameter(PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS, TRUE);
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, "lupe");
svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, "ggarza.");
if ($doUpdate) {
    $x = svn_update(filter_input(INPUT_SERVER, "CONTEXT_DOCUMENT_ROOT"), SVN_REVISION_HEAD, TRUE);
    echo 'Actualizado a la revision: ' . $x;
    echo '<br>';
}
echo '<p><h2>Log de Cambios</h2>';
$aLog = svn_log(filter_input(INPUT_SERVER, "CONTEXT_DOCUMENT_ROOT"), SVN_REVISION_PREV, SVN_REVISION_HEAD);
foreach ($aLog as $rev) {
    ?>
    <div class="panel panel-info">
        <div class="panel-heading">
            <h3 class="panel-title">Revision # <?php 
    echo $rev['rev'];
    ?>
</h3>
        </div>
        <div class="panel-body">
            Por: <?php 
    echo $rev['author'];
    ?>
<br>
            Mensaje: <?php 
Exemplo n.º 11
0
 /**
  * Authenticate to the repository
  *
  * @access public
  * @author Cédric Alfonsi, <*****@*****.**>
  * @param  Repository vcs
  * @param  string login
  * @param  string password
  * @return boolean
  */
 public function authenticate(core_kernel_versioning_Repository $vcs, $login, $password)
 {
     $returnValue = (bool) false;
     //if the system has already do its authentication to the repository, return the negociation result
     if (isset(self::$authenticatedRepositories[$vcs->getUri()])) {
         $returnValue = self::$authenticatedRepositories[$vcs->getUri()];
     } else {
         svn_auth_set_parameter(PHP_SVN_AUTH_PARAM_IGNORE_SSL_VERIFY_ERRORS, true);
         // <--- Important for certificate issues!
         svn_auth_set_parameter(SVN_AUTH_PARAM_NON_INTERACTIVE, true);
         svn_auth_set_parameter(SVN_AUTH_PARAM_NO_AUTH_CACHE, true);
         svn_auth_set_parameter(SVN_AUTH_PARAM_DONT_STORE_PASSWORDS, true);
         svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_USERNAME, $login);
         svn_auth_set_parameter(SVN_AUTH_PARAM_DEFAULT_PASSWORD, $password);
         if (@svn_info((string) $vcs->getOnePropertyValue(new core_kernel_classes_property(PROPERTY_GENERIS_VERSIONEDREPOSITORY_URL)), false) !== false) {
             $returnValue = true;
         }
     }
     self::$authenticatedRepositories[$vcs->getUri()] = $returnValue;
     return (bool) $returnValue;
 }