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

Contents of /contributions/modules/ed_readmore/ed_readmore.install

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


Revision 1.4 - (show annotations) (download) (as text)
Tue Apr 21 21:02:56 2009 UTC (7 months, 1 week ago) by toddnienkerk
Branch: MAIN
Changes since 1.3: +44 -7 lines
File MIME type: text/x-php
HEAD is now the 6.x-5.x branch
1 <?php
2 // $Id: ed_readmore.install,v 1.1.4.2.2.9.2.1 2009/04/21 21:01:54 toddnienkerk Exp $
3
4 /**
5 * @file
6 * Install file.
7 */
8
9 /**
10 * Implementation of hook_install().
11 *
12 * Sets the module weight to make ed_readmore run later than most other modules.
13 * This prevents a conflict over the value of $node->readmore when used together
14 * with excerpt.module.
15 */
16 function ed_readmore_install() {
17 $ret = db_query("UPDATE {system} SET weight = 5 WHERE name = 'ed_readmore'");
18
19 if ($ret) {
20 drupal_set_message(t('Read More link module installed succesfully.'));
21 }
22 else {
23 drupal_set_message(t('Read More link module installation was unsuccessfull. Could not update module weight in database.'), 'error');
24 }
25 }
26
27
28 /**
29 * Implementation of hook_uninstall().
30 */
31 function ed_readmore_uninstall() {
32 // Pre-update_6000 vars
33 variable_del('ed_readmore_readmore_tweak');
34 variable_del('ed_readmore_readmore_strong');
35 variable_del('ed_readmore_readmore_inline');
36 variable_del('ed_readmore_readmore_remove');
37
38 // Pre-update_6001 var
39 variable_del('ed_readmore_rss');
40
41 // Active vars
42 variable_del('ed_readmore_remove');
43 variable_del('ed_readmore_placement');
44 variable_del('ed_readmore_text');
45 variable_del('ed_readmore_title');
46 variable_del('ed_readmore_nofollow');
47 }
48
49
50 /**
51 * Update 6000.
52 *
53 * Changes variable names and values for users upgrading from 5.x and earlier
54 * 6.x versions (3.x, 4.x).
55 */
56 function ed_readmore_update_6000() {
57 // Change ed_readmore_readmore_tweak to ed_readmore_placement
58 if (variable_get('ed_readmore_readmore_tweak', 1)) {
59 variable_set('ed_readmore_placement', 'inline');
60 }
61 else {
62 variable_set('ed_readmore_placement', 'disable');
63 }
64
65 // Wrap link text in <strong> tags if bold option was previously set to TRUE
66 if (variable_get('ed_readmore_readmore_strong', 1)) {
67 $link_text = variable_get('ed_readmore_text', 'Read more &raquo;');
68 variable_set('ed_readmore_text', '<strong>'. $link_text .'</strong>');
69 }
70
71 // Set new "remove 'Read More' link from node linkes value
72 variable_set('ed_readmore_remove', variable_get('ed_readmore_readmore_remove', TRUE));
73
74 // Delete old or renamed vars
75 variable_del('ed_readmore_readmore_tweak');
76 variable_del('ed_readmore_readmore_strong');
77 variable_del('ed_readmore_readmore_inline');
78 variable_del('ed_readmore_readmore_remove');
79
80 // Must return an array
81 return array();
82 }
83
84
85 /**
86 * Update 6001.
87 *
88 * Removes obsolete variable "ed_readmore_rss." This module no longer handles
89 * the "read more" link in RSS teasers because Drupal core already does.
90 */
91 function ed_readmore_update_6001() {
92 // Delete old var
93 variable_del('ed_readmore_rss');
94
95 // Must return an array
96 return array();
97 }

  ViewVC Help
Powered by ViewVC 1.1.2