[ic] Managing Database Structure Changes

Marty Tennison marty at dripdepot.com
Mon Jun 1 22:53:24 UTC 2009


Stefan Hornburg (Racke) wrote:
> OK, that is definitely a good idea. I didn't think of it yet, so wellwell
> catalog.cfg doesn't support it.
>
> Please share your catalog.cfg.
>
>   

Hi Racke,

The following is my configuration.   split the catalog.cfg file into 
multiple files.  most of the work is done in default.cfg

The configuration does the following.

1) Use common directories for all catalog files.
2) Allow each catalog to override any file.
3) Allow each catalog theme to override catalog or common files.
4) Do it all automatically

This setup allows me to have 3 levels of customization. which are....

Shared
....Catalog
...........Catalog-Theme

Catalog-Theme has highest priority.

For example, I could have index.html in the shared directory for all 
catalogs.  As soon as I create a file called index.html in the Catalog 
or the Catalog-Theme directory, interchange would find it and use it 
first. 

I achieve this by using a "home" directory for each catalog.  Then, in 
the home directory I use symlinks to the various directories for 
organizational purposes. I link catalog.cfg to some catalog specific 
file. The config file is commented.  I hope it makes sense.

The nice thing about this setup is that to have a file override a shared 
file, all I have to do is create the file in the correct directory and 
interchange finds it automatically.  So maintaining catalog specific 
changes is painless and since the catalog specific files are in a 
logical directory structure, it is easy to figure out, follow and maintain.

Here is my catalog.cfg for all my catalogs.  The only things I have to 
change are the SERVER_NAME and CATALOGNAME, from that point on, it's all 
shared.

#==========================================================================#
# catalogs.cfg
#==========================================================================#
ParseVariables  Yes

#==========================================================================#
# Set some variables that are unique to this catalog only
#==========================================================================#
Variable SERVER_NAME    test_cat_1.com
Variable CATALOGNAME    test_cat_1

#==========================================================================#
# Include the default configuration for all catalogs
#==========================================================================#
include config/default.cfg

#==========================================================================#
# Include any catalog specific configurations
#==========================================================================#

# end of catalog.cfg









#==========================================================================#
# default.cfg
#==========================================================================#
# This is the default configuration file for all shared catalogs.
#==========================================================================#

# Parse variables in this configuation file.
ParseVariables  Yes

#==========================================================================#
# Set some variables
#==========================================================================#
Variable WWW_ADDRESS    www.__SERVER_NAME__
Variable SECURE_SERVER  https://__WWW_ADDRESS__
Variable WWW_SERVER     http://__WWW_ADDRESS__
Variable HOMEDIR        __CATALOGDIR__/home/__CATALOGNAME__
Variable DOCROOT        /var/www/vhosts/__SERVER_NAME__/httpdocs
Variable CACHEDIR       /var/cache/interchange/__CATALOGNAME__
Variable LOGDIR         /var/log/interchange/__CATALOGNAME__
Variable CGI_DIR        /var/www/vhosts/__SERVER_NAME__/cgi-bin
Variable CGI_URL       


# Override the default data directory (default is products)
DataDir data

#==========================================================================#
# Read in shared variables for all catalogs
#==========================================================================#
VariableDatabase variable

# Shared variables
Include  data/variables/default_variables.txt

#==========================================================================#
# Read in catalog specific variables, overriding shared if they exist
#==========================================================================#
Database __CATALOGNAME___variables 
variables/__CATALOGNAME__/__CATALOGNAME___variables.txt TAB
VariableDatabase __CATALOGNAME___variables

#==========================================================================#
# Read in any local/dev variables (if they exist)
#==========================================================================#
Variable DEV_DIR /var/lib/icdev
include __DEV_DIR__/data/variables/variables.txt
include 
__DEV_DIR__/data/variables/__CATALOGNAME__/__CATALOGNAME___variables.txt


#==========================================================================#
# Read in templates
#==========================================================================#
DirConfig  Variable  templates
DirConfig  Variable  templates/__CATALOGNAME__
DirConfig  Variable  css/__CATALOGNAME__

ifdef MV_DEMO_MODE
TemplateDir    __DEV_DIR__/pages
TemplateDir    __DEV_DIR__/blocks
endif


ifdef THEME
#==========================================================================#
# If we have a theme set (Variable THEME) then adjust the search
# order of PageDir and TemplateDir so that the theme specific
# directories are searched in the correct order.
Message Configuring catalog __CATALOGNAME__ with theme __THEME__ ...
#==========================================================================#

# Include a theme file for any theme specific configurations
# This is not required, only optional. Theme files are read
# in ascending order (or bottom up) so that theme configuration
# files are read last so they can override other settings.
include        config/__THEME__.cfg
include        config/__CATALOGNAME__/__THEME__.cfg

# Pick up an entire directory of variables if defined.
DirConfig      Variable      templates/__THEME__
DirConfig      Variable      templates/__CATALOGNAME__/__THEME__
DirConfig      Variable      css/__THEME__
DirConfig      Variable      css/__CATALOGNAME__/__THEME__

# Setup the catalog pages directory, this takes precedence over TemplateDir.
PageDir        pages/__CATALOGNAME__/__THEME__

# Now we set TemplateDir.  We include the PageDir directory so that files
# relative to the PageDir directory will be found.
TemplateDir    pages/__CATALOGNAME__/__THEME__
TemplateDir    pages/__THEME__
TemplateDir    pages/__CATALOGNAME__

# Now we setup the search order for the blocks directory.
TemplateDir    blocks/__CATALOGNAME__/__THEME__
TemplateDir    blocks/__THEME__

# If used, define search order of tables and directories for page data.
# PageTables  page_data___CATALOGNAME_____THEME__
# PageTables  page_data___CATALOGNAME__

endif

#==========================================================================#
# If no theme is defined then we set the PageDir
#==========================================================================#
ifndef THEME
PageDir        pages/__CATALOGNAME__
endif

#==========================================================================#
# These get set regardelss of theme existence.
#==========================================================================#
TemplateDir    pages/__CATALOGNAME__
TemplateDir    pages
TemplateDir    blocks/__CATALOGNAME__
TemplateDir    blocks
# PageTables     page_data___CATALOGNAME__
# PageTables     page_data

#==========================================================================#
# All done with PageDir, TemplateDir and Themes. 
# Now we setup general conifuration stuff
Message Sending  __CATALOGNAME__ errors to __LOGDIR__/error.log
#==========================================================================#

# Removed some stuff for this example

#==========================================================================#
# Include external configuration files.
#==========================================================================#
include config/db.cfg
include config/jobs.cfg
include config/payment_routes.cfg
include config/order_profiles.cfg
include config/order_routes.cfg
include config/functions.cfg
include config/pricing.cfg
include config/sales_tax.cfg
include config/shipping.cfg
include config/scratch.cfg
include config/userdb.cfg
include config/search.cfg

#==========================================================================#
# Include local actionmaps.
#==========================================================================#
include actionmap/__CATALOGNAME__/*.actionmap

#==========================================================================#
# Include local usertags.
#==========================================================================#
include usertag/__CATALOGNAME__/*.usertag

#==========================================================================#
# Include custom filters at the catalog level.
#==========================================================================#
include filter/__CATALOGNAME__/*.filter

#==========================================================================#
# General configuration stuff
# Everything below this line is "odds and ends" stuff (which may be VERY
# important) but they do not warrant an individual config file
#==========================================================================#


# Stuff here, cleared out for clarification


#==========================================================================#
# Read in any local/dev pragmas or settings
#==========================================================================#
include __DEV_DIR__/config/dev_default.cfg




-- 
-  - -- ----  ---------------------------- --- -- -   -
Marty Tennison                     DripDepot.com
web: www.dripdepot.com

-  -- --- --------------------------------------- --- --




More information about the interchange-users mailing list