<<

NAME

MT::FileInfo

SYNOPSIS

A FileInfo gives you information about a certain file or server-relative URL (it assumes a one-to-one mapping between files and URLs).

More precisely A FileInfo maps a file path to a "Specifier" which tells what kind of file it is and how to rebuild it; also included is the URL where it is expected to be served.

A Specifier is a variant record with the following types and fields:

            Index of template_id
          | Entry of templatemap_id * entry_id
          | DateBased of templatemap_id * date_spec * archive_type
          | Category of templatemap_id * category_id

A FileInfo is tagged with an archive_type field (from the set {Individual, Daily, Monthly, Weekly, Category, Index}), which determines which of those variants is held in the record.

METHODS

set_info_for_url($url, $file_path, $archive_type, $spec)

Creates a FileInfo record in the database to indicate that the URL $url serves the file at $file_path and can be rebuilt from the parameters in $spec.

The $spec argument is a hash ref with at least one of {TemplateMap, Template} defined, and at least one of the following: {Entry, StartDate, Category}.

If $archive_type is 'index' then Template should be given; otherwise TemplateMap should be given.

<<