[dokuwiki] Re: DMS: organize external material

Hello,

i think i currently do what you want.
I use dokuwiki for our admins. They need to store informaiton (wiki- pages) together with data (programs, PDFs, configs, etc.). Therefore i "exported" the media-directory of dokuwiki using samba and netatalk, so admins can access this from PC or Mac. I found data/media the best, because it did not contain the wikipages source to interfere with.

The only drawback was the fact, that media directories are created upon their first use, not as the corresponding pages-namespace directory is created.
To get around this i wrote a small plugin and called it "mediadir".
I attached the plugins action.php to this mail, if you like to use it. To install it, just create a subdir lib/plugins/mediadir and put action.php inside. Nothing to configure.

Oliver
<?php

/**
 * Dokuwiki Action Plugin: Mediadir
 *
 * @author Oliver Geisen <oliver.geisen@xxxxxxxxxxxx>
 */

if(!defined('DOKU_INC')) die();
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');

class action_plugin_mediadir extends DokuWiki_Action_Plugin {

    /**
     * return some info
     */
    function getInfo(){
        return array(
            'author' => 'Oliver Geisen',
            'email'  => 'oliver.geisen@xxxxxxxxxxxx',
            'date'   => '2008-08-11',
            'name'   => 'Creates/Deletes media directories analog to 
namespaces',
            'desc'   => 'Syncs directories of page-namespace with media dir',
            'url'    => 
'http://update.kreisbote.de/dokuwiki/plugins/mediadir/mediadir.zip',
        );
    }

    /**
     * Register its handlers with the dokuwiki's event controller
     */
    function register(&$controller) {
        $controller->register_hook('IO_NAMESPACE_CREATED', 'AFTER', $this, 
'createMediaDir');
    }

    function createMediaDir(&$event, $param) {
        $id = getID();
        # io_createNamespace uses dirmode of $conf['dmode'] for new directories
        io_createNamespace($id, 'media');
    }

}

?>

Other related posts: