You are here

function drush_linkchecker_analyze in Link checker 7

Callback for command linkchecker-analyze.

File

./linkchecker.drush.inc, line 33
Drush interface to linkchecker functionalities.

Code

function drush_linkchecker_analyze() {
  global $base_url;
  if ($base_url == 'http://default') {
    drush_die('You MUST configure the site $base_url or provide --uri parameter.');
  }
  module_load_include('admin.inc', 'linkchecker');

  // Fake $form_state to leverage _submit function.
  $form_state = array(
    'values' => array(
      'op' => t('Analyze content for links'),
    ),
    'buttons' => array(),
  );
  $node_types = linkchecker_scan_node_types();
  if (!empty($node_types) || variable_get('linkchecker_scan_blocks', 0)) {
    linkchecker_analyze_links_submit(NULL, $form_state);
    drush_backend_batch_process();
  }
  else {
    drush_log('No content configured for link analysis.', 'status');
  }
}