[backpress-dev] Schema Parser and Setting up User
Nikolay Bachiyski
nb at nikolay.bg
Wed Mar 10 18:16:16 UTC 2010
On Wed, Mar 3, 2010 at 21:32, Aaron Jorbin <aaron at jorb.in> wrote:
> I'm looking to use backpress for a Digital Asset Management program
> and was wondering if someone could explain a bit about both the schema
> parser and setting up the user system. Any help is greatly
> appreciated.
>
The schema parser syncs the current database structure with one you
provide. Here is an example call:
$alterations = BP_SQL_Schema_Parser::delta( $db, $queries );
$messages = $alterations['messages'];
$errors = $alterations['errors'];
where $db is a BPDB instance and schema is an associative array of
entries like table id => create table query.
Here is an excerpt of GlotPress schema file:
$gp_schema['projects'] = "CREATE TABLE IF NOT EXISTS `$gpdb->projects` (
`id` INT(10) NOT NULL auto_increment,
`name` VARCHAR(255) NOT NULL,
`slug` VARCHAR(255) NOT NULL,
`path` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`parent_project_id` INT(10) DEFAULT NULL,
`source_url_template` VARCHAR(255) DEFAULT '',
PRIMARY KEY (`id`),
KEY `path` (`path`),
KEY `parent_project_id` (`parent_project_id`)
);";
You can experiment with it and find the rest. Also, good examples of
big BackPress integrations are bbPress [0] and GlotPress [1].
The easiest way to setup and manage the user system is to use a
WordPress install. BackPress shares the WordPress users/usermeta table
structure.
Happy hacking,
Nikolay.
[0] http://trac.bbpress.org/browser/trunk
[1] http://trac.glotpress.org/browser/trunk/
More information about the backpress-dev
mailing list