| 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. |
| 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 |
|
} |