create new tag
, view all tags

Feature Proposal: Backup & Restore Utility


1. TWiki does not have a backup solution. We can raise the professional level of TWiki by adding a robust backup solution.

2. TWiki is known to be hard to upgrade. An intelligent backup & restore utility can be used to easily backup an old TWiki, then restore content to the new TWiki.

Description and Documentation

This proposal is for a new BackupRestorePlugin that is to be pre-installed in upcoming IstanbulRelease (TWiki-5.1). The plugin can be installed in older TWiki releases to create a backup that can be restored on the latest release.

Key features

  • Operation restricted to members of the TWikiAdminGroup.
  • Use dedicated backup directory that holds all backups.
  • Backup via cron job and via console screen.
  • Restore via console screen.
  • Console screen to interactively backup and restore a live TWiki:
    • List all backups.
    • Delete a backup.
    • Restore a backup.
    • Create backup now.


  • Topics:
    • TWiki.BackupRestorePlugin - plugin doc page.
    • TWiki.BackupRestoreConsole - backup & restore page.
  • Configuration:
    • {Plugins}{BackupRestorePlugin}{BackupDir} - Backup destination directory. Default: /tmp.
    • {Plugins}{BackupRestorePlugin}{KeepNumberOfBackups} - keep number of backups (e.g. delete old backups), 0 to keep all. Default: 5.
    • {Plugins}{BackupRestorePlugin}{TempDir} - temp directory. Default: /tmp.
    • {Plugins}{BackupRestorePlugin}{createZipCmd} - create zip command. Default: zip -r.
    • {Plugins}{BackupRestorePlugin}{listZipCmd} - list zip content command. Default: unzip -l.
    • {Plugins}{BackupRestorePlugin}{unZipCmd} - unzip command. Default: unzip -o.
    • {Plugins}{BackupRestorePlugin}{Debug} - debug flag. Default: 0.
  • Backup names:
    • twiki-backup-2018-06-21-08-08.zip - full backup.
    • twiki-backup-2018-06-21-08-08-incr.zip - incremental backup (for later phase of implementation).
  • Script:
    • bin/backuprestore - for cron job; recommended to backup once a week on Sunday early morning
  • Interactive backup & restore:
    • Done via %BACKUPRESTORE{}% variable in BackupRestoreConsole page.
    • Variable is protect to TWikiAdminGroup members; other users see a message: "Only members of the TWikiAdminGroup can see the backup & restore console."
  • Backup format of .zip file:
    • data/* - all data and logs.
    • pub/* - all attachments.
    • working/* - working data.
    • working/BackupRestorePlugin/LocalSite.cfg - TWiki configuration file (if found).
    • working/BackupRestorePlugin/LocalLib.cfg - TWiki lib file (if found).
    • working/BackupRestorePlugin/twiki.conf - Apache config file (if found).
    • working/BackupRestorePlugin/version.txt - contains the TWiki version number of the backup. Used to intelligently restore backup to newer TWiki version. Example:
      version: TWiki-5.1.0
      short: 5.1
    • working/BackupRestorePlugin/version-long-TWiki-5.1.0.txt - file with TWiki version in filename
    • working/BackupRestorePlugin/version-short-5.1.txt - file with TWiki short-version in filename, name version-short-<major>.<minor>.txt

Console Screen

The following screens are non-working mock-ups.

Main console view

Backup Action
Compressed Zip archive twiki-backup-2018-06-21-08-08.zip
Compressed Zip archive twiki-backup-2011-01-09-03-15.zip  
Compressed Zip archive twiki-backup-2011-01-02-03-15.zip  
Compressed Zip archive twiki-backup-2010-12-26-03-15.zip  
Compressed Zip archive twiki-backup-2010-12-19-03-15.zip  
Compressed Zip archive twiki-backup-2010-12-12-03-15.zip  
Compressed Zip archive twiki-backup-2010-12-05-03-15.zip  


  • Backups are located at /var/www/twiki-backups
  • To upgrade an older TWiki: (1) install the BackupRestorePlugin on the old TWiki, (2) take a backup of the old TWiki, (3) transfer the backup file to the new TWiki's backup directory, (4) select and restore the old backup.

Main console view, while backup is created

Backup Action
Compressed Zip archive twiki-backup-2018-06-21-08-08.zip Processing Creating backup, please wait
Compressed Zip archive twiki-backup-2011-01-09-03-15.zip  

Delete backup confirmation

No Do you want to delete the backup twiki-backup-2010-12-05-03-15.zip?   Cancel

Detail / Restore console screen

Details of twiki-backup-2011-01-09-03-15.zip:
Backup file: twiki-backup-2011-01-09-03-15.zip
Backup date: 2011-01-09 03:15
Backup of: TWiki-4.3 - the TWiki version this backup was taken from
This TWiki: TWiki-5.0.1 - the TWiki version of the current installation
Restore Options:
Use latest system pages (WebSearch, etc)
Overwrite pages on restore
Restore TWiki Webs:    
TWiki - do not restore over a different TWiki version!
_default - do not restore over a different TWiki version!
Restore action:

Restore from backup confirmation

Yes / Done Do you want to restore from backup twiki-backup-2010-12-05-03-15.zip?   Cancel
ALERT! Attention: Existing topics are overwritten! If applicable, make a backup of the current system before restoring from backup.



Ideas for Enhancements

  • Support incremental backup, and restore from incremental backup.
  • Upload backup via browser, so that it is easy to migrate a TWiki to a new version via browser.
  • Show free disk space.
  • Check for disk space, abort and complain if not enough.
  • Old Cairo release has locked RCS files. Unlock them before restore.

-- Contributors: PeterThoeny - 2011-01-14


A backup/restore function might let us simplify test case development and/or enhance debugging failed testcases. I envision automated backups of the TestCases Web at the beginning and end of execution of each automated test case but don't yet understand enough about TWiki internals to know if this is feasible. I realize the value of the set_up function (as outlined in the TestCaseTutorial topic) in "seeding" the required test case test data because it eliminates any dependencies between the test data and what version of of TWiki is being tested, but the matching tear_down function appears to exist only because of the lack of an automated restore. Why require developers to include a function to remove test data if you have a backup of the data itself? In addition not having a copy of the TestCases Web after execution of each testcase is a disadvantage when debugging.

-- GeorgeTrubisky - 2011-01-17

Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2011-08-23 - 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-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.