You are here

function _search_by_page_lookup in Search by Page 6

Same name and namespace in other branches
  1. 8 search_by_page.module \_search_by_page_lookup()
  2. 7 search_by_page.module \_search_by_page_lookup()

Internal function: Finds and returns a single path record.

Parameters

$pid: pid field value to search for (other args ignored if non-zero)

$path: path field value to search for (must also supply $module, $environment)

$mid: mid field value to search for (must also supply $module, $environment)

$module: module field value to search for.

$environment: environment field value to search for.

Return value

Object with fields from the sbp_path table, if query succeeds.

3 calls to _search_by_page_lookup()
search_by_page_force_reindex in ./search_by_page.module
Forces a page to be reindexed at the next cron run.
search_by_page_force_remove in ./search_by_page.module
Removes a page from Search by Page.
_search_by_page_do_search in ./search_by_page.module
Internal function: performs a search, for hook_search($op = 'search').

File

./search_by_page.module, line 1627
Main module file for Drupal module Search by Page.

Code

function _search_by_page_lookup($pid = 0, $path = '', $mid = 0, $module = '', $environment = 0) {
  $qry = 'SELECT * FROM {sbp_path} p WHERE ';
  if ($pid) {
    return db_fetch_object(db_query($qry . 'p.pid=%d', $pid));
  }
  if ($path) {
    return db_fetch_object(db_query($qry . "p.page_path='%s' AND p.from_module='%s' AND p.environment=%d", $path, $module, $environment));
  }
  return db_fetch_object(db_query($qry . "p.modid=%d AND p.from_module='%s' AND p.environment=%d", $mid, $module, $environment));
}