From MozillaWiki
< Labs‎ | Personas
Jump to: navigation, search

DB Storage

Create a Mysql db. Create the following tables:

create table personas
 id integer primary key not null auto_increment,
 name varchar(32) unique,
 header varchar(64),
 footer varchar(64),
 category varchar(32),
 status tinyint,
 submit varchar(32),
 approve varchar(32),
 author varchar(32),
 accentcolor varchar(10),
 textcolor varchar(10),
 popularity integer

create table categories
 id integer primary key not null auto_increment,
 name varchar(32)

create table users
 username varchar(32) primary key,
 md5 varchar(32),
 email varchar(64),
 admin tinyint default 0

HG code

The hg repository is at

It has client and server subdirectories. For our purposes, we only need the server.

There are three subdirectories in server:

personas_libs - needs to go into the php_include path (eg somewhere in the PEAR tree)

upload - the docroot for the public persona uploader and user registration

admin - the docroot for persona approval and admin user promotion. These files are protected by htaccess and should be done over https if possible. At this stage, they could also be limited to Mozilla IPs or something similar.

Storage tree

Create a storage directory somewhere. I have a css file that needs to go in there, but otherwise, it's empty for now (this is where compile.php will write all it's files). Apache needs to be able to write to this directory.

Constants file

Create in the personas_libs directory


#db access
if (!defined (PERSONAS_USERNAME)) { define('PERSONAS_USERNAME', 'personas'); }
if (!defined (PERSONAS_PASSWORD)) { define('PERSONAS_PASSWORD', 'personas'); }
if (!defined (PERSONAS_HOST)) { define('PERSONAS_HOST', 'localhost'); }
if (!defined (PERSONAS_DB)) { define('PERSONAS_DB', 'personas'); }

#path to the generated html/json/images tree
	define('PERSONAS_STORAGE_PREFIX', '/Users/telliott/mozilla/personas/server/store'); 

#html path to the root of the html/json/images tree
if (!defined (PERSONAS_URL_PREFIX)) 
	define('PERSONAS_URL_PREFIX', 'http://localhost/personas/store'); 

#salt for login cookie generation
if (!defined (PERSONAS_LOGIN_SALT)) { define('PERSONAS_LOGIN_SALT', 'OurSalt'); }



There's a script in /upload called compile.php. You can put it wherever (but if you move it from it's current position, you need to edit the first couple lines to get the include files). It should not be served publicly.

This script should run hourly and have write privileges on the storage tree.

A couple minutes after the compile cron kicks off, rsync the storage tree to the servers serving up the contents. Those servers will need apache configured to serve up the files - as simply as possible, as they're all flat html/json/images.