You are here

function print_mail_update_6004 in Printer, email and PDF versions 5.4

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

Update to version 5.x-4.8

File

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

Code

function print_mail_update_6004() {

  // add new 'access send to friend' 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 to friend, ' . $role->perm);
      $ret[] = update_sql("UPDATE {permission} SET perm = '{$role->perm}' WHERE rid = {$role->rid}");
    }
  }
  return $ret;
}