UsingWikipediafs

From NikiWiki
Jump to: navigation, search

How to use wikipediafs together with netlabs wiki

This article describes how it is possible to use wikipediafs to edit content on the Netlabs wiki.

Installing wikipediafs

Wikipediafs is a userspace filesystem that uses the fuse module available in Linux to mount the wiki. Thus you need to have this module installed on your system. The following command tells you if it is installed:

lsmod | grep fuse

On my system I got the following result:

TP42:/mnt/wiki/wiki.netlabs.org# lsmod | grep fuse
fuse                   36108  2 

On top of that python and python-fuse are needed. If you are using Debian you can install all packages necessary with apt-get. Otherwise you can grab wikipediafs from its homepage.

Now you need to create a directory where the wikis will be mounted to:

mkdir /mnt/wiki

This will create the directory wiki in mount directory.

Configuring wikipediafs

On the first run wikipediafs will copy its configuration file to the user's home directory. As the access to the fuse commands is only permitted for superusers start wikipediafs as root. Note that the last parameter has to be the point where the wikipediafs should mount.

TP42:~/.wikipediafs# mount.wikipediafs /mnt/wiki/

In case everything worked no messages are printed. Otherwise there are a lot of error messages printed, indicating what the problem was.

Now you have to unmount the directory again.

umount /mnt/wiki

The next step is to update the config.xml in the .wikipediafs directory of root's home.

Add a section that looks like the following:

    <site>
        <dirname>wiki.netlabs.org</dirname>
        <host>wiki.netlabs.org</host>
        <basename>/index.php</basename>
        <username>Username</username>
        <password>secret</password>
    </site>

My config.xml looks as follows:

<wfs-config>
    <general>
        <article-cache-time>300</article-cache-time>
    </general>
    <sites>
        <site>
            <dirname>wiki.netlabs.org</dirname>
            <host>wiki.netlabs.org</host>
            <basename>/index.php</basename>
            <username>Username</username>
            <password>secret</password>
        </site>
    </sites>
</wfs-config>

If the username and password tags are left out it is only possible to download content, but not to submit content.

Using wikipediafs

First it is needed to mount the wiki again.

mount.wikipediafs /mnt/wiki

Now there will be a directory /mnt/wiki/wiki.netlabs.org/. It will be empty as there is no directory listing.

Note: You have to switch off the option 'Show preview on first edit' in preferences>Editing. Otherwise submitting content will not work.

Editing files

The file has to exist on the server. To edit a page called 'Ideas' the file has to be loaded from the server first. Use cat for instance to do that:

TP42:/mnt/wiki/wiki.netlabs.org# cat Ideas
This is the content of the page called Ideas... [..]

The directory should contain a file named Ideas by now. It can by edited with any text editor. When the file is saved it is posted to the server.

Creating and Copying files

To add an entry to the wiki create a local file with the wiki syntax. After that just use the cp command for instance:

TP42:/mnt/wiki/wiki.netlabs.org# cp /home/moritz/UsingWikipediafs .

This will upload the file /home/moritz/UsingWikipediafs to the root directory the wiki.