Discuss $smwg­Factbox­Use­Cache

From semantic-mediawiki.org


Thread titleRepliesLast modified
Don't get it611:10, 9 February 2014
Can't disable factbox000:30, 7 February 2014

Don't get it

I don't understand when the factbox used to be parse and when it will when this variable is set to true:

  1. was it parsed every time the page was displayed?
  2. will it be parsed every time changes are previewed as it used to be -- or only after a new version has been saved?
10:37, 10 January 2014

Prior SMW 1.9, the design was that on each page request the factbox would run a Store fetch, transform the data into a string, and parse the string through MW's Parser object in order to inject the result into the Skin object.

If $smwgFactboxUseCache is set false it will do as describe above (legacy behavior) if it is set true then only on a new revision the Factbox is re-build and successively stored as cache object. This means that on each page request the Factbox is retrieved from cache if the revisionId is available otherwise it is rebuild.

For details on the implementation, have a look at the appropriate source and test files ([1], [2]).

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/includes/FactboxCache.php

[2] http://wikimedia.7.x6.nabble.com/Why-do-FactBoxes-only-display-once-tp5019607.html

12:05, 10 January 2014

Thank you, though I still don't get it.

Let me put it another way: what should be the settings to display the factbox based on parsed wikitext (not looked up in the database) on page preview (and not the message "Historical data can not be displayed in a Factbox"), as it used to be before SMW 1.9?

16:39, 6 February 2014

"Historical data" never worked with the Factbox, now it only ensures the users doesn't take it for granted by displaying a message.

If you are still not sure as to what and how $smwgFactboxUseCache is used (I think the description is quite clear namely to lower latency when Factbox content needs to is parsed), just use the legacy setting (false) and the Factbox build will be executed on each page request whether the content has changed or not.

For some idea about cache vs. non-cached, see [1].

[1] https://github.com/SemanticMediaWiki/SemanticMediaWiki/commit/5a82da8316bba059da047912e94197a3b9496828

18:16, 6 February 2014

I have set this variable to true and false. Both ways, I get "Historical data can not be displayed in a Factbox" when I edit a page and nothing at all when I create it.

I am still not sure I have managed to communicate what I try to achieve. I want the factbox to be displayed in the bottom of the page after I press the "Show preview" button (action=submit), based only on the parsed wikitext, without the page's even needing to exist ($smwgShowFactboxEdit = SMW_FACTBOX_NONEMPTY did it, I presume), just as it was in SMW 1.8.

Anyway, I look at http://semantic-mediawiki.org/doc/Factbox_8php_source.html, line 244, and see that the message about historical data is shown every time there is an oldid in POST or GET parametres, regardless of any configuration settings. This makes clear why there is a message "Historical...' but not why there is no factbox.

19:25, 6 February 2014

Now I understand, try to replace $this->context->getRequest()->getCheck( 'oldid' ) with $this->context->getRequest()->getInt( 'oldid' )

19:55, 6 February 2014

Can't disable factbox

This is an interesting thread about Factbox caching, especially this in-depth insight.

00:30, 7 February 2014