Notes on a Module Specification

From Scire Wiki

Jump to: navigation, search

Here are some quick thoughts on how modules should work in Scire Firstly, there is the database structure.

Modules

drop table if exists modules; create table modules ( id INT NOT NULL default '0',

 name VARCHAR(50),       #short like 'Exporter' or 'quickstart' or 'replicator'
 long_name VARCHAR(150),  
 description VARCHAR(250),
 path VARCHAR(90),       #URL path relative from /scire/   ex. 'Exporter/index.php'
 author VARCHAR(50),     #Just like in portage
 distribution VARCHAR(50),  #This is just meta-info, should not need to relate to the OS table.
 category VARCHAR(30),   #Just arbitrary now but may be used in the display to categorize modules once we have a bunch of them.
 homepage VARCHAR(90),   #Just like in portage
 PRIMARY KEY (id)

) TYPE=MyISAM;

id is there as a key for really no reason other than that id's are cool. there should not be any two modules with the same name unless you wanted to have two versions of a module at once. don't want to go there.

For file info: normal url: /scire/jobs.php module url: /scire/modules/Exporter/index.php <-- all files should be in a subdir of some sort, preferably the name of the module itself. the "/modules/" part isn't critical and if people don't want it i would be fine either way. just as long as it is consistent.

Templates: normal template: /scire/.smarty/templates/jobs.tpl module template: /scire/.smarty/templates/modules/Exporter/index.tpl <-- in modules dir and then the subdir, should match the url's subdir (i.e. name of module). the "/modules/" part isn't critical and if people don't want it i would be fine either way. just as long as it is consistent.

DB functions: core file: /scire/.lib/DB_functions.php module-specific DB functions: /scire/.lib/modules/Exporter/DB_functions.php same goes w/ "/modules/" as above.

Libraries: normal pages use /scire/.lib/common.php for importing DB functions and user session and login and all that. modules should use /scire/.lib/module_common.php instead. It will correct the paths and then do all that common does as well as grab the module-specific DB_functions. We can get the module name from the path if we standardize on it. this will make things "clean"

the main scire configuration file should move from /etc/scire.conf to /etc/scire/scire.conf modules configs should go in either /etc/scire/ or /etc/scire/modules. ex. /etc/scire/Exporter.conf

Installation procedure has not yet been defined for scire so it cannot yet be defined for scire modules. The scire installation SQL should not be modified to account for a module. A module should use its own .sql that does altering of tables if that is necessary. Hopefully most modules will avoid mucking with core tables.

Personal tools