Commit 20e3f754 authored by Adrian Rossouw's avatar Adrian Rossouw

Generate and manage path aliases for all the different contexts with their...

Generate and manage path aliases for all the different contexts with their context name. ie: hosting/c/site.com
parent bd3bc00c
......@@ -9,7 +9,7 @@
*/
function hostmaster_profile_modules() {
return array(
/* core */ 'block', 'color', 'filter', 'help', 'menu', 'node', 'system', 'user',
/* core */ 'block', 'color', 'filter', 'help', 'menu', 'node', 'system', 'user', 'path',
/* aegir contrib */ 'hosting', 'hosting_task', 'hosting_client', 'hosting_db_server', 'hosting_package', 'hosting_platform', 'hosting_site', 'hosting_web_server', 'hosting_server',
/* other contrib */ 'install_profile_api' /* needs >= 2.1 */, 'jquery_ui', 'modalframe'
);
......
......@@ -202,6 +202,8 @@ function hosting_update_6008() {
$return = array();
if (!variable_get('hosting_update_6008_run', false)) {
drupal_install_modules(array('path'));
db_create_table($return, 'hosting_context', array(
'fields' => array(
'nid' => array(
......@@ -278,3 +280,18 @@ function hosting_update_6009() {
return $ret;
}
/**
* Add url aliases for the context names that are registered.
*/
function hosting_update_6010() {
$ret = array();
drupal_install_modules(array('path'));
$result = db_query("SELECT nid, name FROM {hosting_context}");
while ($obj = db_fetch_object($result)) {
path_set_alias("node/$obj->nid", "hosting/c/$obj->name");
}
return $ret;
}
......@@ -776,6 +776,7 @@ function hosting_context_register($nid, $name) {
// It's a new item
db_query("INSERT INTO {hosting_context} (nid, name) VALUES (%d, '%s')", $nid, $name);
}
path_set_alias("node/$nid", "hosting/c/$name");
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment