DBCachePlugin

Lightweighted frontend to the DBCacheContrib

Description

This is a lightweight frontend to the DBCacheContrib. The provided macros DBQUERY and DBCALL can be used as a replacement for SEARCH and INCLUDE that use the database store instead of searching and extracting on the raw topic files.

DBQUERY is provided to ease the use of WikiApplications based on the DBCacheContrib combining its flexible query language with unrestricted formatting and an extend mechanism to extract topic properties.

DBCALL is named "call" and not "include" as its main purpose is to ease WikiApplications where TopicFunctions are treated as stored procedures.

DBCALL does not allow to call "external" pages as INCLUDE allows.

DBCALL's "warn" parameter can only be set to "on" and "off" and does not allow alternative content in case of a warning. The "pattern" feature used to extract a fragment from an INCLUDEd text using regular expression has been dropped. That aside, DBCALLs can be called recursively as INCLUDEs can, parametrized using key-value arguments and obeys to %STARTINCLUDE%, %STOPINCLUDE%, %STARTSECTION{"..."}% and %ENDSECTION{"..."}%.

Using the DBCacheContrib topic sections are stored into the topic object of the database. The section between %STARTINCLUDE% ... %STOPINCLUDE% is called _sectiondefault whereas all sections between %STARTSECTION{"<name>"}% .... %ENDSECTION{"<name>"}% are called _section<name> and are stored accordingly.

In addition, DBCALL implements so called TopicMethods. A method call is of the form %DBCALL{"SomeTopic->RenderMethod" ...}% and will infer the actual ...RenderMethod to be called on the base of the TopicType of SomeTopic. TopicTypes are a concept introduced by the Foswiki:Extensions.WorkbenchAddOn. It basically refers to a convention to tag the type(s) of a topic in a formfield "TopicType". The lookup mechanism for TopicMethods proceeds as normal if the DBCALl is not of the form "SomeTopic->RenderMethod". For example, if SomeTopic is of type Video, MediaType, ClassifiedTopic the lookup mechanism will try to find the methods VideoRenderMethod, MediaTypeRenderMethod and ClassifiedTopicRenderMethod in the given order and use the one found first. The web these types are defined in is inferred on the base of the DataForm definitions of each of these types. If none of these type-specific methods is found the method call will fallback to a normal non-specific function call. The TopicMethod itself is called with an implicit parameter OBJECT that refers to SomeTopic, that is the object this method has been called for.

DBRECURSE iterates over topics in a web following a certain topic-to-topic relation, like the parent-child relation among topics. You can define arbitrary relations using filters.

Syntax

DBCALL

Fetch topic content or a section of it from the database store.

Syntax:
%DBCALL{"<topic" ... }%
"<topic>" topic that we'd like to call
section="..." optional named section; without this parameter the "default" section is used
<key>="<value>" topic arguments to be substituted within the included text; that is every occurrence of <key> is substituted with <value>
warn="on,off" enable/suppress error warnings
remote="on,off" switch fixing WikiWords in transcluded content; on means "don't touch, this is remote content" defaults to "off" because that's the default behaviour of %INCLUDE{}% (note, DBQUERY defaults to "on" aka do-not-touch-mode)

DBDUMP

Display the database record of a topic (useful for debugging).

Syntax:
%DBDUMP{"<topic>" ... }%
"<topic>" topic that we'd like to debug
web="..." name of the web to look for the given topic; note that you can use the dot-notation in specifying the web.topic also

DBQUERY

DBQUERY can be used in either of two modes (a) as a pure search tool or (b) as a tool to extract properties of (a set of) known topics.

Syntax:
%DBQUERY{"<search>" ... }%
"<search>" search clause, see below
topics="..." or topic="..." set of topics to consult (mode (b)); if "topics" are specified in addition to a "search" it will be restricted to the given topics
web="..." web where to search for hits; defaults to the current one
webs="..." regular expression of webs to be searched for; if specified takes higher precedence than web; can also be all to search in all webs or a comma-separated list of webs to search in
format="..." format string to display search hits; defaults to "$topic"; the special format string "none" disables the format string
header="..." format string to prepended to the list of hits
footer="..." format string to appended to the list of hits
nullformat="..." format string to be used when no result was found
separator="..." format string used to separate hits; defaults to "$n"; the special separator "none" disables separation
dateformat="..." format of any date formfield in case you'd like to deviate from the default date format
include="..." pattern each found topic name must match to be considered a hit; can also be a comma separated list of topics
exclude="..." pattern each found topic name must not match to be considered a hit; can also be a comma separated list of topics
sort="..." specifies the sorting of hits; this can be a comma separted list of attributes to specify more complicated sortings; special value "random"; defaults to "name"
reverse="..." specify if hits should be sorted in reverse order; revers order can be specified for the complete result using "on", or by formfield; multiple formfields may be specified comma separated, defaults to "off"
limit="..." maximum number of topics to include in the hit set
warn="on,off" enable/suppress error warnings
skip="..." number of topics to skip while constructing the hit set; defaults to "0"
hidenull="..." flag to indicate that an empty hit set should not be displayed
newline="..." string to substitute newlines in formfield values with, e.g. newline="<br />"  
remote="on,off" switch fixing WikiWords in transcluded content; on means "don't touch, this is remote content" defaults to "on"
context="..." name of a hash within a topic to use a root for any queries; for example this may be used to search over all attachments or any custom meta data such as comments as per Foswiki:Extensions/MetaCommentsPlugin

Following variables are expanded in format strings:
  • $percnt: % sign
  • $dollar: $ sign
  • $quot: " sign
  • $n: newline
  • $nop: "empty string"
  • $count: the number of hits
  • $index: the current row index in the search
  • $web: the web where the hits where found
  • $formfield(<formfield-name>): the value of the given formfield
  • $formatTime(<formfield-accessor> [, '<format>']): format the datefield pointed to by the <formfield-accessor> using the given <format>; the format can be in any form supported by Foswiki::Func::formatTime() (see the GMTIME documentation).
  • $expand(<formfield-accessor>): return the formfield pointed to by the <formfield-accessor>
  • $expandEncoded(<formfield-accessor>): same as $expand() however results are entity encoded
  • $displayValue('<formfield-name'): the display value of the given formfield; this may differ from the value returned by $formfield() when it has been defined as a "value-mapped" formfield using ="+values"
  • $html(<formfield-accessor>): same as $expand() but expands macros and TML markup
  • $d2n(<formfield-accessor>): converts a date formfield's value to epoch seconds
  • $rss(...): encode entities so that the text can be included in an rss feed
  • $encode(...): encode entities so that the text can be included in HTML input form elements
  • $quotes(...): encode quotes in a string
  • $flatten(...): remove any special markup producing a flattened text representation
  • $trunc(...,length): truncate a string to the given length
  • $uc(...): converts a string to upper case
  • $lc(...): converts a string to lower case
  • $translate(...): translate a string using Foswiki's internal I18N or MultiLingualPlugin if installed

Formfield accessors:

In its most basic form $expand(Ref) is identical to $formfield(Ref). In addition $expand() can be used to refer to topic properties of related topics that can be reached from the current one using the '@' symbol. For example, if a topic A uses a form that contains a field named "Ref" and specifies a reference to another topic B (by using its name) you can access the "Headline" in B from A using $expand(@Ref.Headline).

A formfield accessor can be a composed one using 'or' and 'and'. Example: $expand(Name or Author) will expand to the value of the formfield "Name" if it exists and is non-empty and to the value of the formfield "Author" otherwise. More valid examples:
  • $expand(@Ref.Headline): headline of the referred topic
  • $expand(Nr and '.'): append a dot to the formfield value "Nr" if it exists
  • $expand(Name or Author): expand to "Name" or "Author"

A formfield accessor can be computed using TopicMarkup. If the string starts with '%', it is expanded and its result is taken as the real formfield accessor. This is useful when the name of the formfield must be computed by different means.

DBRECURSE

Traverse topic-to-topic relations, like the intrinsic parent-child relation

Syntax:
%DBRECURSE{"<topic>" ...}%
<topic> starting point, can be in web.topic format, defaults to the current topic
web="..." web where to recurse, defaults to the web given in the topic parameter or the current web
format="..." format string for each found topic defaults to '   $indent* [[$web.$topic][$topic]]'
single="..." format string used when only one topic is found, defaults to value of format parameter
separator="..." separator string to be put between formatted topics, defaults to '\n'
header="..." format string to be prepended to the output, empty by default
subheader="..." format string to be prepended to each subordinated search, defaults to header parameter
singleheader="..." format string to be used when only one topic is found
footer="..." format string to be appended to the output
subfooter="..." format string to be appended to each subordinated search, defaults to footer parameter
singlefooter="..." format string to be used when only one topic is found
hidenull="..." flag to indicate that an empty hit set should not be displayed
filter="..." search expression that is used in each recursion step; the current topic name is inserted into the filter expression by replacing the '$name' string; the default filter is 'parent='$name'; this will search for topics of which the current topic is a parent
sort="..." determines the sorting order of topics in each iteration step
reverse="on,off" reverse sorting order
limit="..." maximum iterations, default is 0 (unlimited)
warn="on,off" enable/suppress error warnings
skip="..." skips the first n hits when formatting the output, defaults to 0 (no skip)
depth="..." only recurse to a given depth, defaults to 0 (unlimited)
include="..." regular expression topics must match to be included in the search; can also be a comma separated list of topics
exclude="..." regular expression that excludes matching topics from the search; can also be a comma separated list of topics
newline="..." string to substitute newlines in formfield values with, e.g. newline="<br />"  

The ...format, ...header and ...footer format strings may contain the following variables:
  • $web: the current web
  • $topic: the current topic in the search
  • $index: the topic index number in one recursion step, that is an enumeration in each recursion step
  • $number: the "paragraph" number in the recursion, e.g. 1.2.1.5 depicts the path alternative in the recursion tree
  • $count: number of found topics; this is the total number of found topics in the header and footer and the number of topics found so far during recursion
  • $indent: 3 spaces per depth
  • $indent(<string>): uses <string> for indenting the result in each depth
  • $formfield(...): see #DBQUERY
  • $expand(...): see #DBQUERY
  • $formatTime(...): see #DBQUERY

All format strings may contain the following variables:
  • $dollar: $ sign
  • $quot: " sign
  • $n: newline
  • $percnt: % sign

Example:

%DBRECURSE{"%SYSTEMWEB%.FrequentlyAskedQuestions"}%
lists all FrequentlyAskedQuestions topics (with properly set topic parent):

DBSTATS

Compute and format a statistics on the database.

Syntax:
%DBSTATS{"<search>" ...}%
"<search>" query string that defines a search, see DBCacheContrib
web="..." the web where to search in (default: current web)
field(s)="..." name of one or more formfields to be extracted (default: "text")
process="..." macro being used to post-process field values extracted from the database; macro are escaped using standard format tokens ($percnt, $dollar, etc); the result is used instead of the direct field value; when extracting multiple fields, specific process statements might be specified using process_<field-name1>, process_<field-name2, ...
split="..." regex split up a field value into a list before matching each item against pattern
pattern="..." regex pattern to extract keys from the formfield(s); note, that before the pattern is applied the field value is split up using the split parameter; you must provide at least one grouping ("(...)") in the pattern string that encloses the key to be extracted (default: "^(.*)$"); you may have up to five groupings in one pattern that are accessible each in the format string
header="..." header format string to be prepended to the output
format="..." format string used for each key in the output
sep(arator)="..." separator to put between formatted keys
footer="..." footer format string to be appended to the output
sort="alpha,created,num" order of keys in the output
reverse="on,off" sort keys descending or ascending
limit="..." maximum number of keys to be formatted in the output
hidenull="..." flag to indicate that an empty hit set should not be displayed
include="..." regular expression that keys must match to be included in the output
exclude="..." regular expression that keys must match to be excluded from the output
casesensitive="on/off" boolean to switch on/off case sensitive matching in include and exclude; defaults to off (case insensitive match)

The DBSTATS searches for all topics in given web and reads the given form fields. It then uses the split and pattern parameters to extract all keys in the data counting their occurrences. The result is rendered using the format parameter for each token found, separating them by sep, prepend the header and append the footer. Results can be sorted alphabetically or by createdate.

Format strings (header, format, footer) can use the following variables to insert the computed statistics:
  • $key, $key1: the found key, this must match the first group in the pattern argument
  • $key2, $key3, $key4,$key5: second, third, etc grouping in the pattern argument
  • $count: the number of occurrences of the key
  • $index: index of the key within the sorted result set
  • $min: minimum count found in the search
  • $max: maximum count found in the search
  • $sum: sum of all counts
  • $mean: mean occurrence of a key in the result set
  • $keys: total number of keys found
  • $web: the web we search in
  • $topics: the list of all topics where the keys where found

For example if you want to extract all month/years from a database's Date field that has the format dd mon yyyy and then format a link to an archive using the month and the year as separate url parameters then use something like this:
%DBSTATS{"query"
   field="Date"
   pattern="((\w+) (\d\d\d\d))"
   header="---++ Archive"
   format="   * <a href="...?month=$key2&year=$key3">$key</a>"
}%

Note, that the above pattern will crop away the day. Groups can be nested counting them from left to right, outside to inside: the first group matches the compete pattern, the second the month the third the year.

Post-processing field values using a process macro comes in handy when dealing with formfields of type date. As these are stored in epoch seconds, you might decide to format them into an appropriate way before generating statistics on its base:

%DBSTATS{
  "form='Invoice'"
  field="PaidDate"
  process="$percntDATETIME{\"$value\" format=\"$month $year\"}$percnt"
  pattern="(.*?) (\d\d\d\d)"
...
}%

While the real value of a "PaidDate" formfield is stored in epoch seconds, statistics make more sense on a per month basis.

TOPICTITLE

derive the title of a topic from a couple of properties:

Syntax:
%TOPICTITLE{"<topic>"}%
<topic> topic we want the page title off, defaults to current topic
hideautoinc="on/off" ignore/respect autoinc topic names

  • from a TOPICTITLE preference variable, or
  • from a "TopicTitle" formfield attribute, or
  • defaults to the topic name

DBPREV, DBNEXT

reference the "neigbour" documetns of an item found in a search query

Syntax:
%DBPREV{"<search>" ... "}%*, %DBNEXT{"<search>" ... "}%
"<search>" query string that defines a search, see DBCacheContrib
web="..." the web where to search in (default: current web)
topic="..." the topic from where to search for neighbours (default: current topic)
format="..." format string to render the results (default: "$web.$topic")
order define a sorting on the hit set; see above
reverse="on,off" sort keys descending or ascending
warn="on,off" enable/suppress error warnings

Results are rendered using the format parameter which understands the normal format tokens like $dollar, $percnt, $nop and $n as well as $web and $topic which refer to the previous or next topic in DBPREV or DBNEXT respectively.

These two macros come in handy rendering a navigation among search results found by a DBQUERY. For example, the following code will render a navigation as found in blog applications linking to the previous and next blog entry in a list of postings ordered by created date:

%DBPREV{
  search="TopicType=~'\bBlogEntry\b' AND State != 'unpublished' AND topic != 'WebTopicEditTemplate'" 
  order="created"
  format="[[$web.$topic]]"
}%
%DBNEXT{
  search="TopicType=~'\bBlogEntry\b' AND State != 'unpublished' AND topic != 'WebTopicEditTemplate'" 
  order="created"
  format="[[$web.$topic]]"
}%

(from Foswiki:Extensions/BlogPlugin)

CREATEDATE

This macro returns the date a topic was created. This is basically equivalent to %!QUERY{"info.date" rev="1"}% though 10x faster.

Parameters Description Default
topic="...", "..." the topic to read current topic
format="..." format string default date format

CREATEAUTHOR

This macro returns the author information of the first revision of a topic. This is basically equivalent to %!QUERY{"info.author" rev="1"}% though 10x faster.

Parameters Description Default
topic="...", "..." the topic to read current topic
format="..." format string, may hold variables $username, $wikiname and $wikiusername $wikiname

Syntax of search queries

A search query is a boolean expression on fields of a topic. (Tip: use %DBDUMP to explore the available fields).

Fields are given by name, and values by strings or numbers. Strings should always be surrounded by 'single-quotes'. Strings which are regular expressions (RHS of =, != =~ operators) use 'perl' regular expression syntax (google for perlre for help). Numbers can be signed integers or decimals. Single quotes in values may be escaped using backslash (\).

The following operators are available:
Operator Result Meaning
= Boolean LHS exactly matches the regular expression on the RHS. The expression must match the whole string.
!= Boolean Inverse of =
=~ Boolean LHS contains RHS i.e. the RHS is found somewhere in the field value.
< Boolean Numeric <
> Boolean Numeric >
>= Boolean Numeric >=
<= Boolean Numeric <=
@ Node Access node referenced by LHS. e.g. ProjectLeader@TopicTitle returns the formfield TopicTitle of the topic stored in the formfield ProjectLeader
lc String Unary lower case
displayValue String return display value of a formfield, e.g. displayValue('State')
uc String Unary UPPER CASE
d2n Number Convert a date string into epoch seconds
n2d String Convert epoch seconds into a date string
length Number Length of an array, e.g. length(attachments) to return the number of attachments
! Boolean Unary NOT
AND Boolean AND
OR Boolean OR
ALLOWS Boolean LHS is a topic that allows to perform RHS by the current user e.g. topic ALLOWS VIEW is true when the current user is allowed to view the given topic
() any Bracketed subexpression
IS_DATE Boolean Compare two dates e.g. '1 Apr 2003' IS_DATE '1 Apr 2004'
EARLIER_THAN Boolean Date is earlier than the given date
EARLIER_THAN_OR_ON Boolean Date is earlier than, or on, the given date
LATER_THAN Boolean LHS is later than the given date
LATER_THAN_OR_ON Boolean LHS is later than the given date
WITHIN_DAYS Boolean Date (which must be in the future) is within n working days of todays date

Examples

  • Find all topics that have been last modified before 1st January 2008
    %DBQUERY{"info.date EARLIER_THAN '1st January 2008'"}%
  • Find all topics last modified by Peter
    %DBQUERY{"info.author =~ 'Peter'"}%
  • Find all FAQs
    %DBQUERY{"topic =~ 'FAQ'"}%
  • Find all topics that have the word "random" in it (case-insensitive) excluding the current topic
    %DBQUERY{"lc(text) =~ 'random' AND topic != 'DBCachePlugin'"}%

Perl API

The DBCachePlugin supports overloading the contained default database cache by inheriting from DBCachePlugin::WebDB being itself a DBCacheContrib. The only purpose of the DBCachePlugin::WebDB is to extract the TopicFunctions contained in a topic as described above. You can easily extend this functionality by deriving a WebDB specific to your own WikiApplication. For example, the Foswiki:Extensions.BlogPlugin defines a WebDB of its own where it caches the createdate of a topic being either specified in a formfield or given in the timestamp of the first revision of a topic.

DBCachePlugin

getDB()

Returns a database object used for further queries. This function must be called ahead of any actual database access. If your WikiApplication is using a derived WebDB then use the WEBDB variable in your WebPreferences to point to its implementation (example: =Set WEBDB = Foswiki::Plugins::BlogPlugin::WebDB=). If WEBDB is not defined the default implementation Foswiki::Plugins::DBCachePlugin::WebDB is used. Note, that this way only one application-specific database cache can be loaded per web. This is rather a design decision; otherwise each DBQUERY and DBCALL tag would have to declare which database it operated on. So currently the rule of thumb is: one web one WikiApplication making use of this plugin.

returns a database object. See the Foswiki:Extensions::DBCacheContrib documentation for its interfaces.

registerIndexTopicHandler()

This registers a function to the plugin to be called when a topic is indexed. It will then give each registered index handler a chance to operate on the object being indexed. This can be used to add additional info to be stored.

Example usage:

use Foswiki::Plugins::DBCachePlugin;

Foswiki::Plugins::DBCachePlugin::registerIndexTopicHandler(sub {
  my ($db, $obj, $web, $topic, $meta, $text) = @_;

  ...
  $obj->set("foo", "bar");
});

DBCachePlugin::WebDB

This implements the database object that is used to access the topic records in a web. Note, that for each web there is exactly one WebDB database object. A database object is fetched (and initialized if needed) by the DBCachePlugin::getDB() function.

dbQuery()

The DBQUERY functionality can be access from within perl using the plugins dbQuery() method.

$hits = $db->dbQuery([$search, @$topics, $order, $reverse, $include, $exclude, $hits])
webDB database object
search search clause
topics restrict search to this list of topics
order define a sorting on the hit set; this can be any formfield accessor or one of the shortcuts "created" (for createdate) or "modified" (for info.date) provided for compatibility with default %SEARCH, or "random"
reverse=on,off revert the sorting order
include pattern that topic names must match to be considered a hit
exclude pattern that topic names must not match to be considered a hit
hits a result object holding all found topics; will be augmented if provided to dbQuery as an optional parameter

Example usage:

my $db = Foswiki::Plugins::DBCachePlugin::getDB("Main");
my $hits = $db->dbQuery($query, undef, $order, $reverse, $include, $exclude);

while (my $obj = $hits->next) {
  my $topicName = $obj->fastget("topic");
  ...
}

getFormField()

Access the formfield value of an arbitrary topic.

$value = $db->getFormField($topic, $formfield)
topic a topic name
formfield a formfield name

returns the value of the named formfield

Plugin Settings

See also DBCacheContrib for additional configuration settings.

Each web can specify an alternative implementation inheriting from DBCachePlugin::WebDB. To specify it you have to set the WEBDB variable in the WebPreferences. The default is Foswiki::Plugins::DBCachePlugin::WebDB

MemoryCache

If $Foswiki::cfg{DBCache}{MemoryCache} is set to FALSE (defaults to TRUE) the dbcache once loaded into memory will stay there among multiple requests. This option only has an effect using speedy/perperl or fastcgi setups.

SecureTopicTitles

When enabling $$Foswiki::cfg{SecureTopicTitles}, TopicTitles will only be used as a link text in WikiWords when the user has got view access to the target topic.

Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -> "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button. Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will not show up in the search results.

You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.

WARNING: before using DBCachePlugin on your site do take down your web server and run

cd <foswiki-root>/bin; ./rest /DBCachePlugin/updateCache

to generate all caches initially. Then switch on the web server again. The cache will be maintained automatically from there on.

Dependencies

NameVersionDescription
Foswiki::Contrib::DBCacheContrib>=6.00Required
Storable>=2.07Required
Sereal>=3.00Optional
Foswiki::Plugins::TopicTitlePlugin>1.00Required for Foswiki < 2.2

Change History

29 Apr 2024: new expandEncoded() helper; improved sorting of search results numerically; improved formatting date times according to the user's locale settings; fixed processing formfield values in %DBSTATS macro; removed local implementation of getting the topic title, using TopicTitlePlugin exclusively now; indexing a topic thumbnail now
23 Aug 2022: updated documentation
31 May 2022: caching topic title of WebHome as webtitle; use TopicTitlePlugin to fetch the topic title
28 Apr 2022: fixed a couple of memory leaks; performance improvements; improved recursion detection in %DBCALL
15 Oct 2020: added macros %CREATEDATE and %CREATEAUTHOR; added multi-dimensional sorting and reversing; added $quote() and $displayValue()
02 May 2019: performance improvements
26 Nov 2018: added process parameter to DBSTATS to post-process field values before generating statistics; return the empty string instead of ??? when parsing an empty or zero time value; disabled dependency injection of DBSTATS into the page cache for performance reasons (still there for DBQUERY); added nullformat parameter to DBQUERY
01 Oct 2018: rationalized handing date data
28 May 2018: remove local implementation of TopicTitle; depend on TopicTitlePlugin instead; new parameter dateformat for DBQUERY; performance improvements in DBQUERY
20 Feb 2018: extend $expand() to return a multi-value reference formfield to return all values
12 Dec 2017: only set the link text of WikiWords if there actually is a TopicTitle for it; set the TopicTitleEnabled context for natedit
28 Jul 2017: fixed restricted search; added random sorting of search results; performance improvements re-loading cache files; fixed "Can't use string as a HASH ref"; added length() function to formating
16 Jan 2017: oo-ify core and other code cleanup
11 Jul 2016: make use of clean-up feature of latest DBCacheContrib; performance improvements
08 Mar 2016: fixed use of uninitialized variable in sorting code; add support for Inheritance field in Foswiki:Extensions/WikiWorkbenchContrib; added warn parameter to all macros to switch off warnings optionally; bail out of recursions earlier when walking in circles
25 Sep 2015: fixed creation of web pattern based on webs param to DBQUERY
09 Sep 2015: new perl api to register index handlers; moved indexing meta comments to Foswiki:Extensions/MetaCommentPlugin; fixed fallback of polymorphic calling semantics of DBCALL{topic->method}
31 Aug 2015: added support for DBQUERY of multiple webs
25 May 2015: added sections to database, a list of known named sections
04 Mar 2015: fixing interaction between DBDUMP generating a heading and Foswiki:Extensions/EditChapterPlugin
20 Jan 2015: added $html()
27 Nov 2014: fixed security of rest handlers and DBDUMP macro
28 May 2014: implemented new ACL style compatible with Foswiki >= 1.2
04 Apr 2014: flag rest handlers that don't require authentication
15 Dec 2013: fixed @Ref operator
30 Aug 2013: fixed crashes when calling API on non-existing web
23 Jul 2013: fixed crashing page when trying to load a cache for a non-existing sub-web
18 Jul 2013: fixed computing a hash key for a sub-web on MS Windows due to differences in Cwd::abs_path
10 Jul 2013: fixed querying non-standard %META data; improved %DBDUMP to show non-standard %META data
06 May 2013: fixed updateCache rest handler to pick up changes on the filesystem reliably
08 Apr 2013: implemented $lc and $uc as documented; fixed default TopicTitle for a WebHome being the web name with parent webs stripped off
30 Mar 2013: fixed formatting results in DBRECURSE
28 Mar 2013: fixed op_ref in search queries; fixed $flatten()
14 Mar 2013: make preferences searchable by caching them into a map instead of an array
25 Jan 2013: fixed loading cache from disk again on a change
07 Jan 2013: a lot of performance improvements
29 Nov 2012: topic title of webhomes now defaults to the web name instead of the topic name
19 Nov 2012: improved save performance on large webs
01 Oct 2012: handle bad date formfields more gracefully
11 Jan 2012: implemented TopicTitles protected by access control rights
10 Jan 2012: implemented DBPREV and DBNEXT; rationalized rendering TopicTitles instead of the normal WikiWord linktext; improved $flatten() to look nicer; fixed sorting search results by multiple keys
25 Aug 2011: fixed dbcache index not build properly when creating a new web; improved flatten() to weed out more; fixed indexing of non-existing webs due to mal-formed urls
06 Apr 2011: fixed error where empty sections were confused with non-existing sections
09 Nov 2010: moved ATTACHMENTS over to Foswiki:Extensions/TopicInteractionPlugin; added API to temporarily disable update handlers; fixed afterSaveHandler to properly update when attachments change
02 Nov 2010: fixed to work with virtual hosts; added $quot formatting token; support non-ascii characters in $formfield(...) -- Foswiki:Main/AntonioTerceiro
28 Jul 2010: added Config.spec to ease configuration, i.e. memory caching; added documentation for $sum; added support for Foswiki:Extensions/MetaCommentPlugin
12 Feb 2010: ATTACHMENTS can now list old revisions of an attachment
17 Nov 2009: fixed incremental cache updates; exclude autoinc pattern in TOPICTITLE; properly combine header, body and footer in DBQUERY to support CALC; added split and casesensitive to DBSTATS; added support for standard escapes in DBQUERY's sort; added $d2n() , $uc(), $lc()
02 Jul 2009: optimed cache maintenance cycles by making use of new loadTopic() api in DBCacheContrib
28 Jun 2009: final detwikification; added compatibility hack for current Foswiki/trunk
18 Jun 2009: Crawford Currie: reverted to using DBCacheContrib
09 Jan 2009: internalized compatible version of DBCacheContrib; added limit to ATTACHMENTS and a few more ways to sort them
07 Jan 2009: new global variable dbQueryCurrentWeb being set during a DBQUERY so that external predicates that depend on the web information can make use of it; renderWikiWord also displays topic titles for explicit links where the link text equals the topic name; internalized urlDecode and parseTime for compatibility reasons; fixed info.author for newer foswiki engines
11 Dec 2008: added MemoryCache flag to switch off memory persistence
11 Dec 2008: working around issue in the Foswiki parse where an undefined %VAR% in parametrized includes is expanded to VAR instead of leaving it to %VAR%
24 Sep 2008: expanding common variables in footers and headers
03 Jul 2008: fixed calculation of a topic title; disabled renderWikiWordHandler for legacy wiki engines, so not replacing the WikiName with its TopicTitle
28 Apr 2008: implemented TopicMethods in DBCALL
05 Feb 2008: addded rss() feature to format strings
4 Jan 2008: Item5319: fix empty separator
11 Dec 2007: renamed PAGETITLE to TOPICTITLE, matching formfield TopicTitle
07 Dec 2007: added PAGETITLE, defaulting to BASEWEB instead of INCLUDINGWEB in all of the tags
14 Nov 2007: protect against data store pollution, at least don't die
12 Sep 2007: made significant speedups to DBQuery fixed sorting to be O(N log(N)) removed topic access check unless absolutly necessary - SvenDowideit@home.org.au
19 Jun 2007: added compatibility hack to display users as WikiNames; added expand(%TML%) feature
08 May 2007: fixed loading db cache file since recent changes in DBCacheContrib
03 Apr 2007: fixed $date(format) in ATTACHMENTS; fixed 'segfault' in DBRECURSE while formatting sub-results
19 Feb 2007: multiple enhancements to the ATTACHMENTS tag (e.g. icons, actions)
31 Jan 2007: fixed caching "web" property of topics; fixed DBDUMP of topics w/o attachments; added numerical sorting of formfields; added support for the Foswiki::Cache; added new tag DBRECURSE to itterate along topic relations
24 Jan 2007: added ATTACHMENTS tag
09 Nov 2006: fixed bug where a topic modification was not detected correctly resulting in an outdated cache when using perl accelerators; added pseudo-variable $topics to DBSTATS to list all topics in a class; added DESTROY methods for caches fixing memory leakage; fixed expansion order of pseudo-variable; speed improved DBQUERY by first checking the match and access rights afterwards (thanks to CDot)
13 Oct 2006: don't use the separator for header and footer format strings; fix links in DBQUERY the same way we do it in DBCALL; added remote parameter to switch on/off fixing links in transcluded content; expansion of $nop and $n in that order
28 Sep 2006: DBQUERY and DBSTATS did not obey access rights
19 Sep 2006: added $key1...$key5 to the pattern matcher and formatter
18 Sep 2006: properly fixed parsing $trunc,$flatten and $encode in format strings; multiple fixes for calls and formatting accross webs
31 Aug 2006: added NO_PREFS_IN_TOPIC; fixed possibly insecure eval
22 Aug 2006: fixed parsing $trunc() and $flatten() in format strings
15 June 2006: generate an inline error instead of an oops on a bad search string to DBQUERY
05 Mai 2006: don't segfault on uncompiled WebDB implementations
30 Mar 2006: added WebDB property createdate formerly only known by the BlogPlugin; dont choke if DBDUMPing a non-existing topic;
27 Mar 2006: added $trunc()
20 Mar 2006: using Foswiki::Attrs to parse section names
12 Mar 2006: added hidenull to DBSTATS
10 Mar 2006: use ENV instead of the CGI object to detect the current cgi action
02 Mar 2006: fixed bad init error showing up on speedy/mod_perl
01 Mar 2006: added DBSTATS tag; modularized the plugin for delayed compilation
15 Feb 2006: don't use the query object in scripted mode
14 Feb 2006: forcing to reload the database after a save
10 Feb 2006: more performance on mod_perl/speedy_cgi: don't reload the topic cache if it hasn't changed
03 Jan 2006: fixed INCLUDING(WEB,TOPIC) in DBCALL; don't apply glue in advance anymore when storing topic sections, it's serving a better purpose when done during a DBCALL
26 Jan 2006: fixed internal links in DBCALL; support for STARTSECTION, old SECTION being deprecated
24 Nov 2005: Initial version

PackageForm edit

Author Michael Daum
Version 16.00
Release 29 Apr 2024
Description Lightweighted frontend to the DBCacheContrib
Repository https://github.com/foswiki/DBCachePlugin
Copyright 2005-2024, Michael Daum
License GPL (GNU General Public License)
Home Foswiki:Extensions/DBCachePlugin
Support Foswiki:Support/DBCachePlugin
Topic revision: r1 - 26 Oct 2023, ProjectContributor
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding GSICS Wiki? Send feedback