['pipe', 'w'], 2 => ['pipe', 'w']]; $pipes = []; // Using --git-dir rather than --absolute-git-dir for a wider git versions compatibility //$command = Git::getBin()." rev-parse --absolute-git-dir"; $command = Git::getBin() . " rev-parse --git-dir"; //dbglog("GitBacked - Command: ".$command); $resource = proc_open($command, $descriptorspec, $pipes, $path); $stdout = stream_get_contents($pipes[1]); stream_get_contents($pipes[2]); foreach ($pipes as $pipe) { fclose($pipe); } $status = trim(proc_close($resource)); if ($status == 0) { $repo_git_dir = trim($stdout); //dbglog("GitBacked - $command: '".$repo_git_dir."'"); if (!empty($repo_git_dir)) { if (strcmp($repo_git_dir, ".git") === 0) { // convert to absolute path based on this command execution directory $repo_git_dir = $path . '/' . $repo_git_dir; } $repo_path = dirname(realpath($repo_git_dir)); $doku_inc_path = dirname(realpath(DOKU_INC)); if (strlen($repo_path) < strlen($doku_inc_path)) { // This code should never be reached! // If we get here, then we are beyond DOKU_INC - so this not supposed to be for us! return ''; } //dbglog('GitBacked - $repo_path: '.$repo_path); if (file_exists($repo_path . "/.git") && is_dir($repo_path . "/.git")) { return $repo_path; } } } return ''; } } /* End of file */