Question

I want to run a dokuwiki.org on my server. I'm using the file-based setting so there's no external database involved.

I want to setup a git repository with contains dokuwiki's data directory so multiple committers are able to work offline and push the changes back when they are done. The data directory in the git repository is no big deal, you can set the location of the data directory using dokuwiki's config-files.

I used this guide to set everything up and it's working as expected.

tl;dr of the guide:

  • setup bare repo
  • post-receive hook on the bare repo to navigate to the htdocs directory and checkout the changes from the bare repo.
  • you push something to the repo, and the htdocs directory automatically checksout the changes from the repo.

So the guide is only useful if you are using it for a static site or something database based.

My problem is that the www directory is changed everytime someone edits something via the web-based wiki and not the files in their local repository -> the changes don't get pushed back to the bare repository because there's no hook/way/...to do that.

Is there anything i'm missing here or a better way to handle this usecase?

Was it helpful?

Solution

There is a fairly new plugin which does exactly what you need: gitbackend. It also supports pulling into the live repo.

It is not apparent from your description, but in case you plan to "only" change what's in data/pages and data/media, you would be missing the changes to the meta data. That means that several commits would only appear as a single revision on the old revisions of a page and other data like commit messages / change summary would be missing.

The aforementioned plugin hasn't implemented the meta data changes either, but could do it internally. If you'd rather like to write a script which does something externally, you might want to hook into the XML-RPC API.

OTHER TIPS

The only thing coming to my mind is to have the website be a repository itself (call it the www repo), and people pull from it before the developers pushes. You can use the git plugin to commit changes that happened on the website.

This has drawbacks because you have to change how you set up hooks. Basically when someone pushes to the bare repository you'll have to check in your hook that last modifications made via the web-interface has been committed to www repo (which means that its working tree is clean), and that the commits being pushed contain them (i.e. they have pulled from the website repo). If yes, then the hook of your bare repository pushes the new commits to the www repo.

However I have no idea if this is feasible, and what quality the git plugin is. But I don't see anything else to make Git work with external modifications that are not commits.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top