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

NAME

WE::DB::Content - the content database for the web.editor

SYNOPSIS

    $content_db = new WE::DB::Content($root, $content_db_directory);

DESCRIPTION

The content database contains the real contents (HTML, text, images) of the objects in the object database.

CONSTRUCTOR WE::DB::Content->new($root, $directory);

The Content database is usually created in the WE::DB object.

METHODS

init

Initializes the content database. This means that the directory holding the content files is created.

store($objid, $content)

Store the $content (which is a string) for object with id $objid. Dies on failure. Existing content is not overwritten in case of errors.

get_content($objid)

Get the content for object with id $objid. The content is returned as a string.

remove($objid)

Remove the content for object with id $objid.

copy($from_objid, $to_objid)

Copy the content from $from_objid to $to_objid. This may be implemented efficiently using OS copy. Dies on failure.

filename($objid)

Return the absolute filename for the object with id $objid (or supply the WE::Obj). Usually, the content should not be accessed directly. But we are Perl, so it is possible nevertheless.

extension($obj)

Return the extension of the supplied WE::Obj object.

get_mime_type_by_filename($filename)

Return the MIME type (e.g. text/plain) of the supplied file.

delete_db_contents

Delete all database contents

search_fulltext($term, %args)

Search the term in the content database and return a list of object ids. Further options are:

-scope => $id

Id of the scope for the search.

-lang => $lang

Restrict search to the specified language. Otherwise all languages are used. NYI.

-casesensitive => $bool

True, if the search should be case sensitive.

-regexp => $bool

True, if the search term is a regular expression.

search_fulltext_in_object($obj, $term)

Search $term (treated as a regular expression) in the content database recusively starting from the WE::Obj object $obj and return a list of object ids. If $obj is a non-folder object, then only this object is searched.

NOTES

There is no locking implemented in the Content database. It is assumed that the Content database is usually accessed through WE::DB::Obj methods, where locking is implemented.

AUTHOR

Slaven Rezic - eserte@users.sourceforge.net

SEE ALSO

WE::DB::Obj