You are here

function robotstxt_update_6100 in RobotsTxt 6

Same name and namespace in other branches
  1. 7 robotstxt.install \robotstxt_update_6100()

Automatically add the 'administer robots.txt' permission to granted users.

File

./robotstxt.install, line 55

Code

function robotstxt_update_6100() {
  $ret = array();
  $res = db_query('SELECT rid, perm FROM {permission}');
  $perms = array();
  while ($p = db_fetch_object($res)) {
    $perm = $p->perm;
    $perm = preg_replace('/administer site configuration/', 'administer site configuration, administer robots.txt', $perm);
    $perms[$p->rid] = $perm;
  }
  foreach ($perms as $key => $value) {
    db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", $value, $key);
  }
  return $ret;
}