Tags:
caching2Add my vote for this tag create new tag
, view all tags

Caches URLs referenced in the text.

Copy referenced webpages to the TWiki server to avoid broken links

Introduction

This is a plugin which will download a web page that is referenced in a topic and change the link to point to the cached page. The cached pages will have a date showing when it was cached, and a link to the original page.

There are two ways of caching a page, either as a new topic, or as a separate data file (similar to attachments). See below under Syntax Rules for more information on how to define what type of caching is done. In either case clicking the link will open the page in the current browser window.

Please note that web pages are only cached the first time the are found, the link is then changed so it will not be re-cached.

Syntax Rules

Any string that begins with http or https and is at the beginning of a line or has a space before it will be cached. The URL is assumed to be everything from the beginning of the http(s) until a space or end of line is encountered. If you have a URL that includes a space you should replace the space with the code %20.These pages will be downloaded with any style sheets and/or images as well, i.e. it attempts to make a exact copy of the original page.

If you add a + (plus sign) in front it will cache it as a new topic. The topic will use the URL minus the http:// prefix as the name. In this case the page will only be stored as plain text, with some very basic formatting attempted.

The difference between caching as a standalone page or as a topic is that topics can be searched through the normal TWiki search engine.

To avoid having URLs cached you have three options:

  • For single URLs just make sure it does not have spaces around it, you may use normal brackets: (http://mylink.com) or a TWiki formatting code such as underscores for italic.
  • For an entire page put the following code anywhere in the page: <!--NOCACHE--> this is in fact a hidden HTML comment and will not show up in the page itself.
  • For an entire web (for instance the main TWiki web which has lots of pointers to live support information) add them to the IGNORE setting below. By default the TWiki web is there already.

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %URLCACHEPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Copy referenced webpages to the TWiki server to avoid broken links

  • Stop these webs from being cached, list them as a comma separate list here
    • Set IGNORE = TWiki06x00

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • For an automated installation, run the configure script and follow "Find More Extensions" in the in the Extensions section.

  • Or, follow these manual installation steps:
    • Download the ZIP file from the Plugins home (see below).
    • Unzip URLCachePlugin.zip in your twiki installation directory. Content:
      File: Description:
      data/TWiki/URLCachePlugin.txt Plugin topic
      lib/TWiki/Plugins/URLCachePlugin.pm Plugin Perl module
    • Set the ownership of the extracted directories and files to the webserver user.

  • Plugin configuration and testing:
    • Run the configure script and enable the plugin in the Plugins section.
    • Test if the installation was successful: Create a page with a URL in the Sandbox web.
    • If you have some webs that you do not want to use the cache for, set them in the IGNORE setting in this topic.

Plugin Info

Plugin Author: TWiki:Main.ArildBergh
Copyright: © 2005 TWiki:Main.ArildBergh
© 2008-2011 TWiki:TWiki.TWikiContributor
Plugin Version: 2011-05-10
Change History:  
2011-05-10: TWikibug:Item6701: Fix plugin to use only published API; doc improvements -- TWiki:Main.PeterThoeny
10 Jun 2005: Initial version
CPAN Dependencies: CPAN:Date::Format, CPAN:HTML::FormatText, CPAN:HTML::Parse, CPAN:LWP::UserAgent, CPAN:HTML::LinkExtor, CPAN:File::Basename, CPAN:Time::ParseDate, CPAN:Date::Format
Other Dependencies: none
Perl Version: 5.0
TWiki:Plugins.Benchmark: GoodStyle 99%, FormattedSearch 99%, URLCachePlugin 99%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/URLCachePlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/URLCachePluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/URLCachePluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatmd5 URLCachePlugin.md5 r4 r3 r2 r1 manage 0.2 K 2011-05-11 - 06:16 PeterThoeny  
Compressed Zip archivetgz URLCachePlugin.tgz r4 r3 r2 r1 manage 6.7 K 2011-05-11 - 06:16 PeterThoeny  
Compressed Zip archivezip URLCachePlugin.zip r6 r5 r4 r3 r2 manage 8.2 K 2011-05-11 - 06:15 PeterThoeny  
Unknown file formatEXT URLCachePlugin_installer r2 r1 manage 3.4 K 2011-05-11 - 06:16 PeterThoeny  
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2013-10-16 - PeterThoeny
 
  • 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-2016 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.