mite – basics – mysql tables and app configuration

mite isn’t so much a dedicated application as it is a collection of directory structures, modules, and implementation philosophy. Here are some of the basics of how it works, and why.

see also : directory structure and server configuration

DATABASE CONFIGURATION
mite requires a certain minimum database structure to operate. Each application based on mite will have different needs, but there are a few common tables that are needed for basic operations. In fact, the application specific data doesn’t even need to be in the same database.

Here is the basic SQL for building the needed tables :

DROP TABLE IF EXISTS `Config`;
CREATE TABLE `Config` (
`Attribute` varchar(255) NOT NULL,
`Value` text,
PRIMARY KEY (`Attribute`)
);

DROP TABLE IF EXISTS `URLMap`;
CREATE TABLE `URLMap` (
`MapName` varchar(255) NOT NULL,
`Description` varchar(255) NOT NULL,
`URLMatch` varchar(255) NOT NULL,
`Vars` text,
PRIMARY KEY (`MapName`,`URLMatch`)
);

DROP TABLE IF EXISTS `ControllerPermissions`;
CREATE TABLE `ControllerPermissions` (
`UID` int(11) NOT NULL auto_increment,
`Controller` varchar(255) NOT NULL,
`CheckType` enum('require','optional','deny') NOT NULL default 'require',
`Operator` enum('equal','match') NOT NULL default 'equal',
`Variable` varchar(255) NOT NULL,
`Value` varchar(255) NOT NULL,
`InterpretValue` enum('yes','no') NOT NULL default 'no',
PRIMARY KEY (`UID`)
);

The ‘Config’ table simply holds various configuration options that are used by mite.
The ‘URLMap’ contains URL parsing rules that allow URLs to be mapped to functions in lieu of query strings and forms.
‘ControllerPermissions’ allows for simple access control to different functions.

APP CONFIGURATION
Once in place, mite has 2 configurations that are used. The first one is a simple text file that exists in the ‘/config’ directory and is named ‘config.txt’. This file simply has database access information that is then used by mite to pull the main configuration data directly from the mysql database. The second is the contents of the ‘Config’ table above, which is pulled using the information in the configuration file.

The ‘config.txt’ file should look something like this :

dbhost localhost
dbport 3306
dbname database_name
dbuser database_user
dbpass database_pass

After mite connects to that database, it will pull the rest of its configuration options from the DB. All other configuration options can be configured via a web interface by an administrative user.

mite – basics – mysql tables and app configuration

Leave a Reply