Mount your WebGUI database and edit templates as files

Index

NAME

Top

webgui.pl - mount WebGUI templates as filesystem

SYNOPSIS

Top

 webgui.pl /data/WebGUI/etc/webgui.conf /mnt

DESCRIPTION

Top

With this script, you can utilize Fuse and Fuse::DBI modules to mount templates from WebGUI and edit them using command-line utilities (like vi or ftp).

It will present templates in WebGUI as directory tree consisting of directories (which represent template's namespace) and files (which are templates from database). If template name has slash (/) in name, deeper directories will be created.

Template files will have correct lengths and write permissions which are specified in WebGUI database.

Fuse module

Fuse::DBI module (which is core of this utility) uses Fuse perl bindings. Perl bindings are rather new addition to Fuse, so you will need recent CVS version of Fuse. Current stable version doesn't include perl binding, so you will probably have to compile Fuse yourself (see FUSE documentation for details about compilation and installation).

After compilation and installation of fuse kernel module and Fuse perl bindings for it, you will have to load fuse module into kernel. For that, you will have to be root. If you are not administrator on particular machine, ask your admin to install and load fuse module for you.

If you used fusermount command before running this script, module will be already loaded.

unsupported operations

There is no support for creation of new templates, renaming, or deleting. Although those operations map nicely to file system semantics there are still possible only using WebGUI web interface.

invalidating of on-disk templates

Every write operation will erase all templates on disk (so that next reload on browser will show your changes). It would be better if just changed template is erased, but this works well enough. You might notice performance penalty of this simplification if you are running very loaded production site.

You have to have write permission on uploads/temp/templates/ directory for your WebGUI instance for this to work. If you don't Fuse::DBI will complain.

supported databases

This script have embedded SQL queries for MySQL and PostgreSQL. Other databases could be supported easily. Contributions are welcomed.

database transactions

Fuse::DBI uses transactions (if your database supports them) to prevent accidental corruption of data by reading old version. Depending on type of database back-end, MySQL users might be out of luck.

recovering from errors

Transport endpoint is not connected is very often error when Fuse perl bindings exit without clean umount (through Fuse::DBI umount method or with fusermount -u /mnt command).

This script will automatically run fusermount -u /mnt if it receives above error on startup. If it fails, mount point is still in use (that happens if you changed directory to mount point in other shell). Solution is simple, just change directory in other back to $HOME (with just cd) and re-run this script.

missing Data::Config

If this script complains about missing Data::Config module, you will have to point path at top which points to lib directory of WebGUI installation. By default it points to /data/WebGUI:

 use lib '/data/WebGUI/lib/';

SEE ALSO

Top

Fuse::DBI website http://www.rot13.org/~dpavlin/fuse_dbi.html

FUSE (Filesystem in USErspace) website http://fuse.sourceforge.net/

AUTHOR

Top

Dobrica Pavlinusic, <dpavlin@rot13.org>

COPYRIGHT AND LICENSE

Top