Projet

Général

Profil

Révision 01a79e9a

Ajouté par Assos Assos il y a plus de 10 ans

Update to drupal 7.26

Voir les différences:

htmltest/modules/taxonomy/taxonomy.install
638 638
          'type' => 'int',
639 639
          'not null' => FALSE,
640 640
        ),
641
        'status' => array(
642
          'type' => 'int',
643
          'not null' => FALSE,
644
        ),
641 645
        'is_current' => array(
642 646
          'type' => 'int',
643 647
          'unsigned' => TRUE,
......
670 674
    $query->addField('n', 'type');
671 675
    $query->addField('n2', 'created');
672 676
    $query->addField('n2', 'sticky');
677
    $query->addField('n2', 'status');
673 678
    $query->addField('n2', 'nid', 'is_current');
674 679
    // This query must return a consistent ordering across multiple calls.
675 680
    // We need them ordered by node vid (since we use that to decide when
......
698 703
    // We do each pass in batches of 1000.
699 704
    $batch = 1000;
700 705

  
701
    $result = db_query_range('SELECT vocab_id, tid, nid, vid, type, created, sticky, is_current FROM {taxonomy_update_7005} ORDER BY n', $sandbox['last'], $batch);
706
    $result = db_query_range('SELECT vocab_id, tid, nid, vid, type, created, sticky, status, is_current FROM {taxonomy_update_7005} ORDER BY n', $sandbox['last'], $batch);
702 707
    if (isset($sandbox['cursor'])) {
703 708
      $values = $sandbox['cursor']['values'];
704 709
      $deltas = $sandbox['cursor']['deltas'];
......
765 770
      // is_current column is a node ID if this revision is also current.
766 771
      if ($record->is_current) {
767 772
        db_insert($table_name)->fields($columns)->values($values)->execute();
768

  
769
        // Update the {taxonomy_index} table.
770
        db_insert('taxonomy_index')
771
          ->fields(array('nid', 'tid', 'sticky', 'created',))
772
          ->values(array($record->nid, $record->tid, $record->sticky, $record->created))
773
          ->execute();
773
        // Only insert a record in the taxonomy index if the node is published.
774
        if ($record->status) {
775
          // Update the {taxonomy_index} table.
776
          db_insert('taxonomy_index')
777
            ->fields(array('nid', 'tid', 'sticky', 'created',))
778
            ->values(array($record->nid, $record->tid, $record->sticky, $record->created))
779
            ->execute();
780
        }
774 781
      }
775 782
    }
776 783

  
......
888 895
  ));
889 896
}
890 897

  
898
/**
899
 * @addtogroup updates-7.x-extra
900
 * @{
901
 */
902

  
903
/**
904
 * Drop unpublished nodes from the index.
905
 */
906
function taxonomy_update_7011() {
907
  $nids = db_query('SELECT nid from {node} WHERE status = :status', array(':status' => NODE_NOT_PUBLISHED))->fetchCol();
908
  if (!empty($nids)) {
909
    db_delete('taxonomy_index')
910
      ->condition('nid', $nids)
911
      ->execute();
912
  }
913
}
914

  
915
/**
916
 * @} End of "addtogroup updates-7.x-extra".
917
 */

Formats disponibles : Unified diff