| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @file 5 * Install, update, and uninstall functions for Pathauto. 6 * 7 * @ingroup pathauto 8 */ 9 10 /** 11 * Implementation of hook_install(). 12 */ 13 function pathauto_install() { 14 // Check to see if taxonomy module is enabled before we set those variables 15 if (module_exists('taxonomy')) { 16 variable_set('pathauto_modulelist', array('node', 'user', 'taxonomy')); 17 variable_set('pathauto_taxonomy_supportsfeeds', '0/feed'); 18 variable_set('pathauto_taxonomy_pattern', 'category/[vocab-raw]/[catpath-raw]'); 19 variable_set('pathauto_taxonomy_bulkupdate', FALSE); 20 variable_set('pathauto_taxonomy_applytofeeds', FALSE); 21 variable_set('pathauto_taxonomy_2_pattern', ''); 22 variable_set('pathauto_taxonomy_1_pattern', ''); 23 } 24 else { 25 // Node and user are required so we don't have to check 26 variable_set('pathauto_modulelist', array('node', 'user')); 27 } 28 // Set the rest of the pathauto default variables 29 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'); 30 variable_set('pathauto_indexaliases', FALSE); 31 variable_set('pathauto_indexaliases_bulkupdate', FALSE); 32 variable_set('pathauto_max_component_length', '100'); 33 variable_set('pathauto_max_length', '100'); 34 variable_set('pathauto_node_bulkupdate', FALSE); 35 variable_set('pathauto_node_forum_pattern', ''); 36 variable_set('pathauto_node_image_pattern', ''); 37 variable_set('pathauto_node_page_pattern', ''); 38 variable_set('pathauto_node_pattern', 'content/[title-raw]'); 39 variable_set('pathauto_node_story_pattern', ''); 40 variable_set('pathauto_punctuation_quotes', 0); 41 variable_set('pathauto_separator', '-'); 42 variable_set('pathauto_update_action', '2'); 43 variable_set('pathauto_user_bulkupdate', FALSE); 44 variable_set('pathauto_user_pattern', 'users/[user-raw]'); 45 variable_set('pathauto_user_supportsfeeds', NULL); 46 variable_set('pathauto_verbose', FALSE); 47 variable_set('pathauto_node_applytofeeds', ''); 48 49 // Make sure we "replace hyphen with separator" by default 50 variable_set('pathauto_punctuation_hyphen', 1); // 1 is replace 51 52 // Set the weight to 1 53 db_query("UPDATE {system} SET weight = 1 WHERE name = 'pathauto'"); 54 55 // Clear the cache to get these to take effect. 56 cache_clear_all(); 57 } 58 59 /** 60 * Implementation of hook_uninstall(). 61 */ 62 function pathauto_uninstall() { 63 // Delete all the pathauto variables and then clear the variable cache 64 db_query("DELETE FROM {variable} WHERE name LIKE 'pathauto_%'"); 65 cache_clear_all('variables', 'cache'); 66 } 67 68 /** 69 * Set the weight a little heavier to allow taxonomy to do its work. 70 */ 71 function pathauto_update_1() { 72 $ret = array(); 73 $ret[] = update_sql("UPDATE {system} SET weight = 1 WHERE name = 'pathauto'"); 74 return $ret; 75 } 76 77 /** 78 * pathauto_update_4 was a backport of a feature which is in core of Drupal 6 79 * hence it is removed from the 6.x branch even though the goal is to support 80 * Pathauto 5.x-1.x -> 6.x-2.x upgrades. 81 */ 82 83 /** 84 * Delete the pathauto_node_supportsfeeds. 85 */ 86 function pathauto_update_3() { 87 // Do nothing, this update was a mistake 88 return array(); 89 } 90 91 /** 92 * New style naming for the punctuation chars. 93 */ 94 function pathauto_update_4() { 95 variable_set('pathauto_punctuation_quotes', variable_get('pathauto_quotes', 0)); 96 variable_del('pathauto_quotes'); 97 return array(); 98 } 99 100 /** 101 * Remove the url_alias_extra table which wasn't used. 102 */ 103 function pathauto_update_7() { 104 $ret = array(); 105 if (db_table_exists('url_alias_extra')) { 106 db_drop_table($ret, 'url_alias_extra'); 107 } 108 return $ret; 109 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |