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

Contents of /contributions/modules/usercomment/usercomment.install

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


Revision 1.2 - (show annotations) (download) (as text)
Sat Aug 25 00:26:44 2007 UTC (2 years, 3 months ago) by gwen
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-5, DRUPAL-6--1
Changes since 1.1: +2 -2 lines
File MIME type: text/x-php
fixed bad syntax on preg_match(), quoting string in some sql
1 <?php
2 // $Id$
3
4 /**
5 * Changed names of some permissions
6 */
7 function usercomment_update_1() {
8 $result = db_query("SELECT * FROM {permission}");
9 while ($permission = db_fetch_object($result)) {
10 $perms = array();
11 foreach (explode(', ', $permission->perm) as $perm) {
12 if (preg_match("/^((approve|delete) comments on) (\w+) content$/", $perm, $matches)) {
13 $perm = $matches[1] . ' own ' . $matches[3] . ' content';
14 }
15 $perms[] = $perm;
16 }
17 db_query("UPDATE {permission} SET perm = '%s'", implode(', ', $perms));
18 }
19 }

  ViewVC Help
Powered by ViewVC 1.1.2