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

Contents of /contributions/modules/weight/weight.install

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


Revision 1.3 - (show annotations) (download) (as text)
Fri Jan 2 01:21:55 2009 UTC (10 months, 3 weeks ago) by nancyw
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +2 -1 lines
File MIME type: text/x-php
#343299 by NancyDru for Bartezz - Added feature to inherit menu weight.
1 <?php
2 // $Id: weight.install,v 1.2 2008/09/27 00:05:46 nancyw Exp $
3 // Author: Harry Slaughter <harry@devbee.com>
4 /**
5 * @file
6 * This module uses the sticky column of the node table
7 * to add weighting to nodes.
8 */
9
10 /**
11 * Implementation of hook_install().
12 */
13 function weight_install() {
14 drupal_set_message(t('Weight module is now enabled. You must now update your nodes using the <a href="!url">Weight DB setup page</a>', array('!url' => url('admin/settings/weight/setup'))));
15 }
16
17 /**
18 * Implementation of hook_uninstall().
19 */
20 function weight_uninstall() {
21 // We need to unset any weighted nodes and reset sticky to normal values.
22 $weight_node_types = variable_get('weight_node_types', array());
23 if ($weight_node_types) {
24 $list = implode("', '", $weight_node_types);
25 db_query("UPDATE {node} n SET n.sticky = 1 WHERE n.sticky > 1 AND n.type IN ('". $list ."')");
26 db_query("UPDATE {node} n SET n.sticky = 0 WHERE n.sticky < 0 AND n.type IN ('". $list ."')");
27 }
28
29 // Delete our variables.
30 variable_del('weight_node_types');
31 variable_del('weight_range');
32 variable_del('weight_use_menu');
33 }

  ViewVC Help
Powered by ViewVC 1.1.2