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

Add support to the UNL Site Creation tool for clean URLs on by default.

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@176 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent 3bab5eab
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ while ($row = $query->fetchAssoc()) {
->fields(array('installed' => 1))
->condition('site_id', $row['site_id'])
->execute();
unl_add_site($row['site_path_prefix'], $row['site_path'], $row['uri']);
unl_add_site($row['site_path_prefix'], $row['site_path'], $row['uri'], $row['clean_url']);
db_update('unl_sites')
->fields(array('installed' => 2))
->condition('site_id', $row['site_id'])
......@@ -26,7 +26,7 @@ while ($row = $query->fetchAssoc()) {
}
function unl_add_site($site_path_prefix, $site_path, $uri)
function unl_add_site($site_path_prefix, $site_path, $uri, $clean_url)
{
if (substr($site_path, 0, 1) == '/') {
......@@ -82,7 +82,7 @@ function unl_add_site($site_path_prefix, $site_path, $uri)
}
$symlink_target = implode('/', $symlink_target);
$command = "$php_path sites/all/modules/drush/drush.php -y --uri=$uri site-install unl_profile --sites-subdir=$sites_subdir --db-url=$db_url --db-prefix=$db_prefix --clean-url=0";
$command = "$php_path sites/all/modules/drush/drush.php -y --uri=$uri site-install unl_profile --sites-subdir=$sites_subdir --db-url=$db_url --db-prefix=$db_prefix --clean-url=$clean_url";
mkdir($subdir, 0755, TRUE);
symlink($symlink_target, $subdir . '/' . $symlink_name);
......
name = UNL WDN
description = Adds features to allow wysiwyg editing of WDN Templated sites.
core = 7.x
version = "7.x-1.0-20100720"
version = "7.x-1.0-20100920"
dependencies[] = wysiwyg
files[] = unl.install
......
......@@ -33,7 +33,12 @@ function unl_schema()
'type' => 'int',
'not null' => TRUE,
'default' => 0
)
),
'clean_url' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 1
)
),
'primary key' => array('site_id'),
'unique keys' => array(
......@@ -87,3 +92,16 @@ function unl_update_7100()
db_create_table('unl_sites', $table);
}
function unl_update_7101()
{
db_add_field(
'unl_sites',
'clean_url',
array(
'type' => 'int',
'not null' => TRUE,
'default' => 1
)
);
}
......@@ -30,6 +30,13 @@ function unl_site_creation($form, &$form_state)
'#required' => TRUE
);
$form['root']['clean_url'] = array(
'#type' => 'checkbox',
'#title' => t('Use clean URLs'),
'#description' => t('Unless you have some reason to think your site won\'t support this, leave it checked.'),
'#default_value' => 1
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Create Site'
......@@ -39,10 +46,12 @@ function unl_site_creation($form, &$form_state)
}
function unl_site_creation_submit($form, &$form_state)
{
{
$php_path = $form_state['values']['php_path'];
$site_path = $form_state['values']['site_path'];
$site_path_prefix = $form_state['values']['site_path_prefix'];
$clean_url = $form_state['values']['clean_url'];
if (substr($site_path, 0, 1) == '/') {
$site_path = substr($site_path, 1);
}
......@@ -63,10 +72,13 @@ function unl_site_creation_submit($form, &$form_state)
$uri = url($full_path, array('absolute' => TRUE));
$clean_url = intval($clean_url);
db_insert('unl_sites')->fields(array(
'site_path_prefix' => $site_path_prefix,
'site_path' => $site_path,
'uri' => $uri
'uri' => $uri,
'clean_url' => $clean_url
))->execute();
exit;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment