You are here

function drush_metatag_importer_metatag_convert_page_title in Metatag 7

Callback to convert Page Title data.

File

metatag_importer/metatag_importer.drush.inc, line 72
Drush integration for the Metatag Importer module.

Code

function drush_metatag_importer_metatag_convert_page_title() {
  if (!db_table_exists('page_title')) {
    drush_set_error('metatag_importer', dt('Could not find the page_title table!'));
    return;
  }
  $records = db_query("SELECT COUNT(id) FROM {page_title} WHERE type IN ('node', 'taxonomy_term', 'user')")
    ->fetchField();
  if (empty($records)) {
    return dt('There are no page_title records to convert!');
  }
  if (!drush_confirm(dt('Ready to convert !count record(s) from Page Title?', array(
    '!count' => $records,
  )))) {
    return;
  }
  include 'metatag_importer.page_title.inc';

  // Start the importer.
  $count = metatag_importer_for_page_title();
  drush_print(dt('Converted !count record(s) from the Page Title module.', array(
    '!count' => $count,
  )));
}