You are here

function expire_path_redirect_load in Cache Expiration 6

Retrieve a specific URL redirect from the database. http://drupal.org/node/451790

Parameters

$where: Array containing 'redirect' => $path

1 call to expire_path_redirect_load()
expire_cache_derivative in ./expire.module
Finds all possible paths/redirects/aliases given the root path.

File

./expire.module, line 486
Provides logic for page cache expiration

Code

function expire_path_redirect_load($where = array(), $args = array(), $sort = array()) {
  $redirects = array();
  if (is_numeric($where)) {
    $where = array(
      'rid' => $where,
    );
  }
  foreach ($where as $key => $value) {
    if (is_string($key)) {
      $args[] = $value;
      $where[$key] = $key . ' = ' . (is_numeric($value) ? '%d' : "'%s'");
    }
  }
  if ($where && $args) {
    $sql = "SELECT * FROM {path_redirect} WHERE " . implode(' AND ', $where);
    if ($sort) {
      $sql .= ' ORDER BY ' . implode(' ,', $sort);
    }
    $result = db_query($sql, $args);
    while ($redirect = db_fetch_array($result)) {
      $redirects[] = $redirect;
    }
    return $redirects;
  }
}