Muster::MetaDb - keeping meta-data about pages
version 0.61
use Muster::MetaDb;;
Content Management System keeping meta-data about pages.
Set the defaults for the object if they are not defined already.
Update the meta information for one page
$self->update_one_page($page, %meta);
Update the meta information for all pages.
Delete the meta information for one page
$self->delete_one_page($page);
Update the derived tables for all pages.
Get the info about one page. Returns undef if the page isn't there.
my $meta = $self->page_or_file_info($pagename);
Do a freeform query. This returns a reference to the first column of results.
my $results = $self->query($query);
Attempt to translate an IkiWiki-style pagespec into an SQL condition.
Do a query using an IkiWiki-style pagespec.
my $results = $self->query($spec);
Query the database, return a list of pages
Query the database, return a list of all pages' pagelinks. This does not include _Header or _Footer pages.
Query the database, return the total number of records.
Does this page/file exist in the database?
Which page does the given link match, when linked from the given page?
my $linkedpage = $self->bestlink($page,$link);
These are functions which are NOT exported by this plugin.
Connect to the database If we've already connected, do nothing.
Retrieve or create prepared statement handles.
my $sth = $self->_prepare($q);
Create the initial tables in the database:
pagefiles: (page, title, name, filetype, is_page, filename, parent_page) links: (page, links_to) deepfields: (page, field, value)
Create and populate the flatfields table using the data from the deepfields table. Expects the deepfields table to be up to date, so this needs to be called at the end of the scanning pass.
$self->_generate_derived_tables();
Drop all the tables in the database except the flatfields table (which will be done just before it is recreated) If one is doing a scan-all-pages pass, dropping and re-creating may be quicker than updating.
Update all pages, adding new ones and deleting non-existent ones. This expects that the pages passed in are the DEFINITIVE list of pages, and if a page isn't in this list, it no longer exists.
$self->_update_all_entries($page=>{...},$page2=>{}...);
Commit a pending transaction.
$self->_commit();
List of all pagefiles
$dbtable->_get_all_pagefiles(%args);
List of all pagenames
$dbtable->_get_all_pagenames();
List of the unique non-hidden field-names from the deepfields table. Hidden field names start with '_' and are not supposed to be put into the flatfields table, though they can be queried from the deepfields table.
@fieldnames = $self->_get_all_nonhidden_fieldnames();
Get the field-value pairs for a single page from the deepfields table.
$meta = $self->_get_fields_for_page($page);
Get the "child" pages for this page from the pagefiles table.
$meta = $self->_get_children_for_page($page);
Get the "attachments" non-pages for this page from the pagefiles table.
$meta = $self->_get_attachments_for_page($page);
Get the "links" pages for this page from the links table.
$meta = $self->_get_links_for_page($page);
Get the meta-data for a single page.
$meta = $self->_get_page_meta($page);
Do a SELECT query, and return the first column of results. This is a freeform query, so the caller must be careful to formulate it correctly.
my $results = $self->_do_one_col_query($query);
Find the total records in the database.
$dbtable->_total_pagefiles();
Find the total number of pages.
$dbtable->_total_pages();
Does this page exist in the database? This does a case-insensitive check if there isn't an exact match. Returns the real pagename if it is found, otherwise empty string.
The page as if it were a html link. This does things like add a route-prefix or trailing slash if it is needed.
It's okay to hardcode the route-prefix into the database, because it isn't as if one is going to be mounting the same config multiple times with different route-prefixes. If you have a different config, you're going to need a different database.
Add metadata to db for one page.
$self->_add_page_data($page, %meta);
To install Muster, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Muster
CPAN shell
perl -MCPAN -e shell install Muster
For more information on module installation, please visit the detailed CPAN module installation guide.