You are here

function linkchecker_admin_report_page in Link checker 7

Same name and namespace in other branches
  1. 6.2 includes/linkchecker.pages.inc \linkchecker_admin_report_page()

Menu callback for general reporting.

Return value

string Themed report page.

1 string reference to 'linkchecker_admin_report_page'
linkchecker_menu in ./linkchecker.module
Implements hook_menu().

File

./linkchecker.pages.inc, line 14
User page callbacks for the linkchecker module.

Code

function linkchecker_admin_report_page() {
  $ignore_response_codes = preg_split('/(\\r\\n?|\\n)/', variable_get('linkchecker_ignore_response_codes', "200\n206\n302\n304\n401\n403"));

  // Search for broken links in nodes and comments and blocks of all users.
  // @todo Try to make UNION'ed subselect resultset smaller.
  $subquery4 = db_select('linkchecker_node', 'ln')
    ->distinct()
    ->fields('ln', array(
    'lid',
  ));
  $subquery3 = db_select('linkchecker_comment', 'lc')
    ->distinct()
    ->fields('lc', array(
    'lid',
  ));
  $subquery2 = db_select('linkchecker_block_custom', 'lb')
    ->distinct()
    ->fields('lb', array(
    'lid',
  ));

  // UNION all linkchecker type tables.
  $subquery1 = db_select($subquery2
    ->union($subquery3)
    ->union($subquery4), 'q1')
    ->fields('q1', array(
    'lid',
  ));

  // Build pager query.
  $query = db_select('linkchecker_link', 'll')
    ->extend('PagerDefault')
    ->extend('TableSort');
  $query
    ->innerJoin($subquery1, 'q2', 'q2.lid = ll.lid');
  $query
    ->fields('ll');
  $query
    ->condition('ll.last_checked', 0, '<>');
  $query
    ->condition('ll.status', 1);
  $query
    ->condition('ll.code', $ignore_response_codes, 'NOT IN');
  return _linkchecker_report_page($query);
}