darcs repository management

Update dokuwiki via darcs by using the admin webinterface.

News/Changes

09.09.2005

  • tiny fixes, see rss

07.09.2005

  • darcs repository management for plugins added
  • new features like: darcs pull, darcs get, rm -r added

06.09.2005

  • darcs repository created
  • first version

Source files

lib/plugins/darcs/admin.phpreveal hidden content

lib/plugins/darcs/darcs.phpreveal hidden content

Installation (default, without darcs)

Step 1

$> wget http://darcs.erazor-zone.de/php/dokuwiki/darcs/darcs.tar.gz

Step 2

  • unpack to dokuwiki/lib/plugins
$> tar -zxf darcs.tar.gz -C dokuwiki/lib/plugins
$> rm darcs.tar.gz

Installation (with darcs)

$> cd dokuwiki/lib/plugins
$> darcs get http://darcs.erazor-zone.de/php/dokuwiki/darcs/

Update

$> darcs pull

lastest changes

ToDo

  • clean up the code
  • scan plugins for dars repositories and allow updating there too
  • add select boxes for each patch to apply

Comments

Great idea! Do you think it would be possible to link this to plugins as well as Dokuwiki repository, allowing plugins to be installed and updated via Darcs?

FYI - this plugin can be installed by pasting the source URL into the Plugin Manager's URL field and clicking download.
Chris Smith 2005-09-06

Yeah, i'll implement something like this in the next release but i think its better to create a table like:

Plugin Aviable Patches delete update
XXX 4 details
XXX 3 details

And another field for installing new plugins:

  • Install a new plugin using darcs:
    darcs get

I'm not quite sure how to test for darcs repositories maybe i'll use something like is_dir($plugin.'/_darcs');

Is it worth trying to merge that with the plugin manager plugin? Perhaps carrying out a test to see if darcs is available on the server and then offering darcs install and darcs update options (for those plugins installed by darcs)? The plugin manager writes a small file with its data, manager.dat, in each plugin folder. You could store information in that or do the check you propose.— Chris Smith 2005-09-07

Well, i've no opinion about that but using 2 different plugins seems to be the better way, or maybe we should create 2 different classes with the same functions, one only using darcs calls and one with php-only stuff. That would make it possible to use both ways with the plugin manager. Anayway, i'm quite unsatisfied with my plugin, it's just crap - scripting with darcs is a pain in the a** and as far as i know there arent any return values even. I think using darcs for scripting isn't a good idea at this point - i hope they will add some more xml outputs like the one of the changes option. Perhaps managing the repository without darcs would be better (fetching patches and generating a patch list) but thats simply to much work. Another thing that bothers me is the way output is generated in dokuwiki plugins - i don't really wanna care about html, thats why i worked mostly with the parser but something like templates for wiki-pages would be great, smarty for example.

Plugin manager is constructed in two parts. The admin plugin class (which does very little except decide what to do) and the ap_manage classes which handle each command/function. Having two extra classes to handle two new commands shouldn't be too bad. I don't mind managing updates by darcs, emerge or whatever - if someone is willing to write the code to handle it :-). I can't agree with you on smarty, it does very little that you can't do just as simply in php. You could use try a localised wiki markup 'template' with embedded <php> tags, making sure the plugin turns on $conf['phpok'] before calling p_locale_xhtml() to render the template. — Chris Smith 2005-09-07

Hi again, would you care to put up some notes on how to set up a darcs repository for a plugin :-) Chris Smith 2005-09-07

Check out if this fits your needs: working with dokuwiki plugins using darcs

BTW: I added the source plugin to darcs too: http://dev.erazor-zone.de/darcsweb.cgi?r=php/dokuwiki/source;a=summary

Yes, very useful, thanks. I have managed to setup a local repo but I am struggling with a higher bandwidth repo via ftp.
Do you mind if I create a page for this plugin at splitbrain and move the link here to that page. Then on that page people can discuss this plugin and also add the locations of their plugin's darcs repositories. — Chris Smith 2005-09-13

I thought about that too and i would welcome it cos this page should only provide some hints what this plugin is about and how to install it. I think large discussions are a bit confusing so moving discussions to splitbrain would be better.

Concerning the other darcs locations, well there should be a way to parse the output of that wiki page to add a list of “known plugins” to the darcs get section. A simple .txt file would be the easiest way, but i think using do=export_html should work too.


I had an opportunity to try installing a plugin using this plugin today. It failed. The new plugin directory was created but nothing was inside and I received no messages from the plugin. If I SSH on to the server and I can install the plugin using darcs get <sameurl>. Once the plugin is installed the darcs plugin applies patches ok. (page with darcs repo links)— Chris Smith 2005-09-25

Maybe wrong permissions of the plugin directory?
I've installed the folded plugin using darcs without errors.

No, not that. Plugin manager installs plugins without any problems.

Strange, whats the name of that plugin?

I tried it on both Code and Definition List. Definition List I installed using darcs from the command line - and was able to patch via the darcs plugin (Code was installed by plugin manager).

Try to install http://darcs.erazor-zone.de/php/dokuwiki/darcs/test/ via the darcs-plugin - works perfectly here.

Same thing happened, but this time I noticed why it failed - the new plugin directory was created without the 'x' flag (i.e. drw.rw.rw.). I tracked it down to the installation using the standard dokuwiki config settings for umask, '0111'. If I change that to '0000' the plugin installs ok. I am not sure why dokuwiki has its umask and dmask settings, I followed the same strategy used in inc/io.php io_makeFileDir() for the plugin manager - that is, set umask to conf[dmask], make the directory, set umask back to umask. It maybe wise to do something similar around your call to exec() or add a note in the plugin's documentation. — Chris Smith 2005-09-28

This doesn't seem to work when an http proxy is required even when I've got http_proxy defined in the environment. >(ubuntu linux). Darcs itself will work from bash when I sudo, but this plugin seems to hang. Has anyone added proxy >support to this plugin? — Josh Fuller 2006-01-05

Try to use something like this:

  var $darcs_bin='export http_proxy=http://123.123.123.123:12345; /usr/bin/darcs';

I used a simple php call and that worked:

<?php
 
exec('export TEST=123; echo $TEST',&$stdout,&$retval);
print_r($stdout);
?>
erazor@E-Razor ~ $ php test.php 
Array
(
    [0] => 123
)

Hi Alex, you did a great work with this plugin.

Thanks ;-)

Since I want to use it on my homepage and I got only webspace, but no root acess, I copied the darcs binary into the file structure of DokuWiki – in this case, I chose the plugin's directory.

Consider the use of a static-linked binary.

Now I had the problem to inform darcs plugin where to look for the binary. I solved this by adding a constructor function in darcs.php. Just in case anybody else faces this problem and does not know how to solve:
function Darcs_Repository()
{
  $this->darcs_bin = dirname(__FILE__) . '/darcs';
}

it's a good idea to use a constructor for this assignment but maybe it's better to define a new function and add it's decleration to the end of the file - that would result in a better patch compatibility.

A bit of a overkill, but I am not allowed to use the '.' operator in a variable declaration line... :-(
And I am not sure what happens when there is a new version of darcs.php vailable via darcs ;-) Maybe the best idea is to use $conf['darcs_bin']='...'; in a separate file.

Yeah, but then you've to add the relative path to

dirname(__FILE__)

I'll take care of this as soon as i've some free minutes.

Werner Flamme 2006-09-24


Alex, there is an “optical glitch” in the plugin. When there are some plugins installed via darcs plugin, the changes to the plugins are shown in the uppermost table – the table that is dedicated to DokuWiki's changes. In the “plugin patch overview” table, I see the numer of patches for the respective plugins, but they are listed in the first table. Pressing the “Apply” button does not apply the patches, I have to use the button in the plugins table, though they are listet far above... Is there a possibility to have them not appear up there? — Werner Flamme 2008-02-25 09:07 CEST

I'll fix it as soon i got the time. There are also a lot of other fixes planed for the latex and graphviz plugin. BTW, whats your state concerning the darcs binary? Does it work?


Hello, I have installed this plugin, and on it's page it says that the dokuwiki repository is up to date. So does it means that my Dokuwiki is updated? Will it be automaticlly updated when a new version of dokuwiki is released? Thank you.

 
wiki/projects/php/dokuwiki/plugins/darcs.txt · Last modified: 2008/07/24 04:24 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki