From: Tim Starling Date: Thu, 4 May 2006 06:03:22 +0000 (+0000) Subject: Added an overview of the CBT project including its status. Moved the template file... X-Git-Tag: 1.31.0-rc.0~57253 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=84c39bfc56dcc1402347eb0fd1fa8ab35c372567;p=lhc%2Fweb%2Fwiklou.git Added an overview of the CBT project including its status. Moved the template file to the disabled directory. --- diff --git a/includes/cbt/README b/includes/cbt/README index ca2ef2c985..1f565e0d1e 100644 --- a/includes/cbt/README +++ b/includes/cbt/README @@ -1,3 +1,49 @@ +Overview +-------- + +CBT (callback-based templates) is an experimental system for improving skin +rendering time in MediaWiki and similar applications. The fundamental concept is +a template language which contains tags which pull text from PHP callbacks. +These PHP callbacks do not simply return text, they also return a description of +the dependencies -- the global data upon which the returned text depends. This +allows a compiler to produce a template optimised for a certain context. For +example, a user-dependent template can be produced, with the username replaced +by static text, as well as all user preference dependent text. + +This was an experimental project to prove the concept -- to explore possible +efficiency gains and techniques. TemplateProcessor was the first element of this +experiment. It is a class written in PHP which parses a template, and produces +either an optimised template with dependencies removed, or the output text +itself. I found that even with a heavily optimised template, this processor was +not fast enough to match the speed of the original MonoBook. + +To improve the efficiency, I wrote TemplateCompiler, which takes a template, +preferably pre-optimised by TemplateProcessor, and generates PHP code from it. +The generated code is a single expression, concatenating static text and +callback results. This approach turned out to be very efficient, making +significant time savings compared to the original MonoBook. + +Despite this success, the code has been shelved for the time being. There were +a number of unresolved implementation problems, and I felt that there were more +pressing priorities for MediaWiki development than solving them and bringing +this module to completion. I also believe that more research is needed into +other possible template architectures. There is nothing fundamentally wrong with +the CBT concept, and I would encourage others to continue its development. + +The problems I saw were: + +* Extensibility. Can non-Wikimedia installations easily extend and modify CBT + skins? Patching seems to be necessary, is this acceptable? MediaWiki + extensions are another problem. Unless the interfaces allow them to return + dependencies, any hooks will have to be marked dynamic and thus inefficient. + +* Cache invalidation. This is a simple implementation issue, although it would + require extensive modification to the MediaWiki core. + +* Syntax. The syntax is minimalistic and easy to parse, but can be quite ugly. + Will generations of MediaWiki users curse my name? + + Template syntax --------------- @@ -53,3 +99,6 @@ should call cbt_value() to get a return value: where $deps is an array of string tokens, each one naming a dependency. As a shortcut, if there is only one dependency, $deps may be a string. + +--------------------- +Tim Starling 2006 diff --git a/skins/MonoBook.tpl b/skins/MonoBook.tpl deleted file mode 100644 index a5a259c8e3..0000000000 --- a/skins/MonoBook.tpl +++ /dev/null @@ -1,200 +0,0 @@ - - - - - {headlinks} - {headscripts} - {pagetitle} - - - - - - - - - - {if jsvarurl {}} - {if pagecss {}} - {usercss} - {sitecss} - {gencss} - {if userjs {}} - {if userjsprev {}} - {trackbackhtml} - - -
-
-
- - {if sitenotice {
{sitenotice}
}} -

{title}

-
-

{msg {tagline}}

-
{subtitle}
- {if undelete {
{undelete}
}} - {if newtalk {
{newtalk}
}} - {if showjumplinks { - - }} - - {bodytext} - {if catlinks { }} - -
-
-
-
-
-
-
{msg {views}}
- -
-
-
{msg {personaltools}}
-
-
    - {personal_urls {
  • $text
  • }} -
-
-
- - - {sidebar { -
-
$barname
-
-
    - } { -
-
-
- } {
  • $text
  • - } - } - - -
    -
    {msg {toolbox}}
    -
    - -
    -
    - {language_urls { -
    -
    {msg {otherlanguages}}
    -
    -
      - $body -
    -
    -
    - } { -
  • $text
  • - }} -
    -
    - - -
    -{reporttime} -{if {} { vim: set syn=html ts=2 : }} - diff --git a/skins/disabled/MonoBook.tpl b/skins/disabled/MonoBook.tpl new file mode 100644 index 0000000000..a5a259c8e3 --- /dev/null +++ b/skins/disabled/MonoBook.tpl @@ -0,0 +1,200 @@ + + + + + {headlinks} + {headscripts} + {pagetitle} + + + + + + + + + + {if jsvarurl {}} + {if pagecss {}} + {usercss} + {sitecss} + {gencss} + {if userjs {}} + {if userjsprev {}} + {trackbackhtml} + + +
    +
    +
    + + {if sitenotice {
    {sitenotice}
    }} +

    {title}

    +
    +

    {msg {tagline}}

    +
    {subtitle}
    + {if undelete {
    {undelete}
    }} + {if newtalk {
    {newtalk}
    }} + {if showjumplinks { + + }} + + {bodytext} + {if catlinks { }} + +
    +
    +
    +
    +
    +
    +
    {msg {views}}
    + +
    +
    +
    {msg {personaltools}}
    +
    +
      + {personal_urls {
    • $text
    • }} +
    +
    +
    + + + {sidebar { +
    +
    $barname
    +
    +
      + } { +
    +
    +
    + } {
  • $text
  • + } + } + + +
    +
    {msg {toolbox}}
    +
    + +
    +
    + {language_urls { +
    +
    {msg {otherlanguages}}
    +
    +
      + $body +
    +
    +
    + } { +
  • $text
  • + }} +
    +
    + + +
    +{reporttime} +{if {} { vim: set syn=html ts=2 : }} + diff --git a/skins/disabled/MonoBookCBT.php b/skins/disabled/MonoBookCBT.php index c59989ac9f..0474ad7cf0 100644 --- a/skins/disabled/MonoBookCBT.php +++ b/skins/disabled/MonoBookCBT.php @@ -10,7 +10,9 @@ require_once( 'includes/SkinTemplate.php' ); /** * MonoBook clone using the new dependency-tracking template processor. - * EXPERIMENTAL - use only for testing and profiling at this stage + * EXPERIMENTAL - use only for testing and profiling at this stage. + * + * See includes/cbt/README for an explanation. * * The main thing that's missing is cache invalidation, on change of: * * messages