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

Diff of /contributions/modules/comment_subscribe/comment_subscribe.install

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

revision 1.2.2.3, Fri Jan 30 08:23:50 2009 UTC revision 1.2.2.4, Wed May 20 07:05:26 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: comment_subscribe.install,v 1.2 2008/03/06 08:08:20 zyxware Exp $  // $Id: comment_subscribe.install,v 1.2.2.3 2009/01/30 08:23:50 zyxware Exp $
3  /**  /**
4   * @file   * @file
5   * comment_subscribe.install.   * comment_subscribe.install.
# Line 114  function comment_subscribe_update_6() { Line 114  function comment_subscribe_update_6() {
114    db_query("INSERT INTO {z_nodesubscribe} (nid, uid) select nid,uid from node");    db_query("INSERT INTO {z_nodesubscribe} (nid, uid) select nid,uid from node");
115    return $ret;    return $ret;
116  }  }
117    
118    /*
119     * Function to migrate to comment_notify
120     * Transfer users subscription to node comments and reply to comments
121     * stored in z_commentsubscribe table to comment_notify table.
122     */
123    function comment_subscribe_update_6101() {
124      $ret = array();
125      //Checking whether comment notify module enabled or not.
126      $module = 'comment_notify';
127      $list = module_list();
128      $rslt_val = array_key_exists($module, $list);
129      if($rslt_val) {
130              $subscription_result = db_query("SELECT  c.cid as cid, zc.subscribe as subscribe, zc.subscribenode FROM {z_commentsubscribe} zc LEFT JOIN {comments} c on zc.cid = c.cid");
131        while ($subscription_vals = db_fetch_object($subscription_result)) {
132          // if subscribed to node comments
133          if ($subscription_vals->subscribe == 1) {
134            $notify = 1;
135          }
136          // if subscribed to reply to comments
137          else if ($subscription_vals->subscribenode == 1) {
138            $notify = 2;
139          }
140          // if not subscribed
141          else {
142            $notify = 0;
143          }
144          db_query('UPDATE {comment_notify} SET notify = %d WHERE cid = %d', $notify,
145       $subscription_vals->cid);
146        }
147      }
148      else {
149        drupal_set_message('Comment Notify module not yet enabled. Please enable the module for migrating from comment subscribe to comment notify.');
150      }
151      return $ret;
152    }

Legend:
Removed from v.1.2.2.3  
changed lines
  Added in v.1.2.2.4

  ViewVC Help
Powered by ViewVC 1.1.2