Since Galaxia looks like a good piece of work still waiting to really take off, I tried using it for a workflow module in Xaraya. Here's a little summary of that experience, in case anyone else is thinking of re-using Galaxia outside of TikiWiki. 2003-09-29 updated with the latest CVS changes
- overall, you can simply copy the lib/Galaxia directory and get started (use the CVS version for this, and not 1.7.1.1)
- the config.php file specifies the configuration of the Galaxia Workflow Engine, and you may need to customize that for your environment
- table names all start with GALAXIA_TABLE_PREFIX, so if you want to keep some common table naming convention or have several instances working on the same database, you can change that now
- all hard-coded lib/Galaxia paths have been replaced with the GALAXIA_LIBRARY constant, so you can place the Galaxia lib anywhere you want, basically
- processes are stored in GALAXIA_PROCESSES/*, and activity templates are also copied to GALAXIA_TEMPLATES/* if that constant isn't empty, so you can move the directories that require write access outside of your code base now
- the Galaxia lib is pretty much CMS-agnostic overall as long as you work with ADODB, but you'll want to specify how activity errors should be shown with the galaxia_show_error() function. Some examples are given in the config.*.php files.
- regarding ADODB, you may need to define('DB_FETCHMODE_ASSOC', 2) and do a $db->SetFetchMode(DB_FETCHMODE_ASSOC) before you pass the database handler to Galaxia
- you can specify a template header to be added at the top of new templates via the GALAXIA_TEMPLATE_HEADER constant. For Smarty templates, you could use {*Smarty template*} for instance
- file read operations typically relied on a single fread(...,filesize(...)) call, which often fails to retrieve the complete file on some platforms (e.g. Windows), so that code/template updating was unreliable. Those have been replaced in several places, but some might have been missed. And if you do your own PHP error handling, you'll probably want to verify all @ operations and add some file or directory checking if necessary.
- in src/API/Instance.php, non-interactive activities are executed by making an call to the function galaxia_execute_activity(). In Tikiwiki, this is done via an external web call to tiki-g-run_activity.php, but you'll want to replace that with some API function call, or whatever is most appropriate for your environment.
In short, pretty good re-usability overall - you should count about half a day to handle any portability issues for the Galaxia library itself.
If you want to re-use the tiki-g-* scripts and templates from Tikiwiki as well, to get you started on the GUI side of things, you'll need to :
- specify the current user in $user
- create some fake Userslib that can handle get_users(), get_groups() and get_group_users() calls, and provide a global $userlib variable
- provide global $tikilib and $dbTiki variables pointing to your db connection
- set $maxRecords and some $feature_* and $tiki_p_* variables as well
- insert stripslashes() in a few places in case magic quotes are on, and htmlspecialchars() when templates are being edited
Integrating the scripts, converting the templates and getting things to work overall may take another day or so depending on your environment.
I hope that my modest contribution can help a bit in spreading the use of Galaxia to other PHP environments. It's a great piece of work
|