diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-09-29 15:13:57 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-09-29 15:13:57 +0000 |
commit | cef10893892a1c40f73fd972969c3512b0983cd6 (patch) | |
tree | c295a5dea1cc8f5d0ced7e7c967c70cf34f33c73 /modules/node/node.install | |
parent | 0a0b067c2404b041454cc7a5fc8cfbbb9ecd6027 (diff) | |
download | brdo-cef10893892a1c40f73fd972969c3512b0983cd6.tar.gz brdo-cef10893892a1c40f73fd972969c3512b0983cd6.tar.bz2 |
- Patch #570900 by Crell | asimmonds: Changed Destroy remnants of update_sql().
Diffstat (limited to 'modules/node/node.install')
-rw-r--r-- | modules/node/node.install | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/modules/node/node.install b/modules/node/node.install index 6ac772029..947757605 100644 --- a/modules/node/node.install +++ b/modules/node/node.install @@ -360,42 +360,34 @@ function node_schema() { * Fix node type 'module' attribute to avoid name-space conflicts. */ function node_update_7000() { - $ret = array(); - - $ret[] = update_sql("UPDATE {node_type} SET module = 'node_content' WHERE module = 'node'"); - db_change_field($ret, 'node_type', 'module', 'base', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE)); - - return $ret; + db_update('node_type') + ->fields(array('module' => 'node_content')) + ->condition('module', 'node') + ->execute(); } /** * Rename {node_revisions} table to {node_revision}. */ function node_update_7001() { - $ret = array(); - db_rename_table($ret, 'node_revisions', 'node_revision'); - return $ret; + db_rename_table('node_revisions', 'node_revision'); } /** * Extend the node_promote_status index to include all fields required for the node page query. */ function node_update_7002() { - $ret = array(); - db_drop_index($ret, 'node', 'node_promote_status'); - db_add_index($ret, 'node', 'node_frontpage', array('promote', 'status', 'sticky', 'created')); - return $ret; + db_drop_index('node', 'node_promote_status'); + db_add_index('node', 'node_frontpage', array('promote', 'status', 'sticky', 'created')); } /** * Remove the node_counter if the statistics module is uninstalled. */ function node_update_7003() { - $ret = array(); if (drupal_get_installed_schema_version('statistics') == SCHEMA_UNINSTALLED) { - db_drop_table($ret, 'node_counter'); + db_drop_table('node_counter'); } - return $ret; } /** @@ -418,30 +410,26 @@ function node_update_7004() { } // Delete old variable but leave 'teaser_length' for aggregator module upgrade. variable_del('node_preview'); - - return array(); } /** * Add status/comment/promote and sticky columns to the {node_revision} table. */ function node_update_7005() { - $ret = array(); foreach(array('status', 'comment', 'promote', 'sticky') as $column) { - db_add_field($ret, 'node_revision', $column, array( + db_add_field('node_revision', $column, array( 'type' => 'int', 'not null' => TRUE, 'default' => 0, )); } - return $ret; } /** * Convert body and teaser from node properties to fields, and migrate status/comment/promote and sticky columns to the {node_revision} table. */ function node_update_7006(&$context) { - $ret = array('#finished' => 0); + $context['#finished'] = 0; // Get node type info for every invocation. drupal_static_reset('_node_types_build'); @@ -536,33 +524,29 @@ function node_update_7006(&$context) { } } - $ret['#finished'] = min(0.99, $context['count'] / $context['total']); + $context['#finished'] = min(0.99, $context['count'] / $context['total']); } if (!$found) { // All nodes are processed. - $ret[] = array('success' => TRUE, 'query' => "{$context['total']} node body and teaser properties migrated to the 'body' field."); // Remove the now-obsolete body info from node_revision. - db_drop_field($ret, 'node_revision', 'body'); - db_drop_field($ret, 'node_revision', 'teaser'); - db_drop_field($ret, 'node_revision', 'format'); + db_drop_field('node_revision', 'body'); + db_drop_field('node_revision', 'teaser'); + db_drop_field('node_revision', 'format'); // We're done. - $ret['#finished'] = 1; + $context['#finished'] = 1; + return t("!number node body and teaser properties migrated to the 'body' field.", array('!number' => $context['total'])); } } - - return $ret; } /** * Remove column min_word_count. */ function node_update_7007() { - $ret = array(); - db_drop_field($ret, 'node_type', 'min_word_count'); - return $ret; + db_drop_field('node_type', 'min_word_count'); } /** |