You are here

function _search_by_page_lookup in Search by Page 7

Same name and namespace in other branches
  1. 8 search_by_page.module \_search_by_page_lookup()
  2. 6 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_search_execute in ./search_by_page.module
Implements hook_search_execute().

File

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

Code

function _search_by_page_lookup($pid = 0, $path = '', $mid = 0, $module = '', $environment = 0) {
  $qry = db_select('sbp_path', 'p')
    ->fields('p');
  if ($pid) {
    $qry
      ->condition('pid', $pid);
  }
  elseif ($path) {
    $qry
      ->condition('page_path', $path)
      ->condition('environment', $environment)
      ->condition('from_module', $module);
  }
  else {
    $qry
      ->condition('modid', $mid)
      ->condition('environment', $environment)
      ->condition('from_module', $module);
  }
  return $qry
    ->execute()
    ->fetchObject();
}