Tags:
create new tag
, view all tags

GetAWebAddOn version 0.6

Background

Sometime I find useful to make a zipped copy of a whole Web from remote (for backup or offline reading).

Here I enclose a small package for zipping a whole Web.

Supported File Formats

The script produces files in the formats:

  • .tar.gz
  • .zip
  • .tar.bz2

Usage

Web Format Versions URI
Webname zip all %SCRIPTURL%/get-a-web%SCRIPTSUFFIX%/Webname.zip
Webname tgz (or tar.gz) all .../get-a-web/Webname.tgz (or .tar.gz)
Webname tar.bz2 all .../get-a-web/Webname.tar.bz2
Webname zip last .../get-a-web/Webname.zip?lastOnly=yes
Webname tgz (or tar.gz) last .../get-a-web/Webname.tgz?lastOnly=yes (or .tar.gz)
Webname tar.bz2 last .../get-a-web/Webname.tar.bz2?lastOnly=yes
all webs zip all .../get-a-web/all.zip
all webs tgz (or tar.gz) all .../get-a-web/all.tgz (or .tar.gz)
all webs tar.bz2 all .../get-a-web/all.tar.bz2
all webs zip last .../get-a-web/all.zip?lastOnly=yes
all webs tgz (or tar.gz) last .../get-a-web/all.tgz?lastOnly=yes (or .tar.gz)
all webs tar.bz2 last .../get-a-web/all.tar.bz2?lastOnly=yes

Security

  • All the data/pub/template files of the chosen web are zipped, except for the .htaccess and .htpasswd and the *.lock files.
  • User authentication can be handled with apache <Location> directive.

Installation

  • put the attached get-a-web script in the bin directory
  • put and edit the attached GetAWebAddOn.txt page in the data/Web dir of your choice
  • put the attached getweb-list.txt in the same directory
  • if the data/pub/templates directories are not in the same dir change the commented "system" lines at the end of the get-a-web script.
  • set the rights of the files as in the rest of your twiki

TODO

  • For offline reading it would be better to fully render all the pages to html before zipping.

NEW

  • now get-a-web can be used as a link, as it gets the compression type from the URI itself
  • With the additions below you can just write TWiki.tgz in your text and you give your public the chance to get the whole TWiki set of topics (last version only).

If you want Automagic GetAWebAddOn Links

  • Add the rendering rule
#AS
    # Automatically gets a web content
    s#(^|\s)(([A-Z][a-zA-Z0-9]*[\.\/])*([A-Z][a-zA-Z0-9]*))\.((zip)|(tgz)|(tar\.gz)|(tar\.bz2))(\s|$)#"$1".&handleGetAWeb("$2","$4","$5","yes")."$10"#geo;
#AS

  • And add the sub
#AS
# =========================
sub handleGetAWeb
{
    # we substitute the web with a get-a-web link
    my ($web, $name, $zip, $lastOnly) = @_ ;

    $web =~ s/\./\//go ;

    if (webExists($web)) {
   return "<<nop>b><<nop>A href=\"$scriptUrlPath/get-a-web$scriptSuffix/$web.$zip?lastOnly=$lastOnly\">$name.$zip<<nop>/A><<nop>/b>";

    }
    return "$n<nop>ame.$z<nop>ip";
}
#AS

-- AndreaSterbini - 17 Sep 2000

This is a useful extension. I will wait with placing it into the TWiki distribution until we have Admin acccess restrictions.

A nice To-Do would be to be able to run the script as CGI or shell script, e.g. determine this at run time. Running it as a shell script could be used to automatically archive webs from a cron job.

Regarding how to suggest to the web browser the file name, try this: Set the mime type to application/binary (or whatever mime-type your binary file is). In the call to cgi do this:

twiki/bin/get-a-web/namebrowerwillsaveas.zip

-- PeterThoeny - 16 Aug 2000

Thanks for the suggestion, I have changed the code so that you can do remote backups with the wget utility. E.g.:

  • wget http://yourname:yourpassword@twiki.sourceforge.net/cgi-bin/get-a-web/TWiki.tgz?lastOnly=yes

-- AndreaSterbini - 17 Sep 2000

How about using http://search.cpan.org/search?mode=module&query=Archive and http://search.cpan.org/search?mode=module&query=Compress modules rather than system calls.

-- NicholasLee - 17 Sep 2000

Hmm, does anybody have the GetAWebAddOn from this page working?

It looks like an old copy that still uses the wiki:: module rather than the TWiki:: and TWiki::Store modules.

Also I am having no luck downloading the last 2 attachments from this page.

AndreaSterbini help 8-).

-- JohnRouillard - 29 Nov 2001

I would like to have this working and installed on TWiki.org. That way I could contribute while backpacking by editing on my iPAQ.

Has anyone updated this script or does anyone know what it would take to make it work?

Thanks, M.

-- MartinCleaver - 27 Jun 2002

Re: the 'TODO' above. The GenHTMLAddon has all the support you need for static rendering of a web. In fact, it's so obvious I wonder why none of us thought to put these two together before!

-- CrawfordCurrie - 28 Jun 2002

  1. Can this go on TWikiDotOrg now or does anyone fancy making it into a plugin?
  2. Assuming it won't go in the core, who wants to volunteer to be its owner?
  3. Anyone got this to work with BeijingRelease?

-- MartinCleaver - 21 Apr 2003

moved from GetAWebAddOn (which contains the latest version)

-- WillNorris - 11 Oct 2004

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatEXT get-a-web   manage 3.3 K 2000-09-17 - 12:29 AndreaSterbini get-a-web perl script
Texttxt getweb-list.txt   manage 1.1 K 2000-09-17 - 12:33 AndreaSterbini getweb-list.txt contains the form
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2005-10-23 - WillNorris
 
  • 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.