You are here

function purl_delete in Persistent URL 6

Same name and namespace in other branches
  1. 7 purl.module \purl_delete()

Delete a modifier entry from the database.

File

./purl.module, line 601

Code

function purl_delete($modifier) {
  if (!empty($modifier['value'])) {
    $param = 'value';
    $where = $modifier['value'];
  }
  else {
    if (!empty($modifier['id'])) {
      $param = 'id';
      $where = $modifier['id'];
    }
  }
  $check = db_result(db_query("SELECT id FROM {purl} WHERE provider = '%s' AND {$param} = '%s'", $modifier['provider'], $where));
  if ($check) {
    $status = db_query("DELETE FROM {purl} WHERE provider = '%s' AND {$param} = '%s'", $modifier['provider'], $where);
    purl_load(NULL, TRUE);
    purl_modifiers(NULL, TRUE);
    return $status;
  }
  return FALSE;
}