Skip to content
Snippets Groups Projects
Commit 160fd16c authored by Tim Steiner's avatar Tim Steiner
Browse files

More updating to drupal coding standards.

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@208 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent 4e005fd2
No related branches found
No related tags found
No related merge requests found
<?php <?php
function unl_schema() function unl_schema() {
{ $schema = array();
$schema = array(); $schema['unl_sites'] = array(
$schema['unl_sites'] = array( 'description' => 'Table of tables to be programatically created',
'description' => 'Table of tables to be programatically created', 'fields' => array(
'fields' => array( 'site_id' => array(
'site_id' => array( 'type' => 'serial',
'type' => 'serial', 'unsigned' => TRUE,
'unsigned' => TRUE, 'not null' => TRUE,
'not null' => TRUE ),
), 'site_path_prefix' => array(
'site_path_prefix' => array( 'type' => 'varchar',
'type' => 'varchar', 'length' => 255,
'length' => 255, 'not null' => TRUE,
'not null' => TRUE, 'default' => '',
'default' => '' ),
), 'site_path' => array(
'site_path' => array( 'type' => 'varchar',
'type' => 'varchar', 'length' => 255,
'length' => 255, 'not null' => TRUE,
'not null' => TRUE, 'default' => '',
'default' => '' ),
), 'uri' => array(
'uri' => array( 'type' => 'varchar',
'type' => 'varchar', 'length' => 255,
'length' => 255, 'not null' => TRUE,
'not null' => TRUE, 'default' => '',
'default' => '' ),
), 'installed' => array(
'installed' => array( 'type' => 'int',
'type' => 'int', 'not null' => TRUE,
'not null' => TRUE, 'default' => 0,
'default' => 0 ),
), 'clean_url' => array(
'clean_url' => array( 'type' => 'int',
'type' => 'int', 'not null' => TRUE,
'not null' => TRUE, 'default' => 1,
'default' => 1 )
) ),
), 'primary key' => array('site_id'),
'primary key' => array('site_id'), 'unique keys' => array(
'unique keys' => array( 'sub_site' => array('site_path_prefix', 'site_path'),
'sub_site' => array('site_path_prefix', 'site_path') )
) );
);
return $schema;
return $schema;
} }
function unl_update_7100() function unl_update_7100() {
{ $table = array(
$table = array( 'description' => 'Table of tables to be programatically created',
'description' => 'Table of tables to be programatically created', 'fields' => array(
'fields' => array( 'site_id' => array(
'site_id' => array( 'type' => 'serial',
'type' => 'serial', 'unsigned' => TRUE,
'unsigned' => TRUE, 'not null' => TRUE,
'not null' => TRUE ),
), 'site_path' => array(
'site_path' => array( 'type' => 'varchar',
'type' => 'varchar', 'length' => 255,
'length' => 255, 'not null' => TRUE,
'not null' => TRUE, 'default' => '',
'default' => '' ),
), 'uri' => array(
'uri' => array( 'type' => 'varchar',
'type' => 'varchar', 'length' => 255,
'length' => 255, 'not null' => TRUE,
'not null' => TRUE, 'default' => '',
'default' => '' ),
), 'installed' => array(
'installed' => array( 'type' => 'int',
'type' => 'int', 'not null' => TRUE,
'not null' => TRUE, 'default' => 0,
'default' => 0 ),
), 'clean_url' => array(
'clean_url' => array( 'type' => 'int',
'type' => 'int', 'not null' => TRUE,
'not null' => TRUE, 'default' => 1,
'default' => 1 ),
), 'db_prefix' => array(
'db_prefix' => array( 'type' => 'varchar',
'type' => 'varchar', 'length' => 255,
'length' => 255, 'not null' => TRUE,
'not null' => TRUE, 'default' => '',
'default' => '' )
), ),
), 'primary key' => array('site_id'),
'primary key' => array('site_id'), 'unique keys' => array(
'unique keys' => array( 'sub_site' => array('site_path_prefix', 'site_path'),
'sub_site' => array('site_path_prefix', 'site_path') )
) );
);
db_create_table('unl_sites', $table);
db_create_table('unl_sites', $table);
} }
function unl_update_7101() function unl_update_7101() {
{ db_add_field('unl_sites', 'clean_url', array(
db_add_field( 'type' => 'int',
'unl_sites', 'not null' => TRUE,
'clean_url', 'default' => 1,
array( ));
'type' => 'int',
'not null' => TRUE,
'default' => 1
)
);
} }
function unl_update_7102() function unl_update_7102() {
{ db_add_field('unl_sites', 'db_prefix', array(
db_add_field( 'type' => 'varchar',
'unl_sites', 'length' => 255,
'db_prefix', 'not null' => TRUE,
array( 'default' => '',
'type' => 'varchar', ));
'length' => 255, db_query('UPDATE {unl_sites} SET db_prefix = site_path');
'not null' => TRUE, db_query("UPDATE {unl_sites} SET site_path = CONCAT(site_path_prefix, '/', site_path) WHERE site_path_prefix != ''");
'default' => '' db_drop_field('unl_sites', 'site_path_prefix');
)
);
db_query('UPDATE {unl_sites} SET db_prefix = site_path');
db_query("UPDATE {unl_sites} SET site_path = CONCAT(site_path_prefix, '/', site_path) WHERE site_path_prefix != ''");
db_drop_field('unl_sites', 'site_path_prefix');
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment