[ic] Catalog self-test
Kevin Walsh
kevin at cursor.biz
Wed Sep 24 18:53:05 EDT 2003
Mike Heins [mike at perusion.com] wrote:
> Quoting Marc Brevoort (marc.brevoort at armazemdedados.com):
> > Some of the catalogs that I developed would benefit from running a self
> > test.
> >
> > For example, checking for the presence of a certain stored procedure in
> > the database and creating it when not present.
> >
> > Such a test would only need to be performed on catalog startup. Is this
> > possible (we use 4.8.6)? It would be nice if this check would already
> > have interchange functionality available.
> >
> You can do this type of thing in a Global UserTag, but it would have
> no way of divining things from catalog configuration.
>
> Sounds like something Stefan could add to Jobs -- an on_catalog_init job.
>
It could be added as a new site configuration directive, as follows:
interchange.cfg:
GlobalSub <<EOS
sub wrap_cataloginit {
package Vend::Config;
sub parse_cataloginit {
my ($directive,$value) = @_;
return undef unless $value =~ /yes/i;
#
# the following is an example of how to get access
# to the site's configuration
#
::logGlobal("vendroot=$C->{VendRoot}");
1;
}
}
EOS
AddDirective CatalogInit cataloginit
catalog.cfg (at the end, when all other config is complete):
CatalogInit Yes
I have no idea whether database access would be possible with this
sort of setup - it would have to be tried and experimented with.
The parse_cataloginit() could simply call an external script to do
some of the work.
A solution as part of the Jobs system would be cleaner, of course.
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin at cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
More information about the interchange-users
mailing list