| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: page_title.install,v 1.10.4.4 2009/06/17 15:03:07 njt1982 Exp $ 3 4 /** 5 * @file 6 * The install file for Page Title allows the module to install (and uninstall) itself. This is required as this module uses its own table. 7 */ 8 9 /** 10 * Implementation of hook_install(). 11 */ 12 function page_title_install() { 13 drupal_install_schema('page_title'); 14 } 15 16 17 /** 18 * Implementation of hook_schema(). 19 */ 20 function page_title_schema() { 21 $schema['page_title'] = array( 22 'fields' => array( 23 'type' => array('type' => 'varchar', 'length' => 15, 'not null' => TRUE, 'default' => 'node'), 24 'id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 25 'page_title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '') 26 ), 27 'primary key' => array('type', 'id'), 28 ); 29 30 return $schema; 31 } 32 33 34 /** 35 * Implementation of hook_update_n(). 36 */ 37 function page_title_update_6200() { 38 $ret = array(); 39 40 if (db_column_exists('page_title', 'id')) { 41 return $ret; 42 } 43 44 db_create_table($ret, 'page_title_temp', array( 45 'fields' => array( 46 'type' => array('type' => 'varchar', 'length' => 15, 'not null' => TRUE, 'default' => 'node'), 47 'id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 48 'page_title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '') 49 ), 50 'primary key' => array('type', 'id'), 51 )); 52 53 $ret[] = update_sql('INSERT INTO {page_title_temp} (id, page_title) SELECT nid, page_title FROM {page_title}'); 54 55 db_rename_table($ret, 'page_title', 'page_title_old'); 56 57 db_rename_table($ret, 'page_title_temp', 'page_title'); 58 59 $display_settings = variable_get('page_title_display', array()); 60 foreach ($display_settings as $type) { 61 if ($type) { 62 variable_set('page_title_type_'. $type .'_showfield', 1); 63 } 64 } 65 variable_del('page_title_display'); 66 67 return $ret; 68 } 69 70 71 /** 72 * Implementation of hook_uninstall(). 73 */ 74 function page_title_uninstall() { 75 drupal_uninstall_schema('page_title'); 76 77 // Clear variables 78 variable_del('page_title_default'); 79 variable_del('page_title_individual'); 80 variable_del('page_title_front'); 81 variable_del('page_title_blog'); 82 variable_del('page_title_user'); 83 variable_del('page_title_user_showfield'); 84 variable_del('page_title_pager_pattern'); 85 86 // Clear the node specific variables 87 $types = node_get_types('names'); 88 foreach ($types as $type => $name) { 89 variable_del("page_title_type_{$type}"); 90 variable_del("page_title_type_{$type}_showfield"); 91 } 92 93 // Clear the vocab specific variables 94 $vocabs = taxonomy_get_vocabularies(); 95 foreach ($vocabs as $vid => $vocab) { 96 variable_del("page_title_vocab_{$vid}"); 97 variable_del("page_title_vocab_{$vid}_showfield"); 98 } 99 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |