';
$tree = module_invoke('taxonomy', 'get_tree', simplenews_get_vid());
if ($tree) {
$result = db_query("SELECT snid FROM {sn_subscriptions}");
while ($snid = db_fetch_object($result)) {
foreach ($tree as $newsletter) {
db_query("INSERT INTO {sn_snid_tid} (snid, tid) VALUES (%d, %d)", $snid->snid, $newsletter->tid);
}
}
}
$error .= 'Updated db table: sn_snid_tid
';
$result = db_query('SELECT * FROM {permission} ORDER BY rid');
while ($role = db_fetch_object($result)) {
if (strstr($role->perm,'administer simplenews')) {
$role->perm = str_replace('administer simplenews', 'administer newsletters', $role->perm);
db_query('UPDATE {permission} SET perm = "%s" WHERE rid = %d', $role->perm, $role->rid);
}
}
$error .= 'Updated db table: permission
';
menu_rebuild();
$error .= 'Update completed';
}
else {
$error = 'Database error: could not create table sn_snid_tid. Update not performed';
}
}
else {
$error = 'Simplenews module not installed or not enabled. Update not performed';
}
print $error;
?>