NAME

Konstrukt::Plugin::wiki::backend::article::DBI - Article backend driver for storage inside a database that can be accessed through DBI.

SYNOPSIS

        my $article_backend = use_plugin 'Konstrukt::Plugin::wiki::backend::article::DBI' or die;
        $article_backend->do_stuff(); #see the methods description
        

DESCRIPTION

This article backend implements the storage in a database that will be accessed through perl DBI.

Actually this one was implemented using a MySQL database. But as the queries don't use special MySQL-functions it is very likely that it will run on other databases without modification.

CONFIGURATION

You have to create the table wiki_article, which will be used to store the data. You may turn on the install setting (see "CONFIGURATION" in Konstrukt::Handler) or use the KonstruktBackendInitialization.pl script to accomplish this task.

Furtheron you have to define those settings to use this backend:

        #backend
        wiki/backend_type       DBI
        wiki/backend/DBI/source dbi:mysql:database:host
        wiki/backend/DBI/user   user
        wiki/backend/DBI/pass   pass

If no database settings are set the defaults from "CONFIGURATION" in Konstrukt::DBI will be used.

METHODS

new

init

Initialization of this class. Loads the settings.

install

Installs the backend (e.g. create tables).

Parameters:

none

exists

This method will return true, if a specified article exists. It will return undef otherwise.

Parameters:

  • $title - The title of the article

  • $revision - Optional: A specific revision of an article

revision

This method will return the latest revision number/number of revisions of a specified article. It will return undef if the specified article does not exist.

Parameters:

  • $title - The title of the article

revisions

This method will return all revisions of the specified article as an array of hash references ordered by ascending revision numbers:

        [
                { revision => 1, author => 'foo', host => '123.123.123.123', year => 2005, month => 1, day => 1, hour => 0, => minute => 0 },
                { revision => 2, ...},
                ...
        ]
        

Will return undef, if the file doesn't exist.

Parameters:

  • $title - The title of the article

get

This method will return the article as a hashref:

                { revision => 1, content => '= wiki stuff', author => 'foo', host => '123.123.123.123', year => 2005, month => 1, day => 1, hour => 0, => minute => 0 },

Will return undef, if the requested article doesn't exist.

Parameters:

  • $title - The title of the article

  • $revision - Optional: A specific revision of an article. When not specified, the latest revision will be returned.

store

This method will add a new article (or new revision if the article already exists) to the store.

Will return true on success and undef otherwise.

Parameters:

  • $title - The title of the article

  • $content - The content that should be stored

  • $author - User id of the creator

  • $host - Internet address of the creator

AUTHOR

Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.

This document is free software. It is distributed under the same terms as Perl itself.

SEE ALSO

Konstrukt::Plugin, Konstrukt::Plugin, Konstrukt