Save all Wiki content

456 views
Skip to first unread message

Reynier Perez Mira

unread,
Apr 2, 2008, 10:17:28 PM4/2/08
to trac-...@googlegroups.com
Hi every:
It is posible save all wiki pages including images and directories? I do this trac-admin /path/to/env wiki dump /path/to/dump but this only save Pages and I don't want this because all images stored in the Wiki are lost. Any guide or chance to do this?
Cheers and thanks in advance

Ing. Reynier Pérez Mira
Grupo Soporte al Desarrollo - Dirección Técnica IP

Jason Winnebeck

unread,
Apr 3, 2008, 8:16:05 AM4/3/08
to trac-...@googlegroups.com
If you combine your backup with the attachments directory, you can preserve the attachments. I've never done a wiki dump before, but I would suspect based on what I've heard that it is quite possible that the associations between pages and attachments won't be restored in the DB when you restore the wiki. If you are just simply trying to backup Trac, you could consider archiving the entire environment, preserving DB and attachments?

Jason

jmt4b04d4v

unread,
Apr 21, 2008, 11:46:40 PM4/21/08
to Trac Users
Hola compañero,

On Apr 2, 10:17 pm, "Reynier Perez Mira" <rper...@uci.cu> wrote:
> Hi every:
> It is posible save all wiki pages including images and directories? I do this trac-admin /path/to/env wiki dump /path/to/dump but this only save Pages and I don't want this because all images stored in the Wiki are lost. Any guide or chance to do this?

Well images at wiki pages are mostly[1] attachments stored physically
in the related trac enviroment, and the logical relations to wiki
pages are stored at the 'attachment' table in the related trac
enviroment database backend (SQLite mostly). If you can't or don't
want to dump and restore the complete database, maybe you can...

[1] Image macro can fetch files directly from the repository.

1. Dump the wiki pages from the source trac enviroment:
$ trac-admin path/to/some/tracenv/ wiki dump /path/to/dump/wiki/pages
2. Dump the 'attachment' table only (example if SQLite is the
backend):
$ sqlite -batch /path/to/some/tracenv/db/trac.db ".dump attachment" >
trac-attachment.sql
3. (Optionally if ticket attachments are not relevant) Filter the wiki-
attachment entries in that table (rough example):
$ cat trac-attachment.sql | grep "'wiki'" | trac-attachment-wiki-
entries.sql
4. Restore the wiki pages to the target trac enviroment:
$ trac-admin /path/to/another/tracenv/ wiki load /path/to/dump/wiki/
pages
5. And finally restore data in the target trac enviroment database
(example if SQLite is the backend)
$ sqlite -batch /path/to/another/tracenv/db/trac.db ".read trac-
attachment-wiki-entries.sql"

Of course you must also copy the physical file attachments stored in /
path/to/some/tracenv/attachments/wiki/* to the target location /path/
to/another/tracenv/attachments/wiki/* (you may need to create a 'wiki'
folder under attachments folder in the target trac enviroment).

This way you can preserve all attachments and not only image files.

For information about Trac's database schema take a look at:

* http://trac.edgewall.org/wiki/TracDev/DatabaseSchema

I hope this helps.
--------------------------------------------------------
Johans Marvin Taboada Villca -`^_^´- .o0O( 2007-04-24, Bienvenida
Bebecita )
--------------------------------------------------------
Reply all
Reply to author
Forward
0 new messages