summaryrefslogtreecommitdiff
path: root/modules/taxonomy
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2014-01-15 14:43:16 -0500
committerDavid Rothstein <drothstein@gmail.com>2014-01-15 14:43:16 -0500
commitdc791ec5839b52c7616bf66993122aa9a1336384 (patch)
tree547a2a35a78818030c8c4dc2e0d1999f0f4f2f1e /modules/taxonomy
parenteffed1c831c997be26e12f18be0d8eb683f21a75 (diff)
downloadbrdo-dc791ec5839b52c7616bf66993122aa9a1336384.tar.gz
brdo-dc791ec5839b52c7616bf66993122aa9a1336384.tar.bz2
Drupal 7.26
Diffstat (limited to 'modules/taxonomy')
-rw-r--r--modules/taxonomy/taxonomy.install41
1 files changed, 34 insertions, 7 deletions
diff --git a/modules/taxonomy/taxonomy.install b/modules/taxonomy/taxonomy.install
index 2d44d3db3..e3603e1ac 100644
--- a/modules/taxonomy/taxonomy.install
+++ b/modules/taxonomy/taxonomy.install
@@ -638,6 +638,10 @@ function taxonomy_update_7005(&$sandbox) {
'type' => 'int',
'not null' => FALSE,
),
+ 'status' => array(
+ 'type' => 'int',
+ 'not null' => FALSE,
+ ),
'is_current' => array(
'type' => 'int',
'unsigned' => TRUE,
@@ -670,6 +674,7 @@ function taxonomy_update_7005(&$sandbox) {
$query->addField('n', 'type');
$query->addField('n2', 'created');
$query->addField('n2', 'sticky');
+ $query->addField('n2', 'status');
$query->addField('n2', 'nid', 'is_current');
// This query must return a consistent ordering across multiple calls.
// We need them ordered by node vid (since we use that to decide when
@@ -698,7 +703,7 @@ function taxonomy_update_7005(&$sandbox) {
// We do each pass in batches of 1000.
$batch = 1000;
- $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);
+ $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);
if (isset($sandbox['cursor'])) {
$values = $sandbox['cursor']['values'];
$deltas = $sandbox['cursor']['deltas'];
@@ -765,12 +770,14 @@ function taxonomy_update_7005(&$sandbox) {
// is_current column is a node ID if this revision is also current.
if ($record->is_current) {
db_insert($table_name)->fields($columns)->values($values)->execute();
-
- // Update the {taxonomy_index} table.
- db_insert('taxonomy_index')
- ->fields(array('nid', 'tid', 'sticky', 'created',))
- ->values(array($record->nid, $record->tid, $record->sticky, $record->created))
- ->execute();
+ // Only insert a record in the taxonomy index if the node is published.
+ if ($record->status) {
+ // Update the {taxonomy_index} table.
+ db_insert('taxonomy_index')
+ ->fields(array('nid', 'tid', 'sticky', 'created',))
+ ->values(array($record->nid, $record->tid, $record->sticky, $record->created))
+ ->execute();
+ }
}
}
@@ -888,3 +895,23 @@ function taxonomy_update_7010() {
));
}
+/**
+ * @addtogroup updates-7.x-extra
+ * @{
+ */
+
+/**
+ * Drop unpublished nodes from the index.
+ */
+function taxonomy_update_7011() {
+ $nids = db_query('SELECT nid from {node} WHERE status = :status', array(':status' => NODE_NOT_PUBLISHED))->fetchCol();
+ if (!empty($nids)) {
+ db_delete('taxonomy_index')
+ ->condition('nid', $nids)
+ ->execute();
+ }
+}
+
+/**
+ * @} End of "addtogroup updates-7.x-extra".
+ */