dokuwiki-plugin-gitbacked icon indicating copy to clipboard operation
dokuwiki-plugin-gitbacked copied to clipboard

Detect Whether RepoPath is an Absolute Path

Open sjv0 opened this issue 3 years ago • 2 comments
trafficstars

As requested by @woolfg in #78, creating a new issue for this.

If the repoPath configuration string is an absolute path, don't prepend DokuWiki's savedir to it.

One way this could be achieved is by changing:

    private function initRepo() {
        //get path to the repo root (by default DokuWiki's savedir)
        if(defined('DOKU_FARM')) {
            $repoPath = $this->getConf('repoPath');
        } else {
            $repoPath = DOKU_INC.$this->getConf('repoPath');
        }

to:

    private function initRepo() {
        //get path to the repo root (by default DokuWiki's savedir)
        $repoPath = $this->getConf('repoPath');
        if(!defined('DOKU_FARM') && $repoPath[0] !== '/') {
            $repoPath = DOKU_INC.$this->getConf('repoPath');
        }

I have tested the above change and it works with both absolute and relative paths. I'm submitting this as an issue instead of as a pull request because I've never written PHP before and I'm not familiar with the dokuwiki or gitbacked plugin codebases.

sjv0 avatar Aug 12 '22 06:08 sjv0

thanks @sjv0, as you already changed the code, you could als send a pull request. we can work together on it in case there is something missing.

woolfg avatar Aug 12 '22 08:08 woolfg

OK pull request created. Hope I did it correctly - I haven't done it before.

sjv0 avatar Aug 12 '22 08:08 sjv0

repoworkdir also needs to be changed in the same way.

wom-bat avatar Nov 28 '22 02:11 wom-bat

@wom-bat Many thanks for this hint - yes this is understood already.

mhoffrog avatar Nov 30 '22 22:11 mhoffrog