You are here

function _migrate_get_view_count in Migrate 6

Get the row count for a view, possibly filtered by arguments

Parameters

$view: Name of the view to query

$args: Optional arguments to the view, separated by '/'

Return value

Number of rows in the view.

3 calls to _migrate_get_view_count()
drush_migrate_status in ./migrate.drush.inc
A simplified version of the Process (dashboard) page
_migrate_dashboard_form in ./migrate_pages.inc
Form definition for dashboard page
_migrate_settings_form_submit in ./migrate_pages.inc

File

./migrate.module, line 1502
This module provides tools at "administer >> content >> migrate" for analyzing data from various sources and importing them into Drupal tables.

Code

function _migrate_get_view_count($view, $args = NULL) {
  if (is_string($view)) {
    $view = views_get_view($view);
  }

  // Force execution of count query, with minimal unnecessary results returned
  // @TODO: Find way to execute ONLY count query
  $view->pager['items_per_page'] = 1;
  $view->get_total_rows = TRUE;
  if ($args) {
    $view
      ->set_arguments(explode('/', $args));
  }
  $view
    ->execute();
  $rows = $view->total_rows;

  // TODO: Now, that's the total rows in the current source. However, it may be
  // (particularly with a content set that updates existing objects) that
  // previously-migrated content is no longer in the source, so the stats
  // (particularly Unimported) may be misleading. So, we would want to add in
  // anything in the map table not in the source. This is tricky, and may not
  // really be worth the performance impact, so we'll leave it alone for now.
  return $rows;
}