Projet

Général

Profil

Révision 4444412d

Ajouté par Julien Enselme il y a presque 10 ans

Update drupal 7.27 -> 7.28

Voir les différences:

drupal7/modules/taxonomy/taxonomy.install
903 903
/**
904 904
 * Drop unpublished nodes from the index.
905 905
 */
906
function taxonomy_update_7011() {
907
  $nids = db_query('SELECT nid from {node} WHERE status = :status', array(':status' => NODE_NOT_PUBLISHED))->fetchCol();
906
function taxonomy_update_7011(&$sandbox) {
907
  // Initialize information needed by the batch update system.
908
  if (!isset($sandbox['progress'])) {
909
    $sandbox['progress'] = 0;
910
    $sandbox['max'] = db_query('SELECT COUNT(DISTINCT n.nid) FROM {node} n INNER JOIN {taxonomy_index} t ON n.nid = t.nid WHERE n.status = :status', array(':status' => NODE_NOT_PUBLISHED))->fetchField();
911
    // If there's no data, don't bother with the extra work.
912
    if (empty($sandbox['max'])) {
913
      return;
914
    }
915
  }
916

  
917
  // Process records in groups of 5000.
918
  $limit = 5000;
919
  $nids = db_query_range('SELECT DISTINCT n.nid FROM {node} n INNER JOIN {taxonomy_index} t ON n.nid = t.nid WHERE n.status = :status', 0, $limit, array(':status' => NODE_NOT_PUBLISHED))->fetchCol();
908 920
  if (!empty($nids)) {
909 921
    db_delete('taxonomy_index')
910 922
      ->condition('nid', $nids)
911 923
      ->execute();
912 924
  }
925

  
926
  // Update our progress information for the batch update.
927
  $sandbox['progress'] += $limit;
928

  
929
  // Indicate our current progress to the batch update system, if the update is
930
  // not yet complete.
931
  if ($sandbox['progress'] < $sandbox['max']) {
932
    $sandbox['#finished'] = $sandbox['progress'] / $sandbox['max'];
933
  }
913 934
}
914 935

  
915 936
/**

Formats disponibles : Unified diff