You are here

function print_mail_update_6004 in Printer, email and PDF versions 6

Same name and namespace in other branches
  1. 5.4 print_mail/print_mail.install \print_mail_update_6004()
  2. 5.x print_mail/print_mail.install \print_mail_update_6004()

Update to version 6.x-1.8

File

print_mail/print_mail.install, line 263
Install file of the print_mail module

Code

function print_mail_update_6004() {

  // add new 'access send by email' permission to any role which has 'access print'
  $ret = array();
  $dbret = db_query('SELECT * FROM {permission}');
  while ($role = db_fetch_object($dbret)) {
    if (strpos($role->perm, 'access print') !== FALSE) {
      $role->perm = db_escape_string('access send by email, ' . $role->perm);
      $ret[] = update_sql("UPDATE {permission} SET perm = '{$role->perm}' WHERE rid = {$role->rid}");
    }
  }
  return $ret;
}