Tags:
create new tag
view all tags

Order of plugin handler calls

Here's an annotated example of the plugin handler calls during the view of a simple page (no skin, page contains a simple table). Note that this only shows handlers called in plugins that are actually registered. There are several other handlers that are not shown because no installed plugin ever calls them.
  • PREPARE PAGE HEADER
  • beforeCommonTagsHandler called from TWiki::handleCommonTags TWiki::UI::View::_prepare
  • commonTagsHandler called from TWiki::handleCommonTags TWiki::UI::View::_prepare
    • EXAMPLE OF A PLUGIN ADDING AN HTTP HEADER
    • beforeCommonTagsHandler called from TWiki::handleCommonTags TWiki::addToHEAD TWiki::Func::addToHEAD TWiki::Plugins::EditRowPlugin::commonTagsHandler TWiki::Plugin::invoke TWiki::Plugins::commonTagsHandler TWiki::handleCommonTags TWiki::UI::View::_prepare
    • commonTagsHandler called from TWiki::handleCommonTags TWiki::addToHEAD TWiki::Func::addToHEAD TWiki::Plugins::EditRowPlugin::commonTagsHandler TWiki::Plugin::invoke TWiki::handleCommonTags TWiki::UI::View::_prepare
    • afterCommonTagsHandler called from TWiki::handleCommonTags TWiki::addToHEAD TWiki::Func::addToHEAD TWiki::Plugins::EditRowPlugin::commonTagsHandler TWiki::Plugin::invoke TWiki::Plugins::commonTagsHandler TWiki::handleCommonTags TWiki::UI::View::_prepare
  • afterCommonTagsHandler called from TWiki::handleCommonTags TWiki::UI::View::_prepare
  • startRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • preRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • renderWikiWordHandler called from TWiki::Render::internalLink TWiki::Render::_handleSquareBracketedLink TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare for each wikiword in the topic
  • endRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • postRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • PREPARE PAGE BODY
  • beforeCommonTagsHandler called from TWiki::handleCommonTags TWiki::UI::View::_prepare
    • EXAMPLE OF A TAG (%SEARCH%) RECURSIVELY EXPANDING SEARCH RESULTS
    • beforeCommonTagsHandler called from TWiki::handleCommonTags TWiki::Search::searchWeb TWiki::SEARCH TWiki::_expandTagOnTopicRendering TWiki::_processTags TWiki::expandAllTags TWiki::handleCommonTags TWiki::UI::View::_prepare
    • commonTagsHandler called from TWiki::handleCommonTags TWiki::Search::searchWeb TWiki::SEARCH TWiki::_expandTagOnTopicRendering TWiki::_processTags TWiki::expandAllTags TWiki::handleCommonTags TWiki::UI::View::_prepare
    • afterCommonTagsHandler called from TWiki::handleCommonTags TWiki::Search::searchWeb TWiki::SEARCH TWiki::_expandTagOnTopicRendering TWiki::_processTags TWiki::expandAllTags TWiki::handleCommonTags TWiki::UI::View::_prepare
    • beforeCommonTagsHandler called from TWiki::handleCommonTags TWiki::Search::searchWeb TWiki::SEARCH TWiki::_expandTagOnTopicRendering TWiki::_processTags TWiki::expandAllTags TWiki::handleCommonTags TWiki::UI::View::_prepare
    • commonTagsHandler called from TWiki::handleCommonTags TWiki::Search::searchWeb TWiki::SEARCH TWiki::_expandTagOnTopicRendering TWiki::_processTags TWiki::expandAllTags TWiki::handleCommonTags TWiki::UI::View::_prepare
    • afterCommonTagsHandler called from TWiki::handleCommonTags TWiki::Search::searchWeb TWiki::SEARCH TWiki::_expandTagOnTopicRendering TWiki::_processTags TWiki::expandAllTags TWiki::handleCommonTags TWiki::UI::View::_prepare
  • commonTagsHandler called from TWiki::handleCommonTags TWiki::UI::View::_prepare
  • afterCommonTagsHandler called from TWiki::handleCommonTags TWiki::UI::View::_prepare
  • startRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • preRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • renderWikiWordHandler called from TWiki::Render::internalLink TWiki::Render::_handleWikiWord TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • endRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • postRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • PAGE FOOTER
  • beforeCommonTagsHandler called from TWiki::handleCommonTags TWiki::UI::View::_prepare
  • commonTagsHandler called from TWiki::handleCommonTags TWiki::UI::View::_prepare
  • afterCommonTagsHandler called from TWiki::handleCommonTags TWiki::UI::View::_prepare
  • startRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • preRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • endRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • postRenderingHandler called from TWiki::Render::getRenderedVersion TWiki::UI::View::_prepare
  • PREPARE HTTP HEADERS
  • writeHeaderHandler called from TWiki::generateHTTPHeaders TWiki::writeCompletePage
  • modifyHeaderHandler called from TWiki::generateHTTPHeaders TWiki::writeCompletePage
  • WRITE COMPLETED PAGE
  • completePageHandler called from TWiki::writeCompletePage

Discussion

Old stuff from 2004 removed, see older revs

I really miss having an up to date version of this topic

-- KennethLavrsen - 29 Jan 2008

You could always read the code. TWiki is already one of the most clearly documented open-source projects i have encountered, so it makes sense.

If you really want this sort of flow picture, then I would recommend identifying a suitable code flow analysis tool. The trouble with the sort of linear flow that Walter documented above, and the reason I have never refreshed it, is that it's a work of fiction. Here's why:

  • TWiki is a data-driven tool. The code flow changes depending on the content of the topic being rendered
  • The flow is different depending on the entry point (edit, view, preview, etc)
  • The flow is quite complex. Much more complex than the summary above.
  • Summaries are misleading, and cannot substitute for reading the code.
Personally I use the Monitor class to track progress through the code so I can see the flow being executed for a specific scenario, but you need to read the code to use Monitor.

Having said that, there is an overall flow in TWiki that would bear documenting at a 10,000 foot level. But it is so simple I'm not sure how useful it would be:

  1. initialise static TWiki using BEGIN blocks in the TWiki module (step skipped in subsequent mod_perl runs)
  2. call UI::run with the name of a TWiki/UI/* module. This instantiates a TWiki object.
    1. ...different flow for each UI module... Each module compiles and prints an HTML page. A general overview is:
      1. evaluate non-user specific preferences
      2. initialise user system, and identify this session's user
      3. evaluate user specific preferences
      4. check access permissions (read the code for details)
      5. check data existence (see the code)
      6. for each block of HTML in the output:
        1. expand TWiki variables (as described in the code)
        2. render TML (headings, tables, lists, WikiWords etc etc)
  3. catch exceptions and report them using oops

But that doesn't subsititute for reading the code. wink

-- CrawfordCurrie (and a little SvenDowideit) - 29 Jan 2008

Reading the code. Yes. We all do. I know you have been buried in the code for years and know it like your pocket. To me it is still not obvious how the flow is.

It is the 10000 - maybe 5000 foot view - I miss.

And I specially miss the sequence of events seen in context of the plugin handlers.

It is the logical flow of what happens relative to the plugin handlers that I miss when I write a plugin so I know what has happened at a higher logical level. Not as pseudo code but just plain words so when I read the code I have an idea what is going on.

I am looking for maybe 20 bullets where the 10 of them are the plugin handlers. And it would be one list of bullets for view, one for edit, one for save.

-- KennethLavrsen - 30 Jan 2008

I can see your point. I still get lost in the plugin handlers myself, so I can appreciate how hard it is for new folks. It's still not easy to write the document, though. Bullets are inadequate, what's really needed are flow charts. But they would be horrendous to generate. Another alternative is to use Monitor to instrument and record the plugin handler calls, and then fill in the gaps.

-- CrawfordCurrie - 30 Jan 2008

Edit | Attach | Watch | Print version | History: r17 < r16 < r15 < r14 < r13 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r17 - 2008-02-19 - CrawfordCurrie
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.