123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <?php
- function pathauto_schema() {
- $schema['pathauto_state'] = array(
- 'description' => 'The status of each entity alias (whether it was automatically generated or not).',
- 'fields' => array(
- 'entity_type' => array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'description' => 'An entity type.',
- ),
- 'entity_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'An entity ID.',
- ),
- 'pathauto' => array(
- 'type' => 'int',
- 'size' => 'tiny',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'The automatic alias status of the entity.',
- ),
- ),
- 'primary key' => array('entity_type', 'entity_id'),
- );
- return $schema;
- }
- function pathauto_install() {
-
- $defaults = array(
- 'pathauto_node_pattern' => 'content/[node:title]',
- 'pathauto_taxonomy_term_pattern' => '[term:vocabulary]/[term:name]',
- 'pathauto_forum_pattern' => '[term:vocabulary]/[term:name]',
- 'pathauto_user_pattern' => 'users/[user:name]',
- 'pathauto_blog_pattern' => 'blogs/[user:name]',
-
- 'pathauto_punctuation_hyphen' => 1,
- );
- foreach ($defaults as $variable => $default) {
- if (variable_get($variable) === NULL) {
- variable_set($variable, $default);
- }
- }
-
- db_update('system')
- ->fields(array('weight' => 1))
- ->condition('type', 'module')
- ->condition('name', 'pathauto')
- ->execute();
- }
- function pathauto_uninstall() {
-
- db_query("DELETE FROM {variable} WHERE name LIKE 'pathauto_%'");
- cache_clear_all('variables', 'cache');
- }
- function pathauto_requirements($phase) {
- $requirements = array();
- $t = get_t();
- if ($phase == 'runtime' && module_exists('pathauto_persist')) {
- $requirements['pathauto'] = array(
- 'title' => $t('Pathauto Persist'),
- 'value' => $t('Enabled'),
- 'description' => $t('Pathauto Persist is installed and enabled. As Pathauto Persist has been merged into Pathauto, the Pathauto Persist module can be safely disabled and removed. All Pathauto Persist settings have been migrated to the Pathauto implementation.'),
- 'severity' => REQUIREMENT_INFO,
- );
- }
- return $requirements;
- }
- function pathauto_update_6200() {
- variable_del('pathauto_contact_bulkupdate');
- variable_del('pathauto_contact_pattern');
- variable_del('pathauto_contact_supportsfeeds');
- variable_del('pathauto_contact_applytofeeds');
- variable_del('pathauto_tracker_bulkupdate');
- variable_del('pathauto_tracker_pattern');
- variable_del('pathauto_tracker_supportsfeeds');
- variable_del('pathauto_tracker_applytofeeds');
- }
- function pathauto_update_6201() {
- }
- function pathauto_update_6202() {
- }
- function pathauto_update_7000() {
- variable_del('pathauto_max_bulk_update');
- variable_del('pathauto_node_bulkupdate');
- variable_del('pathauto_taxonomy_bulkupdate');
- variable_del('pathauto_forum_bulkupdate');
- variable_del('pathauto_user_bulkupdate');
- variable_del('pathauto_blog_bulkupdate');
- variable_del('pathauto_modulelist');
- variable_del('pathauto_indexaliases');
- variable_del('pathauto_indexaliases_bulkupdate');
- }
- function pathauto_update_7001() {
- }
- function pathauto_update_7002() {
- if (module_exists('taxonomy')) {
- $vocabularies = taxonomy_get_vocabularies();
- foreach ($vocabularies as $vid => $vocabulary) {
- if ($vid == variable_get('forum_nav_vocabulary', '')) {
-
- continue;
- }
- if ($pattern = variable_get('pathauto_taxonomy_' . $vid . '_pattern', '')) {
- variable_set('pathauto_taxonomy_' . $vocabulary->machine_name . '_pattern', $pattern);
- }
- variable_del('pathauto_taxonomy_' . $vid . '_pattern');
- }
- }
- }
- function pathauto_update_7003() {
- $variables = db_select('variable', 'v')
- ->fields('v', array('name'))
- ->condition(db_and()
- ->condition('name', db_like("pathauto_taxonomy_") . '%', 'LIKE')
- ->condition('name', db_like("pathauto_taxonomy_term_") . '%', 'NOT LIKE')
- )
- ->execute()
- ->fetchCol();
- foreach ($variables as $variable) {
- $value = variable_get($variable);
- variable_del($variable);
- $variable = strtr($variable, array('pathauto_taxonomy_' => 'pathauto_taxonomy_term_'));
- variable_set($variable, $value);
- }
- }
- function pathauto_update_7004() {
- variable_del('pathauto_node_supportsfeeds');
- variable_del('pathauto_node_applytofeeds');
- variable_del('pathauto_taxonomy_supportsfeeds');
- variable_del('pathauto_taxonomy_applytofeeds');
- variable_del('pathauto_forum_supportsfeeds');
- variable_del('pathauto_forum_applytofeeds');
- variable_del('pathauto_user_supportsfeeds');
- variable_del('pathauto_user_applytofeeds');
- variable_del('pathauto_blog_supportsfeeds');
- variable_del('pathauto_blog_applytofeeds');
- }
- function pathauto_update_7005() {
- $replacements = array(
- '[vocabulary:name]' => '[term:vocabulary]',
- '[vocabulary:' => '[term:vocabulary:',
- '[term:catpath]' => '[term:name]',
- '[term:path]' => '[term:name]',
- );
- $variables = db_select('variable', 'v')
- ->fields('v', array('name'))
- ->condition(db_or()
- ->condition('name', db_like("pathauto_taxonomy_term_") . '%' . db_like('pattern'), 'LIKE')
- ->condition('name', db_like("pathauto_forum_") . '%' . db_like('pattern'), 'LIKE')
- )
- ->execute()
- ->fetchCol();
- foreach ($variables as $variable) {
- if ($pattern = variable_get($variable)) {
- $pattern = strtr($pattern, $replacements);
- variable_set($variable, $pattern);
- }
- }
- return 'Your Pathauto taxonomy and forum patterns have been corrected. You may wish to regenerate your taxonomy and forum term URL aliases.';
- }
- function pathauto_update_7006() {
- if (!db_table_exists('pathauto_state')) {
- $schema['pathauto_state'] = array(
- 'description' => 'The status of each entity alias (whether it was automatically generated or not).',
- 'fields' => array(
- 'entity_type' => array(
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'description' => 'The entity type.',
- ),
- 'entity_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'description' => 'The entity ID.',
- ),
- 'pathauto' => array(
- 'type' => 'int',
- 'size' => 'tiny',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => 'The automatic alias status of the entity.',
- ),
- ),
- 'primary key' => array('entity_type', 'entity_id'),
- );
- if (db_table_exists('pathauto_persist')) {
-
-
- db_rename_table('pathauto_persist', 'pathauto_state');
- db_create_table('pathauto_persist', $schema['pathauto_state']);
-
- if (module_exists('pathauto_persist')) {
- module_disable(array('pathauto_persist'));
- }
- return t('The Pathauto Persist module and all of its data has been merged into Pathauto. The Pathauto Persist module has been disabled and can be safely uninstalled.');
- }
- else {
- db_create_table('pathauto_state', $schema['pathauto_state']);
- }
- }
- }
- function _pathauto_upgrade_token_list() {
- $tokens = array(
-
-
-
-
-
- );
- }
|