/[drupal]/contributions/modules/excerpt/excerpt.install
ViewVC logotype

Contents of /contributions/modules/excerpt/excerpt.install

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.7 - (show annotations) (download) (as text)
Sat Oct 17 23:12:18 2009 UTC (5 weeks, 6 days ago) by hanoii
Branch: MAIN
CVS Tags: DRUPAL-6--1-1, HEAD
Changes since 1.6: +65 -1 lines
File MIME type: text/x-php
#429364. Properly support different formats for the teaser and proper wysiwyg integration
1 <?php
2 // $Id: excerpt.install,v 1.6 2009/10/08 17:44:44 hanoii Exp $
3
4 /**
5 * Implementation of hook_schema().
6 */
7 function excerpt_schema() {
8 $schema['excerpt'] = array(
9 'description' => 'A table for node\'s extra excerpt information.',
10 'fields' => array(
11 'nid' => array(
12 'description' => 'The {node} this version belongs to.',
13 'type' => 'int',
14 'unsigned' => TRUE,
15 'not null' => TRUE,
16 'default' => 0),
17 'vid' => array(
18 'description' => 'The primary identifier for this version.',
19 'type' => 'int',
20 'unsigned' => TRUE,
21 'not null' => TRUE),
22 'format' => array(
23 'description' => "The input format used by this version's excerpt.",
24 'type' => 'int',
25 'not null' => TRUE,
26 'default' => 0)
27 ),
28 'indexes' => array(
29 'nid' => array('nid'),
30 ),
31 'primary key' => array('vid'),
32 );
33
34 return $schema;
35 }
36
37 /**
38 * Implementation of hook_install().
39 */
40 function excerpt_install() {
41 drupal_install_schema('excerpt');
42 db_query("UPDATE {system} SET weight = -10 WHERE name = 'excerpt'");
43 }
44
45 /**
46 * Implementation of hook_uninstall().
47 */
48 function excerpt_uninstall() {
49 // Delete all the excerpt variables and clear the variable cache.
50 db_query("DELETE FROM {variable} WHERE name LIKE 'excerpt_%'");
51 }
52
53 /**
54 * Creates the excerpt schema.
55 */
56 function excerpt_update_6001() {
57 $ret = array();
58
59 drupal_install_schema('excerpt');
60
61 return $ret;
62 }
63
64 /**
65 * Sets the module's weight to -10 to make sure it is run first.
66 */
67 function excerpt_update_6002() {
68 $ret = array();
69
70 $ret[] = update_sql("UPDATE {system} SET weight = -10 WHERE name = 'excerpt'");
71
72 return $ret;
73 }
74
75
76 /**
77 * @defgroup updates-4.7-to-5.0 Excerpt updates from 4.7 to 5.0
78 * @{
79 */
80
81 /**
82 * Update variable names.
83 */
84 function excerpt_update_5000() {
85 $ret = array();
86 foreach (node_get_types() as $type) {
87 $old_var = 'excerpt_option_'. $type->type;
88 $old_val = variable_get($old_var, NULL);
89 if (isset($old_val)) {
90 $new_var = 'excerpt_'. $type->type;
91 $new_val = variable_get($new_var, NULL);
92 // Don't overwrite existing variables.
93 if (!isset($new_val)) {
94 variable_set($new_var, $old_val);
95 }
96 // Delete old_val variable.
97 variable_del($old_var);
98 }
99 }
100 return $ret;
101 }
102
103 /**
104 * @} End of "defgroup updates-4.7-to-5.0"
105 */

  ViewVC Help
Powered by ViewVC 1.1.2