diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index 2bfaed7d84178eaa3e2908579403a464701dfb81..578ed0ad99fbba94fe0f2f794d518993dd8dbd4b 100644 --- a/public_html/deployment/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -1198,18 +1198,18 @@ class project extends base { /** * get list of remote branches and tags - * @param type $getRemoteBranches + * @param bool $bIgnoreCache flag to ignore exiting cached data * @return string|boolean */ - public function getRemoteBranches($bForceNoCache=false) { - $this->log(__FUNCTION__ . "($bForceNoCache) start"); + public function getRemoteBranches($bIgnoreCache=false) { + $this->log(__FUNCTION__ . "($bIgnoreCache) start"); $this->_initVcs(); if ($this->_oVcs) { if (!method_exists($this->_oVcs, "getRemoteBranches")) { // the version control class does not have this method return ''; } - return $this->_oVcs->getRemoteBranches($bForceNoCache); + return $this->_oVcs->getRemoteBranches($bIgnoreCache); } return false; } @@ -1218,9 +1218,11 @@ class project extends base { } * get html form with selectr for remote branches * @param string $sActiveBranchname force active branch name + * @param bool $bIgnoreCache flag to ignore exiting cached data * @return string */ public function renderSelectRemoteBranches($sActiveBranchname = false, $bForceNoCache=false) { + $this->log(__FUNCTION__."(sActiveBranchname = $sActiveBranchname, bForceNoCache = ".($bForceNoCache ? 'true' : 'false').") start"); $aReturn = array(); $aRadios = array(); $bFoundActive = false; diff --git a/public_html/deployment/classes/vcs.git.class.php b/public_html/deployment/classes/vcs.git.class.php index 02750cbb9f39e4569bcf48072f70b01bd1b3f0b3..7f2f55844c7fa382fe09da2f74092fa26b56078f 100644 --- a/public_html/deployment/classes/vcs.git.class.php +++ b/public_html/deployment/classes/vcs.git.class.php @@ -217,11 +217,11 @@ class vcs implements iVcs { * 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 - * @param bool $bForceNoCache flag to overrde cache + * @param bool $bIgnoreCache flag to overrde cache * @return array */ - private function _fetchRemoteBranches($bForceNoCache = false) { - $this->log(__FUNCTION__."(bForceNoCache = ".($bForceNoCache ? 'true' : 'false').") start"); + private function _fetchRemoteBranches($bIgnoreCache = false) { + $this->log(__FUNCTION__."(bIgnoreCache = ".($bIgnoreCache ? 'true' : 'false').") start"); $aReturn = array(); if (!$this->getUrl()) { @@ -233,7 +233,7 @@ class vcs implements iVcs { $iRc=false; // list of cached branch keys - if ($oCache->isExpired() || $bForceNoCache) { + if ($oCache->isExpired() || $bIgnoreCache) { $sWorkdir = dirname($this->_sTempDir) . '/fetchRemoteBranches/'; $this->log(__FUNCTION__." - sWorkdir = $sWorkdir"); $sGitCmd = 'export GIT_SSH="' . $this->_sWrapper . '" ; export PKEY="' . $this->_sKeyfile . '" ; '; @@ -253,7 +253,8 @@ class vcs implements iVcs { // use cache that getCommitmessageByBranch can access it $this->_aRemoteBranches = $oCache->read(); - $this->log(__FUNCTION__ . ' data from cache: <pre>'.print_r($this->_aRemoteBranches, 1).'</pre>'); + $this->log(__FUNCTION__ . ' start reading all branches'); + // $this->log(__FUNCTION__ . ' data from cache: <pre>'.print_r($this->_aRemoteBranches, 1).'</pre>'); /** * $aOutput = Array * ( @@ -264,7 +265,7 @@ class vcs implements iVcs { */ foreach ($aOutput as $sBranchLine) { - $this->log(__FUNCTION__ . ' loop over output of git ls-remote <pre>'.print_r($sBranchLine, 1).'</pre>'); + // $this->log(__FUNCTION__ . ' loop over output of git ls-remote <pre>'.print_r($sBranchLine, 1).'</pre>'); $aTmp = explode("\t", $sBranchLine); $sBranchPath = preg_replace('#^refs/#', '', $aTmp[1]); @@ -278,7 +279,7 @@ class vcs implements iVcs { $sName = ($sType == "heads") ? "origin/" . $sBranch : $sBranch; $sBranchKey = $sName; - $this->log(__FUNCTION__ . ' $sBranchKey = '.$sBranchKey); + // $this->log(__FUNCTION__ . ' $sBranchKey = '.$sBranchKey); // $sMessage = $this->getCommitmessageByBranch($sName, $sRevision); $aReturn[$sBranchKey] = array( @@ -292,6 +293,7 @@ class vcs implements iVcs { } } $this->_aRemoteBranches = $aReturn; + $this->log(__FUNCTION__ . ' '.count($aReturn).' branches: <pre>'.print_r($this->_aRemoteBranches, 1).'</pre>'); $this->_cacheRemoteBranches(); } } else { @@ -302,13 +304,13 @@ class vcs implements iVcs { /** * get a flat array with names of all remote branches - * @param bool $bForceNoCache flag: ignore caching; default: use cache + * @param bool $bIgnoreCache flag: ignore caching; default: use cache * @return array */ - public function getRemoteBranches($bForceNoCache=false) { - $this->log(__FUNCTION__."($bForceNoCache) start"); - if (!$this->_aRemoteBranches) { - $this->_fetchRemoteBranches($bForceNoCache); + public function getRemoteBranches($bIgnoreCache=false) { + $this->log(__FUNCTION__."($bIgnoreCache) start"); + if (!$this->_aRemoteBranches || $bIgnoreCache) { + $this->_fetchRemoteBranches($bIgnoreCache); } return $this->_aRemoteBranches; } diff --git a/public_html/deployment/pages/act_build.php b/public_html/deployment/pages/act_build.php index 5da8f9d4fe8727c603c853879ff55592a13a4ada..4ed04d4a9de1426c6e6f606e3327feb26a49374e 100644 --- a/public_html/deployment/pages/act_build.php +++ b/public_html/deployment/pages/act_build.php @@ -36,7 +36,9 @@ if (!array_key_exists("confirm", $aParams)) { // ------------------------------------------------------------ $sNext = $oPrj->getNextPhase(); $aPhaseData2 = $oPrj->getPhaseInfos($sNext); - $bForceNoCache = isset($aParams['reloadBranches']) ? $aParams['reloadBranches'] : false; + $bIgnoreCache = isset($aParams['reloadBranches']) ? $aParams['reloadBranches'] : false; + + // $sOut.='<p>Re-Read Branches (ignore caching) - '.($bIgnoreCache ? "JA" : "mein" ).'</p>'; $sOut.='<p>' . sprintf(t("page-build-info"), $sNext, $sNext) . '</p>'; @@ -67,7 +69,7 @@ if (!array_key_exists("confirm", $aParams)) { <tbody> <tr> <td class=""> - ' . $oPrj->renderSelectRemoteBranches(false, $bForceNoCache) . ' + ' . $oPrj->renderSelectRemoteBranches(false, $bIgnoreCache) . ' <form action="?" method="post" enctype="multipart/form-data"> <input type="hidden" name="reloadBranches" value="1"> <input type="hidden" name="branchname" value="' . $sBranchname . '">