function linkchecker_update_5209 in Link checker 5.2
Update the permissions table, to reflect changes to hook_perm.
File
- ./
linkchecker.install, line 424 - Installation file for Link Checker module.
Code
function linkchecker_update_5209() {
$ret = array();
$res = db_query('SELECT rid, perm FROM {permission}');
$perms = array();
while ($p = db_fetch_object($res)) {
$perm = $p->perm;
$perm = preg_replace('/access linkchecker/', 'access broken links report', $perm);
$perms[$p->rid] = $perm;
}
foreach ($perms as $rid => $renamed_permission) {
db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", $renamed_permission, $rid);
$ret[] = array(
'success' => TRUE,
'query' => 'UPDATE {permission} SET perm = ' . check_plain($renamed_permission) . ' WHERE rid = ' . $rid,
);
}
return $ret;
}