From a2f5f97a9a7ca13b9f35cf661af962f8472109e0 Mon Sep 17 00:00:00 2001 From: hahn <axel.hahn@iml.unibe.ch> Date: Thu, 15 Sep 2022 14:08:36 +0200 Subject: [PATCH] add no cache on build actions (interactive+api) --- public_html/api/index.php | 2 +- public_html/deployment/classes/project.class.php | 12 ++++++------ public_html/deployment/classes/vcs.git.class.php | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/public_html/api/index.php b/public_html/api/index.php index c84e9617..d2350da1 100644 --- a/public_html/api/index.php +++ b/public_html/api/index.php @@ -216,7 +216,7 @@ $aResult=$oProject->setBranchname($sBranch); } $sBranchname=$oProject->getBranchname(); - $aRepodata = $oProject->getRemoteBranches(true); + $aRepodata = $oProject->getRemoteBranches(true); // ignore cache = true if(!isset($aRepodata[$sBranchname])){ _quit('ERROR: branch not found: '.$sBranchname, 404); } diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index ebf90df8..2bfaed7d 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 $sActiveBranchname + * @param type $getRemoteBranches * @return string|boolean */ - public function getRemoteBranches($sActiveBranchname = false) { - $this->log(__FUNCTION__ . " start"); + public function getRemoteBranches($bForceNoCache=false) { + $this->log(__FUNCTION__ . "($bForceNoCache) 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(); + return $this->_oVcs->getRemoteBranches($bForceNoCache); } return false; } @@ -1220,7 +1220,7 @@ class project extends base { * @param string $sActiveBranchname force active branch name * @return string */ - public function renderSelectRemoteBranches($sActiveBranchname = false) { + public function renderSelectRemoteBranches($sActiveBranchname = false, $bForceNoCache=false) { $aReturn = array(); $aRadios = array(); $bFoundActive = false; @@ -1237,7 +1237,7 @@ class project extends base { // the version control class does not have this method return ''; } - foreach ($this->_oVcs->getRemoteBranches() as $aBranch) { + foreach ($this->_oVcs->getRemoteBranches($bForceNoCache) as $aBranch) { $sBranch = $aBranch['name']; $aRadios[$sBranch] = array( 'value' => $sBranch, diff --git a/public_html/deployment/classes/vcs.git.class.php b/public_html/deployment/classes/vcs.git.class.php index 24c96d16..02750cbb 100644 --- a/public_html/deployment/classes/vcs.git.class.php +++ b/public_html/deployment/classes/vcs.git.class.php @@ -302,12 +302,13 @@ class vcs implements iVcs { /** * get a flat array with names of all remote branches + * @param bool $bForceNoCache flag: ignore caching; default: use cache * @return array */ - public function getRemoteBranches() { - $this->log(__FUNCTION__." start"); + public function getRemoteBranches($bForceNoCache=false) { + $this->log(__FUNCTION__."($bForceNoCache) start"); if (!$this->_aRemoteBranches) { - $this->_fetchRemoteBranches(); + $this->_fetchRemoteBranches($bForceNoCache); } return $this->_aRemoteBranches; } -- GitLab