NAME

CGI::Wiki::Simple::Setup - Set up the wiki and fill content into some basic pages.

DESCRIPTION

This is a simple utility module that given a database sets up a complete wiki within it.

SYNOPSIS

setup( dbtype => 'sqlite', dbname => "mywiki.db" );
# This sets up a SQLite wiki within the file mywiki.db

setup( dbtype => 'mysql', dbname => "wiki", dbuser => "wiki", dbpass => "secret", file => 'nodeball.txt' );
# This sets up a MySQL wiki and loads the nodes from the file nodeball.txt

get_store %ARGS

get_store creates a store from a hash of parameters. There are two mandatory parameters :

dbtype => 'mysql'

This is the type of the database. Recognized values are mysql, sqlite and pg.

dbname => 'wiki'

This is the name of the database.

The remaining parameters are optional :

dbuser => 'wikiuser'

The database user

dbpass => 'secret'

The password for the database

setup => 1

Create the database unless it exists already

clear => 1

Wipe all nodes from the database before reinitializing it. Only valid if setup is also true.

check => 1

Check that a node called index exists. This raises an error if the database exists but is empty.

setup %ARGS

Creates a new database and initializes it. Takes the same parameters as get_store and two additional optional parameters :

nocontent => 1

Prevents loading the three default nodes from the module into the wiki.

force => 1

Overwrites nodes with the loaded content even if they already exists.

setup_if_needed %ARGS

Creates a new database and initializes it if no current database is found. Takes the same arguments as setup

load_nodeball

Loads a nodeball into the wiki. A nodeball is a set of nodes in a text file like this :

__NODE__
Title: TestNode

This is a test node. It
consists of content that will be formatted through the
wiki formatter.

__NODE__
Title: AnotherTestNode

You know it.

The routine takes the following parameters additional to the usual database parameters :

fh => \*FILE

Loads the nodeball from the filehandle FILE.

file => 'nodeball.txt'

Loads the nodeball from the specified file.

commit_content %ARGS

Loads a set of nodes into the wiki database. Takes the following parameters :

wiki => $wiki

An initialized CGI::Wiki.

force => 1

Force overwriting existing nodes

silent => 1

Do not print out normal messages. Warnings still get raised.

nodes => \@NODES

A reference to an array of hash references. Each element should have the following structure :

{ title => 'A node title', content => 'Some content' }

COPYRIGHT

Copyright (C) 2003 Max Maischein.  All Rights Reserved.

This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

CGI::Wiki, CGI::Wiki::Simple