The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Konstrukt::Plugin::blog::DBI - Konstrukt blogging DBI backend

SYNOPSIS

        #TODO
        

DESCRIPTION

Konstrukt blogging DBI Backend driver.

CONFIGURATION

Note that you have to create the tables blog_entry and blog_comment. You may turn on the install setting (see "CONFIGURATION" in Konstrukt::Handler) or use the KonstruktBackendInitialization.pl script to accomplish this task.

You may define the source of this backend:

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

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

METHODS

init

Initialization of this class

install

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

Parameters:

none

add_entry

Adds a new blog entry and returns its ID.

Parameters:

  • $title - The title of this entry

  • $description - A short abstract of this entry

  • $content - The entry's content (usually wiki "source code")

  • $author - The entry's author

  • $private - Is this entry only visible to the author?

update_entry

Updates an existing blog entry.

Parameters:

  • $id - The id of the entry, which should be updated

  • $title - The title of this entry

  • $description - A short abstract of this entry

  • $content - The entry's content

  • $private - Is this entry only visible to the author?

  • $update - Update the publication date to "now"

get_entry

Returns the requested blog entry as an hash reference with the keys id, title, description, content, author, year, month, day, hour, minute, private, comment_count and trackback_count.

Returns undef if the entry does not exist.

Parameters:

  • $id - The id of the entry

get_entries_count

Returns the count of the entries.

get_entries

Returns the blog entries as an array reference of hash references: { id => .., title => .., description => .., content => .., author => .., year => .., month => .., day => .., hour => .., minute => .., private => .., comment_count => .., trackback_count => .. }

Parameters:

  • $select = { tags => "tag query string", id => 23, author => 42, year => 1234, month => 5, day => 23, text => fulltext } (optional). This argument is OPTIONAL. If not passed, all entries will be retrieved. It is an hash reference which determines which entries will be retrieved. For each set hash-key only the matching entries will be returned Note that these options are "and"-linked. The tag query string is passed to the "get_entries" in Konstrukt::Plugin::tags method.

  • $start - The first entry to display. starts with 0

  • $count - The number of entries to display

delete_entry

Removes an existing blog entry.

Parameters:

  • $id - The id of the entry, which should be removed

get_authors

Returns the user IDs of all blog authors as an array reference: [5, 7, 1, 6]

get_comment

Returns the comments with the specified id as an hash reference: { id => .., entry => .., user => .., author => .., text => .., email => .., email_public => .., email_notify => .., year => .., month => .., day => .., hour => .., minute => .. }

Parameters:

  • $id - The comment's id

get_comments

Returns the comments of a specified blog entry as an array reference of hash references: { id => .., entry => .., user => .., author => .., text => .., email => .., email_public => .., email_notify => .., year => .., month => .., day => .., hour => .., minute => .. }

The entries should be ordered by ascending date (earliest post first).

Parameters:

  • $id - The entry's id

add_comment

Adds a new comment.

Parameters:

  • $id - The ID of the article where this comment belongs to.

  • $userid - The user ID of the author, if registered.

  • $author - The comment's author.

  • $email - Author's email address.

  • $email_public - Shall the email address be published?

  • $email_notify - Shall the comment's author's get a notification on new comments?

  • $text - The comment itself.

delete_comment

Deletes an existing comment.

Parameters:

  • $id - The id of the comment, which should be removed

get_trackback

Returns the trackback with the specified id as an hash reference: { id => .., entry => .., url => .., title => .., excerpt => .., blog_name => .., year => .., month => .., day => .., hour => .., minute => .. }

Parameters:

  • $id - The trackback's id

get_trackbacks

Returns the trackbacks of a specified blog entry as an array reference of hash references: { id => .., entry => .., url => .., title => .., excerpt => .., blog_name =>.., year => .., month => .., day => .., hour => .., minute => .. }

The entries should be ordered by ascending date (earliest post first).

Parameters:

  • $id - The entry's id

add_trackback

Adds a new trackback. Or replace it, if a trackback with that url already exists.

Parameters:

  • $article - The ID of the article where this trackback belongs to.

  • $url - The URL of the pinging article (required).

  • $title - The title of the pinging article (optional).

  • $excerpt - An excerpt of the pinging article (optional).

  • $blog_name - The name of the pinging blog (optional).

delete_trackback

Deletes an existing trackback.

Parameters:

  • $id - The id of the trackback entry, which should be removed

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::blog, Konstrukt