You are here

function tft_archive_folder_batch_process in Taxonomy File Tree 7.2

Same name and namespace in other branches
  1. 7 tft.module \tft_archive_folder_batch_process()

Deprecated

Archives are OG specific

Processes the batch logic.

1 string reference to 'tft_archive_folder_batch_process'
tft_archive_folder_batch in ./tft.module

File

./tft.module, line 1443
Hook implementations and module logic for TFT.

Code

function tft_archive_folder_batch_process(&$context) {
  module_load_include('inc', 'tft', 'tft.admin');
  if (empty($context['sandbox'])) {
    $context['sandbox']['progress'] = 0;
    $context['sandbox']['max'] = (int) db_query("SELECT COUNT(*) FROM {node} WHERE type = 'og'")
      ->fetchField();
    $context['finished'] = 0;
  }
  $result = db_query("SELECT * FROM {node} WHERE type = 'og' LIMIT :limit, 10", array(
    ':limit' => $context['sandbox']['progress'],
  ));
  while ($node = $result
    ->fetchObject()) {
    $og_tid = tft_get_og_tid($node->nid);
    $archive_tid = tft_get_archive_tid($og_tid);
    if (empty($archive_tid)) {
      tft_add_term("Archives", $og_tid);
    }
    $context['sandbox']['progress']++;
  }

  // Set the percentage for the loadbar
  if ($context['sandbox']['progress'] < $context['sandbox']['max'] && !$stop) {
    $context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
  }
  else {
    $context['finished'] = 1;
  }
}