You are here

function boost_path_redirect_load in Boost 6

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

Parameters

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

2 calls to boost_path_redirect_load()
boost_cache_expire_derivative in ./boost.module
Finds all possible paths/redirects/aliases given the root path.
boost_redirect_handler in ./boost.module
Grabs drupal_goto requests via boost_exit and looks for redirects.

File

./boost.module, line 4654
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_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;
  }
}