diff --git a/newEmptyPHP.php b/newEmptyPHP.php deleted file mode 100644 index fb9e0c3df3f9df03a4d95c24d7787e3ecad6f4e5..0000000000000000000000000000000000000000 --- a/newEmptyPHP.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - diff --git a/public_html/deployment/classes/formgen.class.php b/public_html/deployment/classes/formgen.class.php index de7c26f19183bbacf7aa5ab125c798962d9b866b..03b879b96410e671bc33c3fc28ef5f54adc3f786 100644 --- a/public_html/deployment/classes/formgen.class.php +++ b/public_html/deployment/classes/formgen.class.php @@ -212,7 +212,7 @@ class formgen { $s = preg_replace('/\W/iu', '', $sId . $idOption); $sOptionId = preg_replace('/[äöüß]/i', '', $s); $sFormElement.=' <option value="' . $idOption . '" '; - $sFormElement.=$this->_addHtmlAtrributes(explode(",", "$sDefaultAttributes"), $aOptionData); + $sFormElement.=$this->_addHtmlAtrributes(explode(",", "$sDefaultAttributes,selected"), $aOptionData); $sFormElement.='>' . $aOptionData["label"] . '</option>' . "\n"; } $sFormElement.="</select>\n"; diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index aab3c19d01054cdb2a5417cd43fa120417803c1d..41648ed44cdbc8743e15ca109dc7da9cb41073a4 100644 --- a/public_html/deployment/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -169,6 +169,8 @@ class project { } // ob_end_flush(); + // stderr ausgeben + $sCommand.=' 2>&1'; $sReturn.="[" . date("H:i:s d.m.Y") . "] "; $sReturn.=$bUseHtml ? "<strong>$sCommand</strong>" : "$sCommand"; $sReturn.=$bUseHtml ? "<br>" : "\n"; @@ -848,9 +850,11 @@ class project { // the version control class does not have this method return ''; } - foreach ($this->_oVcs->getRemoteBranches() as $sBranch) { + foreach ($this->_oVcs->getRemoteBranches() as $aBranch) { + $sBranch=$aBranch['name']; $aRadios[$sBranch] = array( - 'label' => $sBranch, + 'value' => $sBranch, + 'label' => $aBranch['label'], ); // if no param was given the first branch will be marked if (!$sActiveBranchname) { @@ -858,7 +862,8 @@ class project { } if ($sBranch == $sActiveBranchname) { $bFoundActive = true; - $aRadios[$sBranch]['checked'] = 'checked'; + // $aRadios[$sBranch]['checked'] = 'checked'; + $aRadios[$sBranch]['selected'] = 'selected'; } else { $aRadios[$sBranch]['onclick'] = 'document.getElementById(\'submitBranch\').click()'; } @@ -879,7 +884,8 @@ class project { 'validate' => array(), 'form' => array( 'branchname' => array( - 'type' => 'radio', + 'inline' => true, + 'type' => 'select', 'name' => 'branchname', 'label' => '<strong>' . t('branch-select') . '</strong>', 'validate' => 'isastring', diff --git a/public_html/deployment/classes/vcs.git.class.php b/public_html/deployment/classes/vcs.git.class.php index c1cb451a28b3ba99ec33defcbd236b8575fa6f13..5ea7864a1bd32188cf110ac044b36cc8640a4df6 100644 --- a/public_html/deployment/classes/vcs.git.class.php +++ b/public_html/deployment/classes/vcs.git.class.php @@ -80,7 +80,7 @@ class vcs implements iVcs { // set config array $this->_aCfg = $aRepoConfig; - + // define temp dir $this->_sTempDir = $this->_aCfg["url"]; $this->_sTempDir = preg_replace('/[\@\.\:\/]/', '_', $this->_sTempDir); @@ -96,8 +96,9 @@ class vcs implements iVcs { * @param string $sBranchname name of the branch */ public function setCurrentBranch($sBranchname) { - return $this->_sCurrentBranch=$sBranchname; + return $this->_sCurrentBranch = $sBranchname; } + /** * helper: dump values * @return boolean @@ -122,7 +123,7 @@ class vcs implements iVcs { @unlink($sWorkDir . "/.gitignore"); return true; } - + /** * get the current branch * @param string $sBranchname name of the branch @@ -140,13 +141,15 @@ class vcs implements iVcs { } /** - * read remote repository and get a flat array with names of all branches + * read remote repository and get an array with names and revisions of + * all branches and tags + * pre branch you get an array element with the keys revision, name, type * @return array */ private function _fetchRemoteBranches() { $aReturn = array(); $sGitCmd = 'export GIT_SSH="' . $this->_sWrapper . '" ; export PKEY="' . $this->_sKeyfile . '" ; '; - if (!$this->getUrl()){ + if (!$this->getUrl()) { return false; } if (!file_exists($this->_sTempDir . ".git")) { @@ -156,12 +159,28 @@ class vcs implements iVcs { } else { $sGitCmd.='cd "' . $this->_sTempDir . '" && '; } - $sGitCmd.='git branch -r ; '; + // $sGitCmd.='git branch -r ; '; + $sGitCmd.='git ls-remote --heads origin; git ls-remote --tags origin'; exec($sGitCmd, $aOutput, $iRc); if ($iRc == 0) { foreach ($aOutput as $sBranch) { - // $aReturn[] = str_replace("origin/", "", trim($sBranch)); - $aReturn[] = trim($sBranch); + $aTmp = explode("\t", $sBranch); + + $aBranch = explode("/", $aTmp[1]); + + $sBranch = array_pop($aBranch); + $sType = array_pop($aBranch); + if ($sType == "heads") { + $sBranch = "origin/" . $sBranch; + } + + $aReturn[] = array( + // 'debug'=> $aTmp, + 'revision' => $aTmp[0], + 'name' => $sBranch, + 'label' => $sType . ': ' . $sBranch, + 'type' => $sType + ); } } $this->_aRemoteBranches = $aReturn; @@ -208,7 +227,7 @@ class vcs implements iVcs { public function getRevision($sWorkDir = false) { $aReturn = array(); $sGitCmd = 'export GIT_SSH="' . $this->_sWrapper . '" ; export PKEY="' . $this->_sKeyfile . '" ; '; - if (!$this->getUrl()){ + if (!$this->getUrl()) { return false; } @@ -222,7 +241,7 @@ class vcs implements iVcs { } else { $sGitCmd.='cd "' . $this->_sTempDir . '" && '; } - $sGitCmd.='git fetch --update-head-ok --depth 1 2>&1 && '; + $sGitCmd.='git fetch --update-head-ok --tags --depth 1 2>&1 && '; } $sGitCmd.='git log -1 "' . $this->_sCurrentBranch . '" ; '; @@ -244,7 +263,7 @@ class vcs implements iVcs { $sLoginfo = $sGitCmd; } $aReturn = array( - "error" => '<pre>'.$sLoginfo.'<hr>'.$sGitCmd.'</pre>' + "error" => '<pre>' . $sLoginfo . '<hr>' . $sGitCmd . '</pre>' ); } return $aReturn; @@ -258,16 +277,15 @@ class vcs implements iVcs { if (!$sWorkDir || !is_dir($sWorkDir)) { return false; } - if (!$this->getUrl()){ + if (!$this->getUrl()) { return false; } - $sBranchname=$this->_sCurrentBranch; - $sBranchname=str_replace("origin/", "", $sBranchname); - + $sBranchname = str_replace("origin/", "", $this->_sCurrentBranch); + $sGitCmd = 'export GIT_SSH="' . $this->_sWrapper . '" ; export PKEY="' . $this->_sKeyfile . '" ; '; $sGitCmd .= 'echo git clone --depth 1 --recursive --branch "' . $sBranchname . '" "' . $this->getUrl() . '" "' . $sWorkDir . '" ; '; $sGitCmd .= 'git clone --depth 1 --recursive --branch "' . $sBranchname . '" "' . $this->getUrl() . '" "' . $sWorkDir . '" 2>&1; '; - $sReturn=shell_exec($sGitCmd); + $sReturn = shell_exec($sGitCmd); return $sReturn; }