Topic on Extension talk:Include

Jump to navigation Jump to search

Included file doesnt update (solution: new keyword 'nocache')

3
Peachey88 (Flood) (talkcontribs)

When I include a local file, it only updates when I edit and save page. How can I get it to update by just reloading the page?

This post was posted by Peachey88 (Flood), but signed as 88.115.199.237.

Peachey88 (Flood) (talkcontribs)

This is a limitation of MediaWiki. Note that external content is only refreshed when you save the wiki page that contains the <include/>. Changing the external file WILL NOT update the wiki page until the wiki page is edited and saved (not merely refreshed in the browser). You can also instruct the server to refresh the page by adding the refresh action. See w:en:Wikipedia:Bypass_your_cache#Server_cache . You can add the following to a wiki page to make it easier to clear the cache //www.mediawiki.org/w/index.php?title=Topic:Qbxx7rlqob6nul7m&action=purge

This post was posted by Peachey88 (Flood), but signed as Noahspurrier.

Peachey88 (Flood) (talkcontribs)

At the very end of the module, you could add these lines, which disables page caching when it finds "nocache" keyword as in <include ... nocache />. This will disable the cache for pages that use the include tag.

function ef_include_render( $input, $argv, $parser ) {
    ...
    # http://www.mediawiki.org/wiki/Extensions_FAQ#How_do_I_disable_caching_for_pages_using_my_extension.3F
    if ( !empty( $argv['nocache'] ) ) {
        $parser->disableCache();
    }

    return $output;
}

Such an option will be part of a new version of the extension. Another possibility is to install MagicNoCache and to add the magic word to your page, or to install one of the alternatives mentioned on bottom of that page.

This post was posted by Peachey88 (Flood), but signed as Wikinaut.

Reply to "Included file doesnt update (solution: new keyword 'nocache')"