X-Git-Url: http://git.pk910.de/?p=GITManagedWebpage.git;a=blobdiff_plain;f=GITManagedWebpage.class.php;h=3f6ba4aae7772b0ee2d943f53ea4eaa9d57daf94;hp=0522cc8ea39ac14b08691be4753000d503ef912a;hb=05088f3fd28b5492259807cd06637980b5ea49b7;hpb=544c09a8193efa6a76865150797bec1bd4fba1c1 diff --git a/GITManagedWebpage.class.php b/GITManagedWebpage.class.php index 0522cc8..3f6ba4a 100644 --- a/GITManagedWebpage.class.php +++ b/GITManagedWebpage.class.php @@ -164,6 +164,14 @@ class GITManagedWebpage { $this->error(self::ERROR_CRITICAL, "error cloning git repository."); return; } + + $fp = fopen($this->workdir.'.htaccess'); + fwrite($fp, ' +Order deny,allow +Deny from all +'); + fclose($fp); + $this->ready = true; $default_branch = str_replace(array("\r", "\n"), array("", ""), $this->gitcmd("rev-parse", "--abbrev-ref", "HEAD")); @@ -243,9 +251,8 @@ class GITManagedWebpage { if(substr($path, -1) != '/') $path .= '/'; $current_branch = str_replace(array("\r", "\n"), array("", ""), $this->gitcmd("rev-parse", "--abbrev-ref", "HEAD")); - if($current_branch != $branch) - $this->gitcmd("checkout", $branch); - $this->gitcmd("pull"); + $this->gitcmd("fetch"); + $this->gitcmd("reset", "--hard", "origin/".$branch); $gitret = $this->gitcmd("rev-list", "--max-count=1", $branch); preg_match("#([a-z0-9]{40})#", $gitret, $match); $newest_version = $match[1]; @@ -302,6 +309,7 @@ class GITManagedWebpage { return; if(!$this->branchExists($branch)) { + $this->gitcmd("fetch"); if(!$this->branchExists('origin/'.$branch)) return false; } @@ -326,7 +334,7 @@ class GITManagedWebpage { $default_branch = $this->getConfig("defaultbranch"); $active_branch = $this->getActiveBranch(); if($active_branch != $default_branch) { - if(!($dir = $this->localBranchPath($branch))) { + if(!($dir = $this->localBranchPath($active_branch))) { $dir = $this->localBranchPath($active_branch, true); $this->updateBranch($active_branch, $dir, true); }