You are here

function la_batch_run in Location 7.3

Helper function for batch creation.

Return value

array Batch array for processing.

1 string reference to 'la_batch_run'
la_batch in contrib/location_autofill/la.module
Fill all locations using google geocode.

File

contrib/location_autofill/la.module, line 84
Location autofill routines.

Code

function la_batch_run() {
  $empty_locations = db_select('location', 'l')
    ->fields('l', array(
    'lid',
  ))
    ->condition('latitude', '0.000000')
    ->condition('longitude', '0.000000')
    ->execute()
    ->fetchAll();
  foreach ($empty_locations as $lid) {
    $operations[] = array(
      'la_geocode_worker',
      array(
        $lid->lid,
        t('(Processing location: @location)', array(
          '@location' => $lid->lid,
        )),
      ),
    );
  }
  $batch = array(
    'operations' => $operations,
    'finished' => 'la_batch_finished',
  );
  return $batch;
}