function pathauto_install in Pathauto 5.2
Same name and namespace in other branches
- 8 pathauto.install \pathauto_install()
- 6.2 pathauto.install \pathauto_install()
- 6 pathauto.install \pathauto_install()
- 7 pathauto.install \pathauto_install()
Implementation of hook_install().
File
- ./
pathauto.install, line 13 - Install, update, and uninstall functions for Pathauto.
Code
function pathauto_install() {
// Check to see if taxonomy module is enabled before we set those variables
if (module_exists('taxonomy')) {
variable_set('pathauto_modulelist', array(
'node',
'user',
'taxonomy',
));
variable_set('pathauto_taxonomy_supportsfeeds', '0/feed');
variable_set('pathauto_taxonomy_pattern', 'category/[vocab-raw]/[catpath-raw]');
variable_set('pathauto_taxonomy_bulkupdate', FALSE);
variable_set('pathauto_taxonomy_applytofeeds', FALSE);
variable_set('pathauto_taxonomy_2_pattern', '');
variable_set('pathauto_taxonomy_1_pattern', '');
}
else {
// Node and user are required so we don't have to check
variable_set('pathauto_modulelist', array(
'node',
'user',
));
}
// Set the rest of the pathauto default variables
variable_set('pathauto_ignore_words', 'a,an,as,at,before,but,by,for,from,is,in,into,like,of,off,on,onto,per,since,than,the,this,that,to,up,via,with');
variable_set('pathauto_indexaliases', FALSE);
variable_set('pathauto_indexaliases_bulkupdate', FALSE);
variable_set('pathauto_max_component_length', '100');
variable_set('pathauto_max_length', '100');
variable_set('pathauto_node_bulkupdate', FALSE);
variable_set('pathauto_node_forum_pattern', '');
variable_set('pathauto_node_image_pattern', '');
variable_set('pathauto_node_page_pattern', '');
variable_set('pathauto_node_pattern', 'content/[title-raw]');
variable_set('pathauto_node_story_pattern', '');
variable_set('pathauto_punctuation_quotes', 0);
variable_set('pathauto_separator', '-');
variable_set('pathauto_update_action', '2');
variable_set('pathauto_user_bulkupdate', FALSE);
variable_set('pathauto_user_pattern', 'users/[user-raw]');
variable_set('pathauto_user_supportsfeeds', NULL);
variable_set('pathauto_verbose', FALSE);
// Make sure we "replace hyphen with separator" by default
variable_set('pathauto_punctuation_hyphen', 1);
// 1 is replace
// Set the weight to 1
db_query("UPDATE {system} SET weight = 1 WHERE name = 'pathauto'");
// Make the variable column wide enough for long cck names
switch ($GLOBALS['db_type']) {
case 'pgsql':
// Using pgsql<8.x? Help at http://drupal.org/node/195044
db_query('ALTER TABLE {variable} ALTER name TYPE varchar(128)');
break;
case 'mysql':
case 'mysqli':
db_query("ALTER TABLE {variable} CHANGE name name varchar(128) NOT NULL default ''");
break;
}
// Clear the cache to get these to take effect.
cache_clear_all();
}