? 371235-patched-benchmarks.txt
? 371235-unpatched-benchmarks.txt
? sites/all/modules/cvs
Index: update.php
===================================================================
RCS file: /cvs/drupal/drupal/update.php,v
retrieving revision 1.274
diff -u -p -r1.274 update.php
--- update.php 20 Feb 2009 07:14:42 -0000 1.274
+++ update.php 25 Feb 2009 15:35:52 -0000
@@ -446,34 +446,6 @@ function update_access_denied_page() {
}
/**
- * Create the batch table.
- *
- * This is part of the Drupal 5.x to 6.x migration.
- */
-function update_create_batch_table() {
-
- // If batch table exists, update is not necessary
- if (db_table_exists('batch')) {
- return;
- }
-
- $schema['batch'] = array(
- 'fields' => array(
- 'bid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
- 'token' => array('type' => 'varchar', 'length' => 64, 'not null' => TRUE),
- 'timestamp' => array('type' => 'int', 'not null' => TRUE),
- 'batch' => array('type' => 'text', 'not null' => FALSE, 'size' => 'big')
- ),
- 'primary key' => array('bid'),
- 'indexes' => array('token' => array('token')),
- );
-
- $ret = array();
- db_create_table($ret, 'batch', $schema['batch']);
- return $ret;
-}
-
-/**
* Disable anything in the {system} table that is not compatible with the
* current version of Drupal core.
*/
@@ -521,61 +493,6 @@ function update_check_incompatibility($n
}
/**
- * Perform Drupal 5.x to 6.x updates that are required for update.php
- * to function properly.
- *
- * This function runs when update.php is run the first time for 6.x,
- * even before updates are selected or performed. It is important
- * that if updates are not ultimately performed that no changes are
- * made which make it impossible to continue using the prior version.
- * Just adding columns is safe. However, renaming the
- * system.description column to owner is not. Therefore, we add the
- * system.owner column and leave it to system_update_6008() to copy
- * the data from description and remove description. The same for
- * renaming locales_target.locale to locales_target.language, which
- * will be finished by locale_update_6002().
- */
-function update_fix_d6_requirements() {
- $ret = array();
-
- if (drupal_get_installed_schema_version('system') < 6000 && !variable_get('update_d6_requirements', FALSE)) {
- $spec = array('type' => 'int', 'size' => 'small', 'default' => 0, 'not null' => TRUE);
- db_add_field($ret, 'cache', 'serialized', $spec);
- db_add_field($ret, 'cache_filter', 'serialized', $spec);
- db_add_field($ret, 'cache_page', 'serialized', $spec);
- db_add_field($ret, 'cache_menu', 'serialized', $spec);
-
- db_add_field($ret, 'system', 'info', array('type' => 'text'));
- db_add_field($ret, 'system', 'owner', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
- if (db_table_exists('locales_target')) {
- db_add_field($ret, 'locales_target', 'language', array('type' => 'varchar', 'length' => 12, 'not null' => TRUE, 'default' => ''));
- }
- if (db_table_exists('locales_source')) {
- db_add_field($ret, 'locales_source', 'textgroup', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'default'));
- db_add_field($ret, 'locales_source', 'version', array('type' => 'varchar', 'length' => 20, 'not null' => TRUE, 'default' => 'none'));
- }
- variable_set('update_d6_requirements', TRUE);
-
- // Create the cache_block table. See system_update_6027() for more details.
- $schema['cache_block'] = array(
- 'fields' => array(
- 'cid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'data' => array('type' => 'blob', 'not null' => FALSE, 'size' => 'big'),
- 'expire' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
- 'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
- 'headers' => array('type' => 'text', 'not null' => FALSE),
- 'serialized' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0)
- ),
- 'indexes' => array('expire' => array('expire')),
- 'primary key' => array('cid'),
- );
- db_create_table($ret, 'cache_block', $schema['cache_block']);
- }
-
- return $ret;
-}
-
-/**
* Users who still have a Drupal 6 database (and are in the process of
* updating to Drupal 7) need extra help before a full bootstrap can be
* achieved. This function does the necessary preliminary work that allows
@@ -721,7 +638,6 @@ if (!empty($update_free_access) || $user
include_once DRUPAL_ROOT . '/includes/batch.inc';
drupal_load_updates();
- update_fix_d6_requirements();
update_fix_compatibility();
$op = isset($_REQUEST['op']) ? $_REQUEST['op'] : '';
Index: modules/aggregator/aggregator.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.install,v
retrieving revision 1.20
diff -u -p -r1.20 aggregator.install
--- modules/aggregator/aggregator.install 22 Dec 2008 19:38:31 -0000 1.20
+++ modules/aggregator/aggregator.install 25 Feb 2009 15:35:52 -0000
@@ -259,6 +259,11 @@ function aggregator_schema() {
}
/**
+ * @defgroup updates-6.x-to-7.x Aggregator updates from 6.x to 7.x
+ * @{
+ */
+
+/**
* Add hash column to aggregator_feed table.
*/
function aggregator_update_7000() {
@@ -266,3 +271,9 @@ function aggregator_update_7000() {
db_add_field($ret, 'aggregator_feed', 'hash', array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''));
return $ret;
}
+
+/**
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
+ */
+
Index: modules/block/block.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.install,v
retrieving revision 1.19
diff -u -p -r1.19 block.install
--- modules/block/block.install 18 Feb 2009 15:19:55 -0000 1.19
+++ modules/block/block.install 25 Feb 2009 15:35:53 -0000
@@ -2,6 +2,20 @@
// $Id: block.install,v 1.19 2009/02/18 15:19:55 webchick Exp $
/**
+ * Implementation of hook_install().
+ */
+function block_install() {
+ drupal_install_schema('block');
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function block_uninstall() {
+ drupal_uninstall_schema('block');
+}
+
+/**
* Implementation of hook_schema().
*/
function block_schema() {
@@ -168,23 +182,3 @@ function block_schema() {
return $schema;
}
-/**
- * Implementation of hook_install().
- */
-function block_install() {
- drupal_install_schema('block');
-}
-
-/**
- * Implementation of hook_uninstall().
- */
-function block_uninstall() {
- drupal_uninstall_schema('block');
-}
-
-/**
- * Refresh the block cache.
- */
-function block_update_7000() {
- return array();
-}
Index: modules/blogapi/blogapi.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.install,v
retrieving revision 1.5
diff -u -p -r1.5 blogapi.install
--- modules/blogapi/blogapi.install 18 Feb 2009 15:19:55 -0000 1.5
+++ modules/blogapi/blogapi.install 25 Feb 2009 15:35:53 -0000
@@ -61,35 +61,9 @@ function blogapi_schema() {
}
/**
- * @defgroup updates-5.x-to-6.x Blog API updates from 5.x to 6.x
- * @{
+ * Implementation of hook_update_last_removed().
*/
-
-/**
- * Inform users about the new permission.
- */
-function blogapi_update_6000() {
- drupal_set_message("Blog API module does not depend on blog module's permissions anymore, but provides its own 'administer content with blog api' permission instead. Until 'module-blogapi')) . '">this permission is assigned to at least one user role, only the site administrator will be able to use Blog API features.');
- return array();
-}
-
-/**
- * Add blogapi_files table to enable size restriction for BlogAPI file uploads.
- *
- * This table was introduced in Drupal 6.4.
- */
-function blogapi_update_6001() {
- $ret = array();
-
- if (!db_table_exists('blogapi_files')) {
- $schema = blogapi_schema();
- db_create_table($ret, 'blogapi_files', $schema['blogapi_files']);
- }
-
- return $ret;
+function blogapi_update_last_removed() {
+ return 6001;
}
-/**
- * @} End of "defgroup updates-5.x-to-6.x"
- * The next series of updates should start at 7000.
- */
Index: modules/book/book.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.install,v
retrieving revision 1.27
diff -u -p -r1.27 book.install
--- modules/book/book.install 19 Jan 2009 10:46:50 -0000 1.27
+++ modules/book/book.install 25 Feb 2009 15:35:53 -0000
@@ -44,209 +44,6 @@ function _book_install_type_create() {
}
/**
- * Drupal 5.x to 6.x update.
- *
- * This function moves any existing book hierarchy into the new structure used
- * in the 6.x module. Rather than storing the hierarchy in the {book} table,
- * the menu API is used to store the hierarchy in the {menu_links} table and the
- * {book} table serves to uniquely connect a node to a menu link.
- *
- * In order to accomplish this, the current hierarchy is processed using a stack.
- * The stack insures that each parent is processed before any of its children
- * in the book hierarchy, and is compatible with batched update processing.
- *
- */
-function book_update_6000() {
- $ret = array();
-
- // Set up for a multi-part update.
- if (!isset($_SESSION['book_update_6000'])) {
-
- $schema['book'] = array(
- 'fields' => array(
- 'mlid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'bid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- ),
- 'primary key' => array('mlid'),
- 'unique keys' => array(
- 'nid' => array('nid'),
- ),
- 'indexes' => array(
- 'bid' => array('bid'),
- ),
- );
- // Add the node type.
- _book_install_type_create();
-
- // Fix role permissions to account for the changed names
- // Setup the array holding strings to match and the corresponding
- // strings to replace them with.
- $replace = array(
- 'outline posts in books' => 'administer book outlines',
- 'create book pages' => 'create book content',
- 'edit book pages' => 'edit any book content',
- 'edit own book pages' => 'edit own book content',
- 'see printer-friendly version' => 'access printer-friendly version',
- );
-
- // Loop over all the roles, and do the necessary transformations.
- $query = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
- while ($role = db_fetch_object($query)) {
- // Replace all the old permissions with the corresponding new permissions.
- $fixed_perm = strtr($role->perm, $replace);
- // If the user could previously create book pages, they should get the new
- // 'add content to books' permission.
- if (strpos($role->perm, 'create book pages') !== FALSE) {
- $fixed_perm .= ', add content to books';
- }
- // Only save if the permissions have changed.
- if ($fixed_perm != $role->perm) {
- $ret[] = update_sql("UPDATE {permission} SET perm = '$fixed_perm' WHERE rid = $role->rid");
- }
- }
-
- // Determine whether there are any existing nodes in the book hierarchy.
- if (db_result(db_query("SELECT COUNT(*) FROM {book}"))) {
- // Temporary table for the old book hierarchy; we'll discard revision info.
- $schema['book_temp'] = array(
- 'fields' => array(
- 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'parent' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
- 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny')
- ),
- 'indexes' => array(
- 'parent' => array('parent')
- ),
- 'primary key' => array('nid'),
- );
-
- db_create_table($ret, 'book_temp', $schema['book_temp']);
-
- // Insert each node in the old table into the temporary table.
- $ret[] = update_sql("INSERT INTO {book_temp} (nid, parent, weight) SELECT b.nid, b.parent, b.weight FROM {book} b INNER JOIN {node} n on b.vid = n.vid");
- $ret[] = update_sql("DROP TABLE {book}");
-
- db_create_table($ret, 'book', $schema['book']);
-
- drupal_set_session('book_update_6000_orphans', array('from' => 0));
- drupal_set_session('book_update_6000', array());
- $result = db_query("SELECT * from {book_temp} WHERE parent = 0");
-
- // Collect all books - top-level nodes.
- while ($a = db_fetch_array($result)) {
- $_SESSION['book_update_6000'][] = $a;
- }
- $ret['#finished'] = FALSE;
- return $ret;
- }
- else {
- // No existing nodes in the hierarchy, so drop the table and re-create it.
- $ret[] = update_sql("DROP TABLE {book}");
- db_create_table($ret, 'book', $schema['book']);
- return $ret;
- }
- }
- elseif ($_SESSION['book_update_6000_orphans']) {
- // Do the first batched part of the update - collect orphans.
- $update_count = 400; // Update this many at a time.
-
- $result = db_query_range("SELECT * FROM {book_temp}", $_SESSION['book_update_6000_orphans']['from'], $update_count);
- $has_rows = FALSE;
- // Go through the next $update_count book pages and locate the orphans.
- while ($book = db_fetch_array($result)) {
- $has_rows = TRUE;
- // Orphans are defined as nodes whose parent does not exist in the table.
- if ($book['parent'] && !db_result(db_query("SELECT COUNT(*) FROM {book_temp} WHERE nid = %d", $book['parent']))) {
- if (empty($_SESSION['book_update_6000_orphans']['book'])) {
- // The first orphan becomes the parent for all other orphans.
- $book['parent'] = 0;
- $_SESSION['book_update_6000_orphans']['book'] = $book;
- $ret[] = array('success' => TRUE, 'query' => 'Relocated orphan book pages.');
- }
- else {
- // Re-assign the parent value of the book, and add it to the stack.
- $book['parent'] = $_SESSION['book_update_6000_orphans']['book']['nid'];
- $_SESSION['book_update_6000'][] = $book;
- }
- }
- }
- if ($has_rows) {
- $_SESSION['book_update_6000_orphans']['from'] += $update_count;
- }
- else {
- if (!empty($_SESSION['book_update_6000_orphans']['book'])) {
- // The orphans' parent is added last, so it will be processed first.
- $_SESSION['book_update_6000'][] = $_SESSION['book_update_6000_orphans']['book'];
- }
- $_SESSION['book_update_6000_orphans'] = FALSE;
- }
- $ret['#finished'] = FALSE;
-
- return $ret;
- }
- else {
- // Run the next batched part of the update.
- $update_count = 100; // Update this many at a time
-
- while ($update_count && $_SESSION['book_update_6000']) {
- // Get the last node off the stack.
- $book = array_pop($_SESSION['book_update_6000']);
-
- // Add all of this node's children to the stack.
- $result = db_query("SELECT * FROM {book_temp} WHERE parent = %d", $book['nid']);
- while ($a = db_fetch_array($result)) {
- $_SESSION['book_update_6000'][] = $a;
- }
-
- if ($book['parent']) {
- // If its not a top level page, get its parent's mlid.
- $parent = db_fetch_array(db_query("SELECT b.mlid AS plid, b.bid FROM {book} b WHERE b.nid = %d", $book['parent']));
- $book = array_merge($book, $parent);
- }
- else {
- // There is no parent - this is a new book.
- $book['plid'] = 0;
- $book['bid'] = $book['nid'];
- }
-
- $book += array(
- 'module' => 'book',
- 'link_path' => 'node/' . $book['nid'],
- 'router_path' => 'node/%',
- 'menu_name' => 'book-toc-' . $book['bid'],
- );
- $book = array_merge($book, db_fetch_array(db_query("SELECT title AS link_title FROM {node} WHERE nid = %d", $book['nid'])));
-
- // Items with depth > MENU_MAX_DEPTH cannot be saved.
- if (menu_link_save($book)) {
- db_query("INSERT INTO {book} (mlid, nid, bid) VALUES (%d, %d, %d)", $book['mlid'], $book['nid'], $book['bid']);
- }
- else {
- // The depth was greater then MENU_MAX_DEPTH, so attach it to the
- // closest valid parent.
- $book['plid'] = db_result(db_query("SELECT plid FROM {menu_links} WHERE mlid = %d", $book['plid']));
- if (menu_link_save($book)) {
- db_query("INSERT INTO {book} (mlid, nid, bid) VALUES (%d, %d, %d)", $book['mlid'], $book['nid'], $book['bid']);
- }
- }
- $update_count--;
- }
- $ret['#finished'] = FALSE;
- }
-
- if (empty($_SESSION['book_update_6000'])) {
- $ret['#finished'] = TRUE;
- $ret[] = array('success' => TRUE, 'query' => 'Relocated existing book pages.');
- $ret[] = update_sql("DROP TABLE {book_temp}");
- unset($_SESSION['book_update_6000']);
- unset($_SESSION['book_update_6000_orphans']);
- }
-
- return $ret;
-}
-
-/**
* Implementation of hook_schema().
*/
function book_schema() {
@@ -286,3 +83,11 @@ function book_schema() {
return $schema;
}
+
+/**
+ * Implementation of hook_update_last_removed().
+ */
+function book_update_last_removed() {
+ return 6000;
+}
+
Index: modules/comment/comment.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v
retrieving revision 1.31
diff -u -p -r1.31 comment.install
--- modules/comment/comment.install 18 Feb 2009 15:19:55 -0000 1.31
+++ modules/comment/comment.install 25 Feb 2009 15:35:53 -0000
@@ -41,119 +41,6 @@ function comment_enable() {
}
/**
- * Changed node_comment_statistics to use node->changed to avoid future timestamps.
- */
-function comment_update_1() {
- // Change any future last comment timestamps to current time.
- db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE last_comment_timestamp > %d', REQUEST_TIME, REQUEST_TIME);
-
- // Unstuck node indexing timestamp if needed.
- if (($last = variable_get('node_cron_last', FALSE)) !== FALSE) {
- variable_set('node_cron_last', min(REQUEST_TIME, $last));
- }
-
- return array();
-}
-
-/**
- * @defgroup updates-5.x-to-6.x Comment updates from 5.x to 6.x
- * @{
- */
-
-function comment_update_6001() {
- $ret[] = update_sql("ALTER TABLE {comments} DROP score");
- $ret[] = update_sql("ALTER TABLE {comments} DROP users");
-
- return $ret;
-}
-
-/**
- * Changed comment settings from global to per-node -- copy global
- * settings to all node types.
- */
-function comment_update_6002() {
- // Comment module might not be enabled when this is run, but we need the
- // constants defined by the module for this update.
- drupal_load('module', 'comment');
- $settings = array(
- 'comment_default_mode' => COMMENT_MODE_THREADED_EXPANDED,
- 'comment_default_order' => COMMENT_ORDER_NEWEST_FIRST,
- 'comment_default_per_page' => 50,
- 'comment_controls' => COMMENT_CONTROLS_HIDDEN,
- 'comment_anonymous' => COMMENT_ANONYMOUS_MAYNOT_CONTACT,
- 'comment_subject_field' => 1,
- 'comment_preview' => COMMENT_PREVIEW_REQUIRED,
- 'comment_form_location' => COMMENT_FORM_SEPARATE_PAGE,
- );
- $types = node_get_types();
- foreach ($settings as $setting => $default) {
- $value = variable_get($setting, $default);
- foreach ($types as $type => $object) {
- variable_set($setting . '_' . $type, $value);
- }
- variable_del($setting);
- }
- return array(array('success' => TRUE, 'query' => 'Global comment settings copied to all node types.'));
-}
-
-/**
- * Add index to parent ID field.
- */
-function comment_update_6003() {
- $ret = array();
- db_add_index($ret, 'comments', 'pid', array('pid'));
-
- return $ret;
-}
-
-/**
- * @} End of "defgroup updates-5.x-to-6.x"
- * The next series of updates should start at 7000.
- */
-
-/**
- * @defgroup updates-6.x-to-7.x Comment updates from 6.x to 7.x
- * @{
- */
-
-/**
- * Remove comment settings for page ordering.
- */
-function comment_update_7000() {
- $types = node_get_types();
- foreach ($types as $type => $object) {
- variable_del('comment_default_order' . $type);
- }
- return array(array('success' => TRUE, 'query' => 'Comment order settings removed.'));
-}
-
-/**
- * Change comment status from published being 0 to being 1
- */
-function comment_update_7001() {
- $ret = array();
- $ret[] = update_sql("UPDATE {comments} SET status = 3 WHERE status = 0");
- $ret[] = update_sql("UPDATE {comments} SET status = 0 WHERE status = 1");
- $ret[] = update_sql("UPDATE {comments} SET status = 1 WHERE status = 3");
-
- return $ret;
-}
-
-/**
- * Rename {comments} table to {comment}.
- */
-function comment_update_7002() {
- $ret = array();
- db_rename_table($ret, 'comments', 'comment');
- return $ret;
-}
-
-/**
- * @} End of "defgroup updates-6.x-to-7.x"
- * The next series of updates should start at 8000.
- */
-
-/**
* Implementation of hook_schema().
*/
function comment_schema() {
@@ -302,3 +189,53 @@ function comment_schema() {
return $schema;
}
+
+/**
+ * Implementation of hook_update_last_removed().
+ */
+function comment_update_last_removed() {
+ return 6003;
+}
+
+/**
+ * @defgroup updates-6.x-to-7.x Comment updates from 6.x to 7.x
+ * @{
+ */
+
+/**
+ * Remove comment settings for page ordering.
+ */
+function comment_update_7000() {
+ $types = node_get_types();
+ foreach ($types as $type => $object) {
+ variable_del('comment_default_order' . $type);
+ }
+ return array(array('success' => TRUE, 'query' => 'Comment order settings removed.'));
+}
+
+/**
+ * Change comment status from published being 0 to being 1
+ */
+function comment_update_7001() {
+ $ret = array();
+ $ret[] = update_sql("UPDATE {comments} SET status = 3 WHERE status = 0");
+ $ret[] = update_sql("UPDATE {comments} SET status = 0 WHERE status = 1");
+ $ret[] = update_sql("UPDATE {comments} SET status = 1 WHERE status = 3");
+
+ return $ret;
+}
+
+/**
+ * Rename {comments} table to {comment}.
+ */
+function comment_update_7002() {
+ $ret = array();
+ db_rename_table($ret, 'comments', 'comment');
+ return $ret;
+}
+
+/**
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
+ */
+
Index: modules/contact/contact.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.install,v
retrieving revision 1.11
diff -u -p -r1.11 contact.install
--- modules/contact/contact.install 15 Nov 2008 13:01:05 -0000 1.11
+++ modules/contact/contact.install 25 Feb 2009 15:35:53 -0000
@@ -79,3 +79,4 @@ function contact_schema() {
return $schema;
}
+
Index: modules/dblog/dblog.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.install,v
retrieving revision 1.13
diff -u -p -r1.13 dblog.install
--- modules/dblog/dblog.install 18 Feb 2009 15:19:55 -0000 1.13
+++ modules/dblog/dblog.install 25 Feb 2009 15:35:53 -0000
@@ -104,29 +104,32 @@ function dblog_schema() {
}
/**
- * Allow NULL values for links and longer referers.
+ * @defgroup updates-6.x-to-7.x Database logging updates from 6.x to 7.x
+ * @{
*/
-function dblog_update_7001() {
+
+/**
+ * Allow NULL values for links and longer referers and types.
+ */
+function dblog_update_7000() {
$ret = array();
db_change_field($ret, 'watchdog', 'link', 'link', array('type' => 'varchar', 'length' => 255, 'not null' => FALSE, 'default' => ''));
db_change_field($ret, 'watchdog', 'referer', 'referer', array('type' => 'text', 'not null' => FALSE));
+ db_change_field($ret, 'watchdog', 'type', 'type', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''));
return $ret;
}
/**
* Add index on uid.
*/
-function dblog_update_7002() {
+function dblog_update_7001() {
$ret = array();
db_add_index($ret, 'watchdog', 'uid', array('uid'));
return $ret;
}
/**
- * Allow longer type values.
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
*/
-function dblog_update_7003() {
- $ret = array();
- db_change_field($ret, 'watchdog', 'type', 'type', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''));
- return $ret;
-}
+
Index: modules/filter/filter.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.install,v
retrieving revision 1.12
diff -u -p -r1.12 filter.install
--- modules/filter/filter.install 21 Jan 2009 16:58:42 -0000 1.12
+++ modules/filter/filter.install 25 Feb 2009 15:35:53 -0000
@@ -99,6 +99,11 @@ function filter_schema() {
}
/**
+ * @defgroup updates-6.x-to-7.x Filter updates from 6.x to 7.x
+ * @{
+ */
+
+/**
* Add a weight column to the filter formats table.
*/
function filter_update_7000() {
@@ -132,3 +137,9 @@ function filter_update_7002() {
db_rename_table($ret, 'filter_formats', 'filter_format');
return $ret;
}
+
+/**
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
+ */
+
Index: modules/forum/forum.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.install,v
retrieving revision 1.26
diff -u -p -r1.26 forum.install
--- modules/forum/forum.install 14 Jan 2009 21:16:20 -0000 1.26
+++ modules/forum/forum.install 25 Feb 2009 15:35:53 -0000
@@ -11,6 +11,9 @@ function forum_install() {
db_query("UPDATE {system} SET weight = 1 WHERE name = 'forum'");
}
+/**
+ * Implementation of hook_enable().
+ */
function forum_enable() {
if ($vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', 0))) {
// Existing install. Add back forum node type, if the forums
@@ -100,31 +103,9 @@ function forum_schema() {
}
/**
- * Create the forum vocabulary if does not exist. Assign the
- * vocabulary a low weight so it will appear first in forum topic
- * create and edit forms. Do not just call forum_enable() because in
- * future versions it might do something different.
+ * Implementation of hook_update_last_removed().
*/
-function forum_update_6000() {
- $ret = array();
-
- $vid = variable_get('forum_nav_vocabulary', 0);
- $vocabularies = taxonomy_get_vocabularies();
- if (!isset($vocabularies[$vid])) {
- $vocabulary = array(
- 'name' => t('Forums'),
- 'multiple' => 0,
- 'required' => 0,
- 'hierarchy' => 1,
- 'relations' => 0,
- 'module' => 'forum',
- 'weight' => -10,
- 'nodes' => array('forum' => 1),
- );
- taxonomy_save_vocabulary($vocabulary);
-
- variable_set('forum_nav_vocabulary', $vocabulary['vid']);
- }
-
- return $ret;
+function forum_update_last_removed() {
+ return 6000;
}
+
Index: modules/locale/locale.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.install,v
retrieving revision 1.34
diff -u -p -r1.34 locale.install
--- modules/locale/locale.install 13 Feb 2009 00:45:18 -0000 1.34
+++ modules/locale/locale.install 25 Feb 2009 15:35:54 -0000
@@ -16,196 +16,6 @@ function locale_install() {
}
/**
- * @defgroup updates-5.x-to-6.x Locale updates from 5.x to 6.x
- * @{
- */
-
-/**
- * {locales_meta} table became {languages}.
- */
-function locale_update_6000() {
- $ret = array();
-
- $schema['languages'] = array(
- 'fields' => array(
- 'language' => array(
- 'type' => 'varchar',
- 'length' => 12,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'native' => array(
- 'type' => 'varchar',
- 'length' => 64,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'direction' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'enabled' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'plurals' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'formula' => array(
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'domain' => array(
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'prefix' => array(
- 'type' => 'varchar',
- 'length' => 128,
- 'not null' => TRUE,
- 'default' => '',
- ),
- 'weight' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- ),
- 'javascript' => array( //Adds a column to store the filename of the JavaScript translation file.
- 'type' => 'varchar',
- 'length' => 32,
- 'not null' => TRUE,
- 'default' => '',
- ),
- ),
- 'primary key' => array('language'),
- 'indexes' => array(
- 'list' => array('weight', 'name'),
- ),
- );
-
- db_create_table($ret, 'languages', $schema['languages']);
-
- // Save the languages
- $ret[] = update_sql("INSERT INTO {languages} (language, name, native, direction, enabled, plurals, formula, domain, prefix, weight) SELECT locale, name, name, 0, enabled, plurals, formula, '', locale, 0 FROM {locales_meta}");
-
- // Save the language count in the variable table
- $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1'));
- variable_set('language_count', $count);
-
- // Save the default language in the variable table
- $default = db_fetch_object(db_query('SELECT * FROM {locales_meta} WHERE isdefault = 1'));
- variable_set('language_default', (object) array('language' => $default->locale, 'name' => $default->name, 'native' => '', 'direction' => 0, 'enabled' => 1, 'plurals' => $default->plurals, 'formula' => $default->formula, 'domain' => '', 'prefix' => $default->locale, 'weight' => 0));
-
- $ret[] = update_sql("DROP TABLE {locales_meta}");
- return $ret;
-}
-
-/**
- * Change locale column to language. The language column is added by
- * update_fix_d6_requirements() in update.php to avoid a large number
- * of error messages from update.php. All we need to do here is copy
- * locale to language and then drop locale.
- */
-function locale_update_6001() {
- $ret = array();
- $ret[] = update_sql('UPDATE {locales_target} SET language = locale');
- db_drop_field($ret, 'locales_target', 'locale');
- return $ret;
-}
-
-/**
- * Remove empty translations, we don't need these anymore.
- */
-function locale_update_6002() {
- $ret = array();
- $ret[] = update_sql("DELETE FROM {locales_target} WHERE translation = ''");
- return $ret;
-}
-
-/**
- * Prune strings with no translations (will be automatically re-registered if still in use)
- */
-function locale_update_6003() {
- $ret = array();
- $ret[] = update_sql("DELETE FROM {locales_source} WHERE lid NOT IN (SELECT lid FROM {locales_target})");
- return $ret;
-}
-
-/**
- * Fix remaining inconsistent indexes.
- */
-function locale_update_6004() {
- $ret = array();
- db_add_index($ret, 'locales_target', 'language', array('language'));
-
- switch ($GLOBALS['db_type']) {
- case 'pgsql':
- db_drop_index($ret, 'locales_source', 'source');
- db_add_index($ret, 'locales_source', 'source', array(array('source', 30)));
- break;
- }
-
- return $ret;
-}
-
-/**
- * Change language setting variable of content types.
- *
- * Use language_content_type_ instead of language_
- * so content types such as 'default', 'count' or 'negotiation' will not
- * interfere with language variables.
- */
-function locale_update_6005() {
- foreach (node_get_types() as $type => $content_type) {
- // Default to NULL, so we can skip dealing with non-existent settings.
- $setting = variable_get('language_' . $type);
- if ($type == 'default' && is_numeric($setting)) {
- // language_default was overwritten with the content type setting,
- // so reset the default language and save the content type setting.
- variable_set('language_content_type_default', $setting);
- variable_del('language_default');
- drupal_set_message('The default language setting has been reset to its default value. Check the ' . l('language configuration page', 'admin/settings/language') . ' to configure it correctly.');
- }
- elseif ($type == 'negotiation') {
- // language_content_type_negotiation is an integer either if it is
- // the negotiation setting or the content type setting.
- // The language_negotiation setting is not reset, but
- // the user is alerted that this setting possibly was overwritten
- variable_set('language_content_type_negotiation', $setting);
- drupal_set_message('The language negotiation setting was possibly overwritten by a content type of the same name. Check the ' . l('language configuration page', 'admin/settings/language/configure') . ' and the ' . l('' . $content_type->name . " content type's multilingual support settings", 'admin/build/types/negotiation', array('html' => TRUE)) . ' to configure them correctly.');
- }
- elseif (!is_null($setting)) {
- // Change the language setting variable for any other content type.
- // Do not worry about language_count, it will be updated below.
- variable_set('language_content_type_' . $type, $setting);
- variable_del('language_' . $type);
- }
- }
- // Update language count variable that might be overwritten.
- $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1'));
- variable_set('language_count', $count);
- return array();
-}
-
-/**
- * @} End of "defgroup updates-5.x-to-6.x"
- */
-
-/**
* Implementation of hook_uninstall().
*/
function locale_uninstall() {
@@ -418,3 +228,10 @@ function locale_schema() {
return $schema;
}
+/**
+ * Implementation of hook_update_last_removed().
+ */
+function locale_update_last_removed() {
+ return 6005;
+}
+
Index: modules/node/node.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.install,v
retrieving revision 1.12
diff -u -p -r1.12 node.install
--- modules/node/node.install 18 Feb 2009 15:19:56 -0000 1.12
+++ modules/node/node.install 25 Feb 2009 15:35:54 -0000
@@ -382,7 +382,8 @@ function node_schema() {
}
/**
- * Drupal 6.x to 7.x updates
+ * @defgroup updates-6.x-to-7.x Node updates from 6.x to 7.x
+ * @{
*/
/**
@@ -390,10 +391,8 @@ function node_schema() {
*/
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;
}
@@ -417,5 +416,7 @@ function node_update_7002() {
}
/**
- * End of 6.x to 7.x updates
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
*/
+
Index: modules/poll/poll.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.install,v
retrieving revision 1.19
diff -u -p -r1.19 poll.install
--- modules/poll/poll.install 18 Feb 2009 15:19:56 -0000 1.19
+++ modules/poll/poll.install 25 Feb 2009 15:35:54 -0000
@@ -139,6 +139,11 @@ function poll_schema() {
}
/**
+ * @defgroup updates-6.x-to-7.x Poll updates from 6.x to 7.x
+ * @{
+ */
+
+/**
* Rename {poll_choices} table to {poll_choice} and {poll_votes} to {poll_vote}.
*/
function poll_update_7001() {
@@ -153,11 +158,12 @@ function poll_update_7001() {
*/
function poll_update_7002() {
$ret = array();
- $field = array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- );
- db_add_field($ret, 'poll_votes', 'timestamp', $field);
+ db_add_field($ret, 'poll_votes', 'timestamp', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
return $ret;
}
+
+/**
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
+ */
+
Index: modules/profile/profile.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.install,v
retrieving revision 1.16
diff -u -p -r1.16 profile.install
--- modules/profile/profile.install 18 Feb 2009 15:19:56 -0000 1.16
+++ modules/profile/profile.install 25 Feb 2009 15:35:54 -0000
@@ -150,6 +150,11 @@ function profile_schema() {
}
/**
+ * @defgroup updates-6.x-to-7.x Profile updates from 6.x to 7.x
+ * @{
+ */
+
+/**
* Rename {profile_fields} table to {profile_field} and {profile_values} to {profile_value}.
*/
function profile_update_7001() {
@@ -158,3 +163,9 @@ function profile_update_7001() {
db_rename_table($ret, 'profile_values', 'profile_value');
return $ret;
}
+
+/**
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
+ */
+
Index: modules/search/search.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.install,v
retrieving revision 1.19
diff -u -p -r1.19 search.install
--- modules/search/search.install 15 Nov 2008 13:01:09 -0000 1.19
+++ modules/search/search.install 25 Feb 2009 15:35:54 -0000
@@ -153,6 +153,11 @@ function search_schema() {
}
/**
+ * @defgroup updates-6.x-to-7.x Search updates from 6.x to 7.x
+ * @{
+ */
+
+/**
* Replace unique keys in 'search_dataset' and 'search_index' by primary keys.
*/
function search_update_7000() {
@@ -166,3 +171,9 @@ function search_update_7000() {
return $ret;
}
+
+/**
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
+ */
+
Index: modules/simpletest/simpletest.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.install,v
retrieving revision 1.16
diff -u -p -r1.16 simpletest.install
--- modules/simpletest/simpletest.install 22 Feb 2009 17:55:30 -0000 1.16
+++ modules/simpletest/simpletest.install 25 Feb 2009 15:35:55 -0000
@@ -211,3 +211,4 @@ function simpletest_schema() {
);
return $schema;
}
+
Index: modules/statistics/statistics.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.install,v
retrieving revision 1.16
diff -u -p -r1.16 statistics.install
--- modules/statistics/statistics.install 18 Feb 2009 15:19:56 -0000 1.16
+++ modules/statistics/statistics.install 25 Feb 2009 15:35:55 -0000
@@ -10,25 +10,6 @@ function statistics_install() {
}
/**
- * Changes session ID field to VARCHAR(64) to add support for SHA-1 hashes.
- */
-function statistics_update_1000() {
- $ret = array();
-
- switch ($GLOBALS['db_type']) {
- case 'mysql':
- case 'mysqli':
- $ret[] = update_sql("ALTER TABLE {accesslog} CHANGE COLUMN sid sid varchar(64) NOT NULL default ''");
- break;
- case 'pgsql':
- db_change_column($ret, 'accesslog', 'sid', 'sid', 'varchar(64)', array('not null' => TRUE, 'default' => "''"));
- break;
- }
-
- return $ret;
-}
-
-/**
* Implementation of hook_uninstall().
*/
function statistics_uninstall() {
@@ -119,6 +100,18 @@ function statistics_schema() {
}
/**
+ * Implementation of hook_update_last_removed().
+ */
+function statistics_update_last_removed() {
+ return 1000;
+}
+
+/**
+ * @defgroup updates-6.x-to-7.x Statistics updates from 6.x to 7.x
+ * @{
+ */
+
+/**
* Allow longer referrers.
*/
function statistics_update_7000() {
@@ -126,3 +119,9 @@ function statistics_update_7000() {
db_change_field($ret, 'accesslog', 'url', 'url', array('type' => 'text', 'not null' => FALSE));
return $ret;
}
+
+/**
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
+ */
+
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.308
diff -u -p -r1.308 system.install
--- modules/system/system.install 18 Feb 2009 15:19:56 -0000 1.308
+++ modules/system/system.install 25 Feb 2009 15:35:58 -0000
@@ -1265,1427 +1265,19 @@ function system_schema() {
return $schema;
}
-// Updates for core.
-
-function system_update_last_removed() {
- return 1021;
-}
-
-/**
- * @defgroup updates-5.x-extra Extra system updates for 5.x
- * @{
- */
-
/**
- * Add index on users created column.
+ * Implementation of hook_update_last_removed().
*/
-function system_update_1022() {
- $ret = array();
- db_add_index($ret, 'users', 'created', array('created'));
- // Also appears as system_update_6004(). Ensure we don't update twice.
- variable_set('system_update_1022', TRUE);
- return $ret;
+function system_update_last_removed() {
+ return 6047;
}
/**
- * @} End of "defgroup updates-5.x-extra"
- */
-
-/**
- * @defgroup updates-5.x-to-6.x System updates from 5.x to 6.x
+ * @defgroup updates-6.x-extra Extra system updates for 6.x
* @{
*/
/**
- * Remove auto_increment from {boxes} to allow adding custom blocks with
- * visibility settings.
- */
-function system_update_6000() {
- $ret = array();
- switch ($GLOBALS['db_type']) {
- case 'mysql':
- case 'mysqli':
- $max = (int)db_result(db_query('SELECT MAX(bid) FROM {boxes}'));
- $ret[] = update_sql('ALTER TABLE {boxes} CHANGE COLUMN bid bid int NOT NULL');
- $ret[] = update_sql("REPLACE INTO {sequences} VALUES ('{boxes}_bid', $max)");
- break;
- }
- return $ret;
-}
-
-/**
- * Add version id column to {term_node} to allow taxonomy module to use revisions.
- */
-function system_update_6001() {
- $ret = array();
-
- // Add vid to term-node relation. The schema says it is unsigned.
- db_add_field($ret, 'term_node', 'vid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
- db_drop_primary_key($ret, 'term_node');
- db_add_primary_key($ret, 'term_node', array('vid', 'tid', 'nid'));
- db_add_index($ret, 'term_node', 'vid', array('vid'));
-
- db_query('UPDATE {term_node} SET vid = (SELECT vid FROM {node} n WHERE {term_node}.nid = n.nid)');
- return $ret;
-}
-
-/**
- * Increase the maximum length of variable names from 48 to 128.
- */
-function system_update_6002() {
- $ret = array();
- db_drop_primary_key($ret, 'variable');
- db_change_field($ret, 'variable', 'name', 'name', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''));
- db_add_primary_key($ret, 'variable', array('name'));
- return $ret;
-}
-
-/**
- * Add index on comments status column.
- */
-function system_update_6003() {
- $ret = array();
- db_add_index($ret, 'comments', 'status', array('status'));
- return $ret;
-}
-
-/**
- * This update used to add an index on users created column (#127941).
- * However, system_update_1022() does the same thing. This update
- * tried to detect if 1022 had already run but failed to do so,
- * resulting in an "index already exists" error.
- *
- * Adding the index here is never necessary. Sites installed before
- * 1022 will run 1022, getting the update. Sites installed on/after 1022
- * got the index when the table was first created. Therefore, this
- * function is now a no-op.
- */
-function system_update_6004() {
- return array();
-}
-
-/**
- * Add language to url_alias table and modify indexes.
- */
-function system_update_6005() {
- $ret = array();
- switch ($GLOBALS['db_type']) {
- case 'pgsql':
- db_add_column($ret, 'url_alias', 'language', 'varchar(12)', array('default' => "''", 'not null' => TRUE));
-
- // As of system.install:1.85 (before the new language
- // subsystem), new installs got a unique key named
- // url_alias_dst_key on url_alias.dst. Unfortunately,
- // system_update_162 created a unique key inconsistently named
- // url_alias_dst_idx on url_alias.dst (keys should have the _key
- // suffix, indexes the _idx suffix). Therefore, sites installed
- // before system_update_162 have a unique key with a different
- // name than sites installed after system_update_162(). Now, we
- // want to drop the unique key on dst which may have either one
- // of two names and create a new unique key on (dst, language).
- // There is no way to know which key name exists so we have to
- // drop both, causing an SQL error. Thus, we just hide the
- // error and only report the update_sql results that work.
- $err = error_reporting(0);
- $ret1 = update_sql('DROP INDEX {url_alias}_dst_idx');
- if ($ret1['success']) {
- $ret[] = $ret1;
- }
- $ret1 = array();
- db_drop_unique_key($ret, 'url_alias', 'dst');
- foreach ($ret1 as $r) {
- if ($r['success']) {
- $ret[] = $r;
- }
- }
- error_reporting($err);
-
- $ret[] = update_sql('CREATE UNIQUE INDEX {url_alias}_dst_language_idx ON {url_alias}(dst, language)');
- break;
- case 'mysql':
- case 'mysqli':
- $ret[] = update_sql("ALTER TABLE {url_alias} ADD language varchar(12) NOT NULL default ''");
- $ret[] = update_sql("ALTER TABLE {url_alias} DROP INDEX dst");
- $ret[] = update_sql("ALTER TABLE {url_alias} ADD UNIQUE dst_language (dst, language)");
- break;
- }
- return $ret;
-}
-
-/**
- * Drop useless indices on node_counter table.
- */
-function system_update_6006() {
- $ret = array();
- switch ($GLOBALS['db_type']) {
- case 'pgsql':
- $ret[] = update_sql('DROP INDEX {node_counter}_daycount_idx');
- $ret[] = update_sql('DROP INDEX {node_counter}_totalcount_idx');
- $ret[] = update_sql('DROP INDEX {node_counter}_timestamp_idx');
- break;
- case 'mysql':
- case 'mysqli':
- $ret[] = update_sql("ALTER TABLE {node_counter} DROP INDEX daycount");
- $ret[] = update_sql("ALTER TABLE {node_counter} DROP INDEX totalcount");
- $ret[] = update_sql("ALTER TABLE {node_counter} DROP INDEX timestamp");
- break;
- }
- return $ret;
-}
-
-/**
- * Change the severity column in the watchdog table to the new values.
- */
-function system_update_6007() {
- $ret = array();
- $ret[] = update_sql("UPDATE {watchdog} SET severity = " . WATCHDOG_NOTICE . " WHERE severity = 0");
- $ret[] = update_sql("UPDATE {watchdog} SET severity = " . WATCHDOG_WARNING . " WHERE severity = 1");
- $ret[] = update_sql("UPDATE {watchdog} SET severity = " . WATCHDOG_ERROR . " WHERE severity = 2");
- return $ret;
-}
-
-/**
- * Add info files to themes. The info and owner columns are added by
- * update_fix_d6_requirements() in update.php to avoid a large number
- * of error messages from update.php. All we need to do here is copy
- * description to owner and then drop description.
- */
-function system_update_6008() {
- $ret = array();
- $ret[] = update_sql('UPDATE {system} SET owner = description');
- db_drop_field($ret, 'system', 'description');
-
- // Rebuild system table contents.
- module_rebuild_cache();
- system_theme_data();
-
- return $ret;
-}
-
-/**
- * The PHP filter is now a separate module.
- */
-function system_update_6009() {
- $ret = array();
-
- // If any text format used the Drupal 5 PHP filter.
- if (db_result(db_query("SELECT COUNT(format) FROM {filters} WHERE module = 'filter' AND delta = 1"))) {
- // Enable the PHP filter module.
- $ret[] = update_sql("UPDATE {system} SET status = 1 WHERE name = 'php' AND type = 'module'");
- // Update the input filters.
- $ret[] = update_sql("UPDATE {filters} SET delta = 0, module = 'php' WHERE module = 'filter' AND delta = 1");
- }
-
- // With the removal of the PHP evaluator filter, the deltas of the line break
- // and URL filter have changed.
- $ret[] = update_sql("UPDATE {filters} SET delta = 1 WHERE module = 'filter' AND delta = 2");
- $ret[] = update_sql("UPDATE {filters} SET delta = 2 WHERE module = 'filter' AND delta = 3");
-
- return $ret;
-}
-
-/**
- * Add variable replacement for watchdog messages.
- *
- * The variables field is NOT NULL and does not have a default value.
- * Existing log messages should not be translated in the new system,
- * so we insert 'N;' (serialize(NULL)) as the temporary default but
- * then remove the default value to match the schema.
- */
-function system_update_6010() {
- $ret = array();
- db_add_field($ret, 'watchdog', 'variables', array('type' => 'text', 'size' => 'big', 'not null' => TRUE, 'initial' => 'N;'));
- return $ret;
-}
-
-/**
- * Add language support to nodes
- */
-function system_update_6011() {
- $ret = array();
- switch ($GLOBALS['db_type']) {
- case 'pgsql':
- db_add_column($ret, 'node', 'language', 'varchar(12)', array('default' => "''", 'not null' => TRUE));
- break;
- case 'mysql':
- case 'mysqli':
- $ret[] = update_sql("ALTER TABLE {node} ADD language varchar(12) NOT NULL default ''");
- break;
- }
- return $ret;
-}
-
-/**
- * Add serialized field to cache tables. This is now handled directly
- * by update.php, so this function is a no-op.
- */
-function system_update_6012() {
- return array();
-}
-
-/**
- * Rebuild cache data for theme system changes
- */
-function system_update_6013() {
- // Rebuild system table contents.
- module_rebuild_cache();
- system_theme_data();
-
- return array(array('success' => TRUE, 'query' => 'Cache rebuilt.'));
-}
-
-/**
- * Record that the installer is done, so it is not
- * possible to run the installer on upgraded sites.
- */
-function system_update_6014() {
- variable_set('install_task', 'done');
-
- return array(array('success' => TRUE, 'query' => "variable_set('install_task')"));
-}
-
-/**
- * Add the form cache table.
- */
-function system_update_6015() {
- $ret = array();
-
- switch ($GLOBALS['db_type']) {
- case 'pgsql':
- $ret[] = update_sql("CREATE TABLE {cache_form} (
- cid varchar(255) NOT NULL default '',
- data bytea,
- expire int NOT NULL default '0',
- created int NOT NULL default '0',
- headers text,
- serialized smallint NOT NULL default '0',
- PRIMARY KEY (cid)
- )");
- $ret[] = update_sql("CREATE INDEX {cache_form}_expire_idx ON {cache_form} (expire)");
- break;
- case 'mysql':
- case 'mysqli':
- $ret[] = update_sql("CREATE TABLE {cache_form} (
- cid varchar(255) NOT NULL default '',
- data longblob,
- expire int NOT NULL default '0',
- created int NOT NULL default '0',
- headers text,
- serialized int(1) NOT NULL default '0',
- PRIMARY KEY (cid),
- INDEX expire (expire)
- ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
- break;
- }
-
- return $ret;
-}
-
-/**
- * Make {node}'s primary key be nid, change nid,vid to a unique key.
- * Add primary keys to block, filters, flood, permission, and term_relation.
- */
-function system_update_6016() {
- $ret = array();
-
- switch ($GLOBALS['db_type']) {
- case 'pgsql':
- $ret[] = update_sql("ALTER TABLE {node} ADD CONSTRAINT {node}_nid_vid_key UNIQUE (nid, vid)");
- db_add_column($ret, 'blocks', 'bid', 'serial');
- $ret[] = update_sql("ALTER TABLE {blocks} ADD PRIMARY KEY (bid)");
- db_add_column($ret, 'filters', 'fid', 'serial');
- $ret[] = update_sql("ALTER TABLE {filters} ADD PRIMARY KEY (fid)");
- db_add_column($ret, 'flood', 'fid', 'serial');
- $ret[] = update_sql("ALTER TABLE {flood} ADD PRIMARY KEY (fid)");
- db_add_column($ret, 'permission', 'pid', 'serial');
- $ret[] = update_sql("ALTER TABLE {permission} ADD PRIMARY KEY (pid)");
- db_add_column($ret, 'term_relation', 'trid', 'serial');
- $ret[] = update_sql("ALTER TABLE {term_relation} ADD PRIMARY KEY (trid)");
- db_add_column($ret, 'term_synonym', 'tsid', 'serial');
- $ret[] = update_sql("ALTER TABLE {term_synonym} ADD PRIMARY KEY (tsid)");
- break;
- case 'mysql':
- case 'mysqli':
- $ret[] = update_sql('ALTER TABLE {node} ADD UNIQUE KEY nid_vid (nid, vid)');
- $ret[] = update_sql("ALTER TABLE {blocks} ADD bid int NOT NULL AUTO_INCREMENT PRIMARY KEY");
- $ret[] = update_sql("ALTER TABLE {filters} ADD fid int NOT NULL AUTO_INCREMENT PRIMARY KEY");
- $ret[] = update_sql("ALTER TABLE {flood} ADD fid int NOT NULL AUTO_INCREMENT PRIMARY KEY");
- $ret[] = update_sql("ALTER TABLE {permission} ADD pid int NOT NULL AUTO_INCREMENT PRIMARY KEY");
- $ret[] = update_sql("ALTER TABLE {term_relation} ADD trid int NOT NULL AUTO_INCREMENT PRIMARY KEY");
- $ret[] = update_sql("ALTER TABLE {term_synonym} ADD tsid int NOT NULL AUTO_INCREMENT PRIMARY KEY");
- break;
- }
-
- return $ret;
-}
-
-/**
- * Rename settings related to user.module email notifications.
- */
-function system_update_6017() {
- $ret = array();
- // Maps old names to new ones.
- $var_names = array(
- 'admin' => 'register_admin_created',
- 'approval' => 'register_pending_approval',
- 'welcome' => 'register_no_approval_required',
- 'pass' => 'password_reset',
- );
- foreach ($var_names as $old => $new) {
- foreach (array('_subject', '_body') as $suffix) {
- $old_name = 'user_mail_' . $old . $suffix;
- $new_name = 'user_mail_' . $new . $suffix;
- if ($old_val = variable_get($old_name, FALSE)) {
- variable_set($new_name, $old_val);
- variable_del($old_name);
- $ret[] = array('success' => TRUE, 'query' => "variable_set($new_name)");
- $ret[] = array('success' => TRUE, 'query' => "variable_del($old_name)");
- if ($old_name == 'user_mail_approval_body') {
- drupal_set_message('Saving an old value of the welcome message body for users that are pending administrator approval. However, you should consider modifying this text, since Drupal can now be configured to automatically notify users and send them their login information when their accounts are approved. See the User settings page for details.');
- }
- }
- }
- }
- return $ret;
-}
-
-/**
- * Add HTML corrector to HTML formats or replace the old module if it was in use.
- */
-function system_update_6018() {
- $ret = array();
-
- // Disable htmlcorrector.module, if it exists and replace its filter.
- if (module_exists('htmlcorrector')) {
- module_disable(array('htmlcorrector'));
- $ret[] = update_sql("UPDATE {filter_formats} SET module = 'filter', delta = 3 WHERE module = 'htmlcorrector'");
- $ret[] = array('success' => TRUE, 'query' => 'HTML Corrector module was disabled; this functionality has now been added to core.');
- return $ret;
- }
-
- // Otherwise, find any format with 'HTML' in its name and add the filter at the end.
- $result = db_query("SELECT format, name FROM {filter_formats} WHERE name LIKE '%HTML%'");
- while ($format = db_fetch_object($result)) {
- $weight = db_result(db_query("SELECT MAX(weight) FROM {filters} WHERE format = %d", $format->format));
- db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", $format->format, 'filter', 3, max(10, $weight + 1));
- $ret[] = array('success' => TRUE, 'query' => "HTML corrector filter added to the '" . $format->name . "' text format.");
- }
-
- return $ret;
-}
-
-/**
- * Reconcile small differences in the previous, manually created mysql
- * and pgsql schemas so they are the same and can be represented by a
- * single schema structure.
- *
- * Note that the mysql and pgsql cases make different changes. This
- * is because each schema needs to be tweaked in different ways to
- * conform to the new schema structure. Also, since they operate on
- * tables defined by many optional core modules which may not ever
- * have been installed, they must test each table for existence. If
- * the modules are first installed after this update exists the tables
- * will be created from the schema structure and will start out
- * correct.
- */
-function system_update_6019() {
- $ret = array();
-
- switch ($GLOBALS['db_type']) {
- case 'pgsql':
- // Remove default ''.
- if (db_table_exists('aggregator_feed')) {
- db_field_set_no_default($ret, 'aggregator_feed', 'description');
- db_field_set_no_default($ret, 'aggregator_feed', 'image');
- }
- db_field_set_no_default($ret, 'blocks', 'pages');
- if (db_table_exists('contact')) {
- db_field_set_no_default($ret, 'contact', 'recipients');
- db_field_set_no_default($ret, 'contact', 'reply');
- }
- db_field_set_no_default($ret, 'watchdog', 'location');
- db_field_set_no_default($ret, 'node_revisions', 'body');
- db_field_set_no_default($ret, 'node_revisions', 'teaser');
- db_field_set_no_default($ret, 'node_revisions', 'log');
-
- // Update from pgsql 'float' (which means 'double precision') to
- // schema 'float' (which in pgsql means 'real').
- if (db_table_exists('search_index')) {
- db_change_field($ret, 'search_index', 'score', 'score', array('type' => 'float'));
- }
- if (db_table_exists('search_total')) {
- db_change_field($ret, 'search_total', 'count', 'count', array('type' => 'float'));
- }
-
- // Replace unique index dst_language with a unique constraint. The
- // result is the same but the unique key fits our current schema
- // structure. Also, the PostgreSQL documentation implies that
- // unique constraints are preferable to unique indexes. See
- // http://www.postgresql.org/docs/8.2/interactive/indexes-unique.html.
- if (db_table_exists('url_alias')) {
- db_drop_index($ret, 'url_alias', 'dst_language');
- db_add_unique_key($ret, 'url_alias', 'dst_language',
- array('dst', 'language'));
- }
-
- // Fix term_node pkey: mysql and pgsql code had different orders.
- if (db_table_exists('term_node')) {
- db_drop_primary_key($ret, 'term_node');
- db_add_primary_key($ret, 'term_node', array('vid', 'tid', 'nid'));
- }
-
- // Make boxes.bid unsigned.
- db_drop_primary_key($ret, 'boxes');
- db_change_field($ret, 'boxes', 'bid', 'bid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('bid')));
-
- // Fix primary key
- db_drop_primary_key($ret, 'node');
- db_add_primary_key($ret, 'node', array('nid'));
-
- break;
-
- case 'mysql':
- case 'mysqli':
- // Rename key 'link' to 'url'.
- if (db_table_exists('aggregator_feed')) {
- db_drop_unique_key($ret, 'aggregator_feed', 'link');
- db_add_unique_key($ret, 'aggregator_feed', 'url', array('url'));
- }
-
- // Change to size => small.
- if (db_table_exists('boxes')) {
- db_change_field($ret, 'boxes', 'format', 'format', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0));
- }
-
- // Change to size => small.
- // Rename index 'lid' to 'nid'.
- if (db_table_exists('comments')) {
- db_change_field($ret, 'comments', 'format', 'format', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0));
- db_drop_index($ret, 'comments', 'lid');
- db_add_index($ret, 'comments', 'nid', array('nid'));
- }
-
- // Change to size => small.
- db_change_field($ret, 'cache', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0));
- db_change_field($ret, 'cache_filter', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0));
- db_change_field($ret, 'cache_page', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0));
- db_change_field($ret, 'cache_form', 'serialized', 'serialized', array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0));
-
- // Remove default => 0, set auto increment.
- $new_uid = 1 + db_result(db_query('SELECT MAX(uid) FROM {user}'));
- $ret[] = update_sql('UPDATE {user} SET uid = ' . $new_uid . ' WHERE uid = 0');
- db_drop_primary_key($ret, 'user');
- db_change_field($ret, 'user', 'uid', 'uid', array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array('uid')));
- $ret[] = update_sql('UPDATE {user} SET uid = 0 WHERE uid = ' . $new_uid);
-
- // Special field names.
- $map = array('node_revisions' => 'vid');
- // Make sure these tables have proper auto_increment fields.
- foreach (array('boxes', 'files', 'node', 'node_revisions') as $table) {
- $field = isset($map[$table]) ? $map[$table] : $table[0] . 'id';
- db_drop_primary_key($ret, $table);
- db_change_field($ret, $table, $field, $field, array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), array('primary key' => array($field)));
- }
-
- break;
- }
-
- return $ret;
-}
-
-/**
- * Create the tables for the new menu system.
- */
-function system_update_6020() {
- $ret = array();
-
- $schema['menu_router'] = array(
- 'fields' => array(
- 'path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'load_functions' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'to_arg_functions' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'access_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'access_arguments' => array('type' => 'text', 'not null' => FALSE),
- 'page_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'page_arguments' => array('type' => 'text', 'not null' => FALSE),
- 'fit' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
- 'number_parts' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'),
- 'tab_parent' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'tab_root' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'title_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'title_arguments' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'type' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
- 'block_callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'description' => array('type' => 'text', 'not null' => TRUE),
- 'position' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
- 'file' => array('type' => 'text', 'size' => 'medium')
- ),
- 'indexes' => array(
- 'fit' => array('fit'),
- 'tab_parent' => array('tab_parent')
- ),
- 'primary key' => array('path'),
- );
-
- $schema['menu_links'] = array(
- 'fields' => array(
- 'menu_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
- 'mlid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
- 'plid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'link_path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'router_path' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'link_title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'options' => array('type' => 'text', 'not null' => FALSE),
- 'module' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'system'),
- 'hidden' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'),
- 'external' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'),
- 'has_children' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'),
- 'expanded' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'),
- 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
- 'depth' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'),
- 'customized' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'),
- 'p1' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'p2' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'p3' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'p4' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'p5' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'p6' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'p7' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'p8' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'p9' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'updated' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'small'),
- ),
- 'indexes' => array(
- 'path_menu' => array(array('link_path', 128), 'menu_name'),
- 'menu_plid_expand_child' => array('menu_name', 'plid', 'expanded', 'has_children'),
- 'menu_parents' => array('menu_name', 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9'),
- 'router_path' => array(array('router_path', 128)),
- ),
- 'primary key' => array('mlid'),
- );
-
- foreach ($schema as $name => $table) {
- db_create_table($ret, $name, $table);
- }
- return $ret;
-}
-
-/**
- * Migrate the menu items from the old menu system to the new menu_links table.
- */
-function system_update_6021() {
- $ret = array('#finished' => 0);
- $menus = array(
- 'navigation' => array(
- 'menu_name' => 'navigation',
- 'title' => 'Navigation',
- 'description' => 'The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.',
- ),
- 'primary-links' => array(
- 'menu_name' => 'primary-links',
- 'title' => 'Primary links',
- 'description' => 'Primary links are often used at the theme layer to show the major sections of a site. A typical representation for primary links would be tabs along the top.',
- ),
- 'secondary-links' => array(
- 'menu_name' => 'secondary-links',
- 'title' => 'Secondary links',
- 'description' => 'Secondary links are often used for pages like legal notices, contact details, and other secondary navigation items that play a lesser role than primary links.',
- ),
- );
- // Multi-part update
- if (!isset($_SESSION['system_update_6021'])) {
- db_add_field($ret, 'menu', 'converted', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'));
- drupal_set_session('system_update_6021_max', db_result(db_query('SELECT COUNT(*) FROM {menu}')));
- drupal_set_session('menu_menu_map', array(1 => 'navigation'));
- // 0 => FALSE is for new menus, 1 => FALSE is for the navigation.
- drupal_set_session('menu_item_map', array(0 => FALSE, 1 => FALSE));
- $table = array(
- 'fields' => array(
- 'menu_name' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
- 'title' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'description' => array('type' => 'text', 'not null' => FALSE),
- ),
- 'primary key' => array('menu_name'),
- );
- db_create_table($ret, 'menu_custom', $table);
- db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", $menus['navigation']);
- drupal_set_session('system_update_6021', 0);
- }
-
- $limit = 50;
- while ($limit-- && ($item = db_fetch_array(db_query_range('SELECT * FROM {menu} WHERE converted = 0', 0, 1)))) {
- // If it's not a menu...
- if ($item['pid']) {
- // Let's climb up until we find an item with a converted parent.
- $item_original = $item;
- while ($item && !isset($_SESSION['menu_item_map'][$item['pid']])) {
- $item = db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d', $item['pid']));
- }
- // This can only occur if the menu entry is a leftover in the menu table.
- // These do not appear in Drupal 5 anyways, so we skip them.
- if (!$item) {
- db_query('UPDATE {menu} SET converted = %d WHERE mid = %d', 1, $item_original['mid']);
- $_SESSION['system_update_6021']++;
- continue;
- }
- }
- // We need to recheck because item might have changed.
- if ($item['pid']) {
- // Fill the new fields.
- $item['link_title'] = $item['title'];
- $item['link_path'] = drupal_get_normal_path($item['path']);
- // We know the parent is already set. If it's not FALSE then it's an item.
- if ($_SESSION['menu_item_map'][$item['pid']]) {
- // The new menu system parent link id.
- $item['plid'] = $_SESSION['menu_item_map'][$item['pid']]['mlid'];
- // The new menu system menu name.
- $item['menu_name'] = $_SESSION['menu_item_map'][$item['pid']]['menu_name'];
- }
- else {
- // This a top level element.
- $item['plid'] = 0;
- // The menu name is stored among the menus.
- $item['menu_name'] = $_SESSION['menu_menu_map'][$item['pid']];
- }
- // Is the element visible in the menu block?
- $item['hidden'] = !($item['type'] & MENU_VISIBLE_IN_TREE);
- // Is it a custom(ized) element?
- if ($item['type'] & (MENU_CREATED_BY_ADMIN | MENU_MODIFIED_BY_ADMIN)) {
- $item['customized'] = TRUE;
- }
- // Items created via the menu module need to be assigned to it.
- if ($item['type'] & MENU_CREATED_BY_ADMIN) {
- $item['module'] = 'menu';
- $item['router_path'] = '';
- $item['updated'] = TRUE;
- }
- else {
- $item['module'] = 'system';
- $item['router_path'] = $item['path'];
- $item['updated'] = FALSE;
- }
- // Save the link.
- menu_link_save($item);
- $_SESSION['menu_item_map'][$item['mid']] = array('mlid' => $item['mlid'], 'menu_name' => $item['menu_name']);
- }
- elseif (!isset($_SESSION['menu_menu_map'][$item['mid']])) {
- $item['menu_name'] = 'menu-' . preg_replace('/[^a-zA-Z0-9]/', '-', strtolower($item['title']));
- $item['menu_name'] = substr($item['menu_name'], 0, 20);
- $original_menu_name = $item['menu_name'];
- $i = 0;
- while (db_result(db_query("SELECT menu_name FROM {menu_custom} WHERE menu_name = '%s'", $item['menu_name']))) {
- $item['menu_name'] = $original_menu_name . ($i++);
- }
- if ($item['path']) {
- // Another bunch of bogus entries. Apparently, these are leftovers
- // from Drupal 4.7 .
- $_SESSION['menu_bogus_menus'][] = $item['menu_name'];
- }
- else {
- // Add this menu to the list of custom menus.
- db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '')", $item['menu_name'], $item['title']);
- }
- $_SESSION['menu_menu_map'][$item['mid']] = $item['menu_name'];
- $_SESSION['menu_item_map'][$item['mid']] = FALSE;
- }
- db_query('UPDATE {menu} SET converted = %d WHERE mid = %d', 1, $item['mid']);
- $_SESSION['system_update_6021']++;
- }
-
- if ($_SESSION['system_update_6021'] >= $_SESSION['system_update_6021_max']) {
- if (!empty($_SESSION['menu_bogus_menus'])) {
- // Remove entries in bogus menus. This is secure because we deleted
- // every non-alphanumeric character from the menu name.
- $ret[] = update_sql("DELETE FROM {menu_links} WHERE menu_name IN ('" . implode("', '", $_SESSION['menu_bogus_menus']) . "')");
- }
-
- $menu_primary_menu = variable_get('menu_primary_menu', 0);
- // Ensure that we wind up with a system menu named 'primary-links'.
- if (isset($_SESSION['menu_menu_map'][2])) {
- // The primary links menu that ships with Drupal 5 has mid = 2. If this
- // menu hasn't been deleted by the site admin, we use that.
- $updated_primary_links_menu = 2;
- }
- elseif (isset($_SESSION['menu_menu_map'][$menu_primary_menu]) && $menu_primary_menu > 1) {
- // Otherwise, we use the menu that is currently assigned to the primary
- // links region of the theme, as long as it exists and isn't the
- // Navigation menu.
- $updated_primary_links_menu = $menu_primary_menu;
- }
- else {
- // As a last resort, create 'primary-links' as a new menu.
- $updated_primary_links_menu = 0;
- db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", $menus['primary-links']);
- }
-
- if ($updated_primary_links_menu) {
- // Change the existing menu name to 'primary-links'.
- $replace = array('%new_name' => 'primary-links', '%desc' => $menus['primary-links']['description'], '%old_name' => $_SESSION['menu_menu_map'][$updated_primary_links_menu]);
- $ret[] = update_sql(strtr("UPDATE {menu_custom} SET menu_name = '%new_name', description = '%desc' WHERE menu_name = '%old_name'", $replace));
- $ret[] = update_sql("UPDATE {menu_links} SET menu_name = 'primary-links' WHERE menu_name = '" . $_SESSION['menu_menu_map'][$updated_primary_links_menu] . "'");
- $_SESSION['menu_menu_map'][$updated_primary_links_menu] = 'primary-links';
- }
-
- $menu_secondary_menu = variable_get('menu_secondary_menu', 0);
- // Ensure that we wind up with a system menu named 'secondary-links'.
- if (isset($_SESSION['menu_menu_map'][$menu_secondary_menu]) && $menu_secondary_menu > 1 && $menu_secondary_menu != $updated_primary_links_menu) {
- // We use the menu that is currently assigned to the secondary links
- // region of the theme, as long as (a) it exists, (b) it isn't the
- // Navigation menu, (c) it isn't the same menu we assigned as the
- // system 'primary-links' menu above, and (d) it isn't the same menu
- // assigned to the primary links region of the theme.
- $updated_secondary_links_menu = $menu_secondary_menu;
- }
- else {
- // Otherwise, create 'secondary-links' as a new menu.
- $updated_secondary_links_menu = 0;
- db_query("INSERT INTO {menu_custom} (menu_name, title, description) VALUES ('%s', '%s', '%s')", $menus['secondary-links']);
- }
-
- if ($updated_secondary_links_menu) {
- // Change the existing menu name to 'secondary-links'.
- $replace = array('%new_name' => 'secondary-links', '%desc' => $menus['secondary-links']['description'], '%old_name' => $_SESSION['menu_menu_map'][$updated_secondary_links_menu]);
- $ret[] = update_sql(strtr("UPDATE {menu_custom} SET menu_name = '%new_name', description = '%desc' WHERE menu_name = '%old_name'", $replace));
- $ret[] = update_sql("UPDATE {menu_links} SET menu_name = 'secondary-links' WHERE menu_name = '" . $_SESSION['menu_menu_map'][$updated_secondary_links_menu] . "'");
- $_SESSION['menu_menu_map'][$updated_secondary_links_menu] = 'secondary-links';
- }
-
- // Update menu OTF preferences.
- $mid = variable_get('menu_parent_items', 0);
- $menu_name = ($mid && isset($_SESSION['menu_menu_map'][$mid])) ? $_SESSION['menu_menu_map'][$mid] : 'navigation';
- variable_set('menu_default_node_menu', $menu_name);
- variable_del('menu_parent_items');
-
- // Update the source of the primary and secondary links.
- $menu_name = ($menu_primary_menu && isset($_SESSION['menu_menu_map'][$menu_primary_menu])) ? $_SESSION['menu_menu_map'][$menu_primary_menu] : '';
- variable_set('menu_primary_links_source', $menu_name);
- variable_del('menu_primary_menu');
-
- $menu_name = ($menu_secondary_menu && isset($_SESSION['menu_menu_map'][$menu_secondary_menu])) ? $_SESSION['menu_menu_map'][$menu_secondary_menu] : '';
- variable_set('menu_secondary_links_source', $menu_name);
- variable_del('menu_secondary_menu');
-
- // Skip the navigation menu - it is handled by the user module.
- unset($_SESSION['menu_menu_map'][1]);
- // Update the deltas for all menu module blocks.
- foreach ($_SESSION['menu_menu_map'] as $mid => $menu_name) {
- // This is again secure because we deleted every non-alphanumeric
- // character from the menu name.
- $ret[] = update_sql("UPDATE {blocks} SET delta = '" . $menu_name . "' WHERE module = 'menu' AND delta = '" . $mid . "'");
- $ret[] = update_sql("UPDATE {blocks_roles} SET delta = '" . $menu_name . "' WHERE module = 'menu' AND delta = '" . $mid . "'");
- }
- $ret[] = array('success' => TRUE, 'query' => 'Relocated ' . $_SESSION['system_update_6021'] . ' existing items to the new menu system.');
- $ret[] = update_sql("DROP TABLE {menu}");
- unset($_SESSION['system_update_6021'], $_SESSION['system_update_6021_max'], $_SESSION['menu_menu_map'], $_SESSION['menu_item_map'], $_SESSION['menu_bogus_menus']);
- // Create the menu overview links - also calls menu_rebuild(). If menu is
- // disabled, then just call menu_rebuild.
- if (function_exists('menu_enable')) {
- menu_enable();
- }
- else {
- menu_rebuild();
- }
- $ret['#finished'] = 1;
- }
- else {
- $ret['#finished'] = $_SESSION['system_update_6021'] / $_SESSION['system_update_6021_max'];
- }
- return $ret;
-}
-
-/**
- * Update files tables to associate files to a uid by default instead of a nid.
- * Rename file_revisions to upload since it should only be used by the upload
- * module used by upload to link files to nodes.
- */
-function system_update_6022() {
- $ret = array();
-
- // Rename the nid field to vid, add status and timestamp fields, and indexes.
- db_drop_index($ret, 'files', 'nid');
- db_change_field($ret, 'files', 'nid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
- db_add_field($ret, 'files', 'status', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
- db_add_field($ret, 'files', 'timestamp', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
- db_add_index($ret, 'files', 'uid', array('uid'));
- db_add_index($ret, 'files', 'status', array('status'));
- db_add_index($ret, 'files', 'timestamp', array('timestamp'));
-
- // Rename the file_revisions table to upload then add nid column. Since we're
- // changing the table name we need to drop and re-add the indexes and
- // the primary key so both mysql and pgsql end up with the correct index
- // names.
- db_drop_primary_key($ret, 'file_revisions');
- db_drop_index($ret, 'file_revisions', 'vid');
- db_rename_table($ret, 'file_revisions', 'upload');
- db_add_field($ret, 'upload', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
- db_add_index($ret, 'upload', 'nid', array('nid'));
- db_add_primary_key($ret, 'upload', array('vid', 'fid'));
- db_add_index($ret, 'upload', 'fid', array('fid'));
-
- // The nid column was renamed to uid. Use the old nid to find the node's uid.
- update_sql('UPDATE {files} SET uid = (SELECT n.uid FROM {node} n WHERE {files}.uid = n.nid)');
- update_sql('UPDATE {upload} SET nid = (SELECT r.nid FROM {node_revision} r WHERE {upload}.vid = r.vid)');
-
- // Mark all existing files as FILE_STATUS_PERMANENT.
- $ret[] = update_sql('UPDATE {files} SET status = 1');
-
- return $ret;
-}
-
-function system_update_6023() {
- $ret = array();
-
- // nid is DEFAULT 0
- db_drop_index($ret, 'node_revisions', 'nid');
- db_change_field($ret, 'node_revisions', 'nid', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
- db_add_index($ret, 'node_revisions', 'nid', array('nid'));
- return $ret;
-}
-
-/**
- * Add translation fields to nodes used by translation module.
- */
-function system_update_6024() {
- $ret = array();
- db_add_field($ret, 'node', 'tnid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
- db_add_field($ret, 'node', 'translate', array('type' => 'int', 'not null' => TRUE, 'default' => 0));
- db_add_index($ret, 'node', 'tnid', array('tnid'));
- db_add_index($ret, 'node', 'translate', array('translate'));
- return $ret;
-}
-
-/**
- * Increase the maximum length of node titles from 128 to 255.
- */
-function system_update_6025() {
- $ret = array();
- db_drop_index($ret, 'node', 'node_title_type');
- db_change_field($ret, 'node', 'title', 'title', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
- db_add_index($ret, 'node', 'node_title_type', array('title', array('type', 4)));
- db_change_field($ret, 'node_revisions', 'title', 'title', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''));
- return $ret;
-}
-
-/**
- * Display warning about new Update status module.
- */
-function system_update_6026() {
- $ret = array();
-
- // Notify user that new update module exists.
- drupal_set_message('Drupal can check periodically for important bug fixes and security releases using the new update status module. This module can be turned on from the modules administration page. For more information please read the Update status handbook page.');
-
- return $ret;
-}
-
-/**
- * Add block cache.
- */
-function system_update_6027() {
- $ret = array();
-
- // Create the blocks.cache column.
- db_add_field($ret, 'blocks', 'cache', array('type' => 'int', 'not null' => TRUE, 'default' => 1, 'size' => 'tiny'));
-
- // The cache_block table is created in update_fix_d6_requirements() since
- // calls to cache_clear_all() would otherwise cause warnings.
-
- // Fill in the values for the new 'cache' column in the {blocks} table.
- foreach (module_list() as $module) {
- if ($module_blocks = module_invoke($module, 'block', 'list')) {
- foreach ($module_blocks as $delta => $block) {
- if (isset($block['cache'])) {
- db_query("UPDATE {blocks} SET cache = %d WHERE module = '%s' AND delta = %d", $block['cache'], $module, $delta);
- }
- }
- }
- }
-
- return $ret;
-}
-
-/**
- * Add the node load cache table.
- */
-function system_update_6028() {
- // Removed node_load cache to discuss it more for Drupal 7.
- return array();
-}
-
-/**
- * Enable the dblog module on sites that upgrade, since otherwise
- * watchdog logging will stop unexpectedly.
- */
-function system_update_6029() {
- // The watchdog table is now owned by dblog, which is not yet
- // "installed" according to the system table, but the table already
- // exists. We set the module as "installed" here to avoid an error
- // later.
- //
- // Although not the case for the initial D6 release, it is likely
- // that dblog.install will have its own update functions eventually.
- // However, dblog did not exist in D5 and this update is part of the
- // initial D6 release, so we know that dblog is not installed yet.
- // It is therefore correct to install it as version 0. If
- // dblog updates exist, the next run of update.php will get them.
- drupal_set_installed_schema_version('dblog', 0);
- module_enable(array('dblog'));
- menu_rebuild();
- return array(array('success' => TRUE, 'query' => "'dblog' module enabled."));
-}
-
-/**
- * Add the tables required by actions.inc.
- */
-function system_update_6030() {
- $ret = array();
-
- // Rename the old contrib actions table if it exists so the contrib version
- // of the module can do something with the old data.
- if (db_table_exists('actions')) {
- db_rename_table($ret, 'actions', 'actions_old_contrib');
- }
-
- $schema['actions'] = array(
- 'fields' => array(
- 'aid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'),
- 'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
- 'callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
- 'parameters' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
- 'description' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'),
- ),
- 'primary key' => array('aid'),
- );
-
- $schema['actions_aid'] = array(
- 'fields' => array(
- 'aid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE),
- ),
- 'primary key' => array('aid'),
- );
-
- db_create_table($ret, 'actions', $schema['actions']);
- db_create_table($ret, 'actions_aid', $schema['actions_aid']);
-
- return $ret;
-}
-
-/**
- * Ensure that installer cannot be run again after updating from Drupal 5.x to 6.x
- * Actually, this is already done by system_update_6014(), so this is now a no-op.
- */
-function system_update_6031() {
- return array();
-}
-
-/**
- * profile_fields.name used to be nullable but is part of a unique key
- * and so shouldn't be.
- */
-function system_update_6032() {
- $ret = array();
- if (db_table_exists('profile_fields')) {
- db_drop_unique_key($ret, 'profile_fields', 'name');
- db_change_field($ret, 'profile_fields', 'name', 'name', array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''));
- db_add_unique_key($ret, 'profile_fields', 'name', array('name'));
- }
- return $ret;
-}
-
-/**
- * Change node_comment_statistics to be not autoincrement.
- */
-function system_update_6033() {
- $ret = array();
- if (db_table_exists('node_comment_statistics')) {
- // On pgsql but not mysql, db_change_field() drops all keys
- // involving the changed field, which in this case is the primary
- // key. The normal approach is explicitly drop the pkey, change the
- // field, and re-create the pkey.
- //
- // Unfortunately, in this case that won't work on mysql; we CANNOT
- // drop the pkey because on mysql auto-increment fields must be
- // included in at least one key or index.
- //
- // Since we cannot drop the pkey before db_change_field(), after
- // db_change_field() we may or may not still have a pkey. The
- // simple way out is to re-create the pkey only when using pgsql.
- // Realistic requirements trump idealistic purity.
- db_change_field($ret, 'node_comment_statistics', 'nid', 'nid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
- if ($GLOBALS['db_type'] == 'pgsql') {
- db_add_primary_key($ret, 'node_comment_statistics', array('nid'));
- }
- }
- return $ret;
-}
-
-/**
- * Rename permission "administer access control" to "administer permissions".
- */
-function system_update_6034() {
- $ret = array();
- $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
- while ($role = db_fetch_object($result)) {
- $renamed_permission = preg_replace('/administer access control/', 'administer permissions', $role->perm);
- if ($renamed_permission != $role->perm) {
- $ret[] = update_sql("UPDATE {permission} SET perm = '$renamed_permission' WHERE rid = $role->rid");
- }
- }
- return $ret;
-}
-
-/**
- * Change index on system table for better performance.
- */
-function system_update_6035() {
- $ret = array();
- db_drop_index($ret, 'system', 'weight');
- db_add_index($ret, 'system', 'modules', array(array('type', 12), 'status', 'weight', 'filename'));
- db_add_index($ret, 'system', 'bootstrap', array(array('type', 12), 'status', 'bootstrap', 'weight', 'filename'));
- return $ret;
-}
-
-/**
- * Change the search schema and indexing.
- *
- * The table data is preserved where possible in MYSQL and MYSQLi using
- * ALTER IGNORE. Other databases don't support that, so for them the
- * tables are dropped and re-created, and will need to be re-indexed
- * from scratch.
- */
-function system_update_6036() {
- $ret = array();
- if (db_table_exists('search_index')) {
- // Create the search_dataset.reindex column.
- db_add_field($ret, 'search_dataset', 'reindex', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0));
-
- // Drop the search_index.from fields which are no longer used.
- db_drop_index($ret, 'search_index', 'from_sid_type');
- db_drop_field($ret, 'search_index', 'fromsid');
- db_drop_field($ret, 'search_index', 'fromtype');
-
- // Drop the search_dataset.sid_type index, so that it can be made unique.
- db_drop_index($ret, 'search_dataset', 'sid_type');
-
- // Create the search_node_links Table.
- $search_node_links_schema = array(
- 'fields' => array(
- 'sid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'type' => array('type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => ''),
- 'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
- 'caption' => array('type' => 'text', 'size' => 'big', 'not null' => FALSE),
- ),
- 'primary key' => array('sid', 'type', 'nid'),
- 'indexes' => array('nid' => array('nid')),
- );
- db_create_table($ret, 'search_node_links', $search_node_links_schema);
-
- // with the change to search_dataset.reindex, the search queue is handled differently,
- // and this is no longer needed
- variable_del('node_cron_last');
-
- // Add a unique index for the search_index.
- if ($GLOBALS['db_type'] == 'mysql' || $GLOBALS['db_type'] == 'mysqli') {
- // Since it's possible that some existing sites have duplicates,
- // create the index using the IGNORE keyword, which ignores duplicate errors.
- // However, pgsql doesn't support it
- $ret[] = update_sql("ALTER IGNORE TABLE {search_index} ADD UNIQUE KEY word_sid_type (word, sid, type)");
- $ret[] = update_sql("ALTER IGNORE TABLE {search_dataset} ADD UNIQUE KEY sid_type (sid, type)");
-
- // Everything needs to be reindexed.
- $ret[] = update_sql("UPDATE {search_dataset} SET reindex = 1");
- }
- else {
- // Delete the existing tables if there are duplicate values
- if (db_result(db_query("SELECT sid FROM {search_dataset} GROUP BY sid, type HAVING COUNT(*) > 1")) || db_result(db_query("SELECT sid FROM {search_index} GROUP BY word, sid, type HAVING COUNT(*) > 1"))) {
- $ret[] = update_sql('DELETE FROM {search_dataset}');
- $ret[] = update_sql('DELETE FROM {search_index}');
- $ret[] = update_sql('DELETE FROM {search_total}');
- }
- else {
- // Everything needs to be reindexed.
- $ret[] = update_sql("UPDATE {search_dataset} SET reindex = 1");
- }
-
- // create the new indexes
- db_add_unique_key($ret, 'search_index', 'word_sid_type', array('word', 'sid', 'type'));
- db_add_unique_key($ret, 'search_dataset', 'sid_type', array('sid', 'type'));
- }
- }
- return $ret;
-}
-
-/**
- * Create consistent empty region for disabled blocks.
- */
-function system_update_6037() {
- $ret = array();
- db_change_field($ret, 'blocks', 'region', 'region', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''));
- $ret[] = update_sql("UPDATE {blocks} SET region = '' WHERE status = 0");
- return $ret;
-}
-
-/**
- * Ensure that "Account" is not used as a Profile category.
- */
-function system_update_6038() {
- $ret = array();
- if (db_table_exists('profile_fields')) {
- $ret[] = update_sql("UPDATE {profile_fields} SET category = 'Account settings' WHERE LOWER(category) = 'account'");
- if ($affectedrows = db_affected_rows()) {
- drupal_set_message('There were ' . $affectedrows . ' profile fields that used a reserved category name. They have been assigned to the category "Account settings".');
- }
- }
- return $ret;
-}
-
-/**
- * Rename permissions "edit foo content" to "edit any foo content".
- * Also update poll module permission "create polls" to "create
- * poll content".
- */
-function system_update_6039() {
- $ret = array();
- $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
- while ($role = db_fetch_object($result)) {
- $renamed_permission = preg_replace('/(?<=^|,\ )edit\ ([a-zA-Z0-9_\-]+)\ content(?=,|$)/', 'edit any $1 content', $role->perm);
- $renamed_permission = preg_replace('/(?<=^|,\ )create\ polls(?=,|$)/', 'create poll content', $renamed_permission);
- if ($renamed_permission != $role->perm) {
- $ret[] = update_sql("UPDATE {permission} SET perm = '$renamed_permission' WHERE rid = $role->rid");
- }
- }
- return $ret;
-}
-
-/**
- * Add a weight column to the upload table.
- */
-function system_update_6040() {
- $ret = array();
- if (db_table_exists('upload')) {
- db_add_field($ret, 'upload', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'size' => 'tiny'));
- }
- return $ret;
-}
-
-/**
- * Change forum vocabulary not to be required by default and set the weight of the forum.module 1 higher than the taxonomy.module.
- */
-function system_update_6041() {
- $weight = intval((db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"))) + 1);
- $ret = array();
- $vid = intval(variable_get('forum_nav_vocabulary', ''));
- if (db_table_exists('vocabulary') && $vid) {
- $ret[] = update_sql("UPDATE {vocabulary} SET required = 0 WHERE vid = " . $vid);
- $ret[] = update_sql("UPDATE {system} SET weight = " . $weight . " WHERE name = 'forum'");
- }
- return $ret;
-}
-
-/**
- * Upgrade recolored theme stylesheets to new array structure.
- */
-function system_update_6042() {
- foreach (list_themes() as $theme) {
- $stylesheet = variable_get('color_' . $theme->name . '_stylesheet');
- if (!empty($stylesheet)) {
- variable_set('color_' . $theme->name . '_stylesheets', array($stylesheet));
- variable_del('color_' . $theme->name . '_stylesheet');
- }
- }
- return array();
-}
-
-/**
- * Update table indices to make them more rational and useful.
- */
-function system_update_6043() {
- $ret = array();
- // Required modules first.
- // Add new system module indexes.
- db_add_index($ret, 'flood', 'allow', array('event', 'hostname', 'timestamp'));
- db_add_index($ret, 'history', 'nid', array('nid'));
- // Change length of theme field in {blocks} to be consistent with module, and
- // to avoid a MySQL error regarding a too-long index. Also add new indices.
- db_change_field($ret, 'blocks', 'theme', 'theme', array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''),array(
- 'unique keys' => array('tmd' => array('theme', 'module', 'delta'),),
- 'indexes' => array('list' => array('theme', 'status', 'region', 'weight', 'module'),),));
- db_add_index($ret, 'blocks_roles', 'rid', array('rid'));
- // Improve filter module indices.
- db_drop_index($ret, 'filters', 'weight');
- db_add_unique_key($ret, 'filters', 'fmd', array('format', 'module', 'delta'));
- db_add_index($ret, 'filters', 'list', array('format', 'weight', 'module', 'delta'));
- // Drop unneeded keys form the node table.
- db_drop_index($ret, 'node', 'status');
- db_drop_unique_key($ret, 'node', 'nid_vid');
- // Improve user module indices.
- db_add_index($ret, 'user', 'mail', array('mail'));
- db_add_index($ret, 'user_role', 'rid', array('rid'));
-
- // Optional modules - need to check if the tables exist.
- // Alter aggregator module's tables primary keys to make them more useful.
- if (db_table_exists('aggregator_category_feed')) {
- db_drop_primary_key($ret, 'aggregator_category_feed');
- db_add_primary_key($ret, 'aggregator_category_feed', array('cid', 'fid'));
- db_add_index($ret, 'aggregator_category_feed', 'fid', array('fid'));
- }
- if (db_table_exists('aggregator_category_item')) {
- db_drop_primary_key($ret, 'aggregator_category_item');
- db_add_primary_key($ret, 'aggregator_category_item', array('cid', 'iid'));
- db_add_index($ret, 'aggregator_category_item', 'iid', array('iid'));
- }
- // Alter contact module's table to add an index.
- if (db_table_exists('contact')) {
- db_add_index($ret, 'contact', 'list', array('weight', 'category'));
- }
- // Alter locale table to add a primary key, drop an index.
- if (db_table_exists('locales_target')) {
- db_add_primary_key($ret, 'locales_target', array('language', 'lid', 'plural'));
- }
- // Alter a poll module table to add a primary key.
- if (db_table_exists('poll_votes')) {
- db_drop_index($ret, 'poll_votes', 'nid');
- db_add_primary_key($ret, 'poll_votes', array('nid', 'uid', 'hostname'));
- }
- // Alter a profile module table to add a primary key.
- if (db_table_exists('profile_values')) {
- db_drop_index($ret, 'profile_values', 'uid');
- db_drop_index($ret, 'profile_values', 'fid');
- db_change_field($ret,'profile_values' ,'fid', 'fid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,), array('indexes' => array('fid' => array('fid'),)));
- db_change_field($ret,'profile_values' ,'uid', 'uid', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0,));
- db_add_primary_key($ret, 'profile_values', array('uid', 'fid'));
- }
- // Alter a statistics module table to add an index.
- if (db_table_exists('accesslog')) {
- db_add_index($ret, 'accesslog', 'uid', array('uid'));
- }
- // Alter taxonomy module's tables.
- if (db_table_exists('term_data')) {
- db_drop_index($ret, 'term_data', 'vid');
- db_add_index($ret, 'term_data', 'vid_name', array('vid', 'name'));
- db_add_index($ret, 'term_data', 'taxonomy_tree', array('vid', 'weight', 'name'));
- }
- if (db_table_exists('term_node')) {
- db_drop_primary_key($ret, 'term_node');
- db_drop_index($ret, 'term_node', 'tid');
- db_add_primary_key($ret, 'term_node', array('tid', 'vid'));
- }
- if (db_table_exists('term_relation')) {
- db_drop_index($ret, 'term_relation', 'tid1');
- db_add_unique_key($ret, 'term_relation', 'tid1_tid2', array('tid1', 'tid2'));
- }
- if (db_table_exists('term_synonym')) {
- db_drop_index($ret, 'term_synonym', 'name');
- db_add_index($ret, 'term_synonym', 'name_tid', array('name', 'tid'));
- }
- if (db_table_exists('vocabulary')) {
- db_add_index($ret, 'vocabulary', 'list', array('weight', 'name'));
- }
- if (db_table_exists('vocabulary_node_types')) {
- db_drop_primary_key($ret, 'vocabulary_node_types');
- db_add_primary_key($ret, 'vocabulary_node_types', array('type', 'vid'));
- db_add_index($ret, 'vocabulary_node_types', 'vid', array('vid'));
- }
- // If we updated in RC1 or before ensure we don't update twice.
- variable_set('system_update_6043_RC2', TRUE);
-
- return $ret;
-}
-
-/**
- * RC1 to RC2 index cleanup.
- */
-function system_update_6044() {
- $ret = array();
-
- // Delete invalid entries in {term_node} after system_update_6001.
- $ret[] = update_sql("DELETE FROM {term_node} WHERE vid = 0");
-
- // Only execute the rest of this function if 6043 was run in RC1 or before.
- if (variable_get('system_update_6043_RC2', FALSE)) {
- variable_del('system_update_6043_RC2');
- return $ret;
- }
-
- // User module indices.
- db_drop_unique_key($ret, 'user', 'mail');
- db_add_index($ret, 'user', 'mail', array('mail'));
-
- // Optional modules - need to check if the tables exist.
- // Alter taxonomy module's tables.
- if (db_table_exists('term_data')) {
- db_drop_unique_key($ret, 'term_data', 'vid_name');
- db_add_index($ret, 'term_data', 'vid_name', array('vid', 'name'));
- }
- if (db_table_exists('term_synonym')) {
- db_drop_unique_key($ret, 'term_synonym', 'name_tid', array('name', 'tid'));
- db_add_index($ret, 'term_synonym', 'name_tid', array('name', 'tid'));
- }
-
- return $ret;
-}
-
-/**
- * Update blog, book and locale module permissions.
- *
- * Blog module got "edit own blog" replaced with the more granular "create
- * blog entries", "edit own blog entries" and "delete own blog entries"
- * permissions. We grant create and edit to previously privileged users, but
- * delete is not granted to be in line with other permission changes in Drupal 6.
- *
- * Book module's "edit book pages" was upgraded to the bogus "edit book content"
- * in Drupal 6 RC1 instead of "edit any book content", which would be correct.
- *
- * Locale module introduced "administer languages" and "translate interface"
- * in place of "administer locales".
- *
- * Modeled after system_update_6039().
- */
-function system_update_6045() {
- $ret = array();
- $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
- while ($role = db_fetch_object($result)) {
- $renamed_permission = preg_replace('/(?<=^|,\ )edit\ own\ blog(?=,|$)/', 'create blog entries, edit own blog entries', $role->perm);
- $renamed_permission = preg_replace('/(?<=^|,\ )edit\ book\ content(?=,|$)/', 'edit any book content', $renamed_permission);
- $renamed_permission = preg_replace('/(?<=^|,\ )administer\ locales(?=,|$)/', 'administer languages, translate interface', $renamed_permission);
- if ($renamed_permission != $role->perm) {
- $ret[] = update_sql("UPDATE {permission} SET perm = '$renamed_permission' WHERE rid = $role->rid");
- }
- }
-
- // Notify user that delete permissions may have been changed. This was in
- // effect since system_update_6039(), but there was no user notice.
- drupal_set_message('Drupal now has separate edit and delete permissions. Previously, users who were able to edit content were automatically allowed to delete it. For added security, delete permissions for individual core content types have been removed from all roles on your site (only roles with the "administer nodes" permission can now delete these types of content). If you would like to reenable any individual delete permissions, you can do this at the permissions page.');
- return $ret;
-}
-
-/**
- * Ensure that the file_directory_path variable is set (using the old 5.x
- * default, if necessary), so that the changed 6.x default won't break
- * existing sites.
- */
-function system_update_6046() {
- $ret = array();
- if (!variable_get('file_directory_path', FALSE)) {
- variable_set('file_directory_path', 'files');
- $ret[] = array('success' => TRUE, 'query' => "variable_set('file_directory_path')");
- }
- return $ret;
-}
-
-/**
- * Fix cache mode for blocks inserted in system_install() in fresh installs of previous RC.
- */
-function system_update_6047() {
- $ret = array();
- $ret[] = update_sql("UPDATE {blocks} SET cache = -1 WHERE module = 'user' AND delta IN ('0', '1')");
- $ret[] = update_sql("UPDATE {blocks} SET cache = -1 WHERE module = 'system' AND delta = '0'");
- return $ret;
-}
-
-/**
* Increase the size of the 'load_functions' and 'to_arg_functions' fields in
* table 'menu_router'.
*/
@@ -2698,7 +1290,7 @@ function system_update_6048() {
}
/**
- * @} End of "defgroup updates-5.x-to-6.x"
+ * @} End of "defgroup updates-6.x-extra"
* The next series of updates should start at 7000.
*/
@@ -3229,3 +1821,4 @@ function system_update_7019() {
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
*/
+
Index: modules/taxonomy/taxonomy.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.install,v
retrieving revision 1.15
diff -u -p -r1.15 taxonomy.install
--- modules/taxonomy/taxonomy.install 31 Jan 2009 16:22:50 -0000 1.15
+++ modules/taxonomy/taxonomy.install 25 Feb 2009 15:35:58 -0000
@@ -305,9 +305,14 @@ function taxonomy_schema() {
}
/**
+ * @defgroup updates-6.x-to-7.x Taxonomy updates from 6.x to 7.x
+ * @{
+ */
+
+/**
* Rename taxonomy tables.
*/
-function taxonomy_update_7001() {
+function taxonomy_update_7000() {
$ret = array();
db_rename_table($ret, 'term_data', 'taxonomy_term_data');
db_rename_table($ret, 'term_hierarchy', 'taxonomy_term_hierarchy');
@@ -316,6 +321,11 @@ function taxonomy_update_7001() {
db_rename_table($ret, 'term_synonym', 'taxonomy_term_synonym');
db_rename_table($ret, 'vocabulary', 'taxonomy_vocabulary');
db_rename_table($ret, 'vocabulary_node_types', 'taxonomy_vocabulary_node_type');
-
return $ret;
}
+
+/**
+ * @} End of "defgroup updates-6.x-to-7.x"
+ * The next series of updates should start at 8000.
+ */
+
Index: modules/trigger/trigger.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.install,v
retrieving revision 1.7
diff -u -p -r1.7 trigger.install
--- modules/trigger/trigger.install 20 Dec 2008 05:20:21 -0000 1.7
+++ modules/trigger/trigger.install 25 Feb 2009 15:35:58 -0000
@@ -60,4 +60,3 @@ function trigger_schema() {
return $schema;
}
-
Index: modules/update/update.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.install,v
retrieving revision 1.6
diff -u -p -r1.6 update.install
--- modules/update/update.install 15 Nov 2008 13:01:11 -0000 1.6
+++ modules/update/update.install 25 Feb 2009 15:35:58 -0000
@@ -7,8 +7,14 @@
function update_install() {
// Create cache table.
drupal_install_schema('update');
+
// Remove stale variables from update_status 5.x contrib, if any.
- _update_remove_update_status_variables();
+ variable_del('update_status_settings');
+ variable_del('update_status_notify_emails');
+ variable_del('update_status_check_frequency');
+ variable_del('update_status_notification_threshold');
+ variable_del('update_status_last');
+ variable_del('update_status_fetch_url');
}
/**
@@ -41,24 +47,9 @@ function update_schema() {
}
/**
- * Private helper to clear out stale variables from update_status 5.x contrib.
- *
- * @see update_install()
- * @see update_update_6000()
+ * Implementation of hook_update_last_removed().
*/
-function _update_remove_update_status_variables() {
- variable_del('update_status_settings');
- variable_del('update_status_notify_emails');
- variable_del('update_status_check_frequency');
- variable_del('update_status_notification_threshold');
- variable_del('update_status_last');
- variable_del('update_status_fetch_url');
+function update_update_last_removed() {
+ return 6000;
}
-/**
- * Clear out stale variables from update_status.
- */
-function update_update_6000() {
- _update_remove_update_status_variables();
- return array();
-}
Index: modules/upload/upload.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.install,v
retrieving revision 1.8
diff -u -p -r1.8 upload.install
--- modules/upload/upload.install 15 Nov 2008 13:01:11 -0000 1.8
+++ modules/upload/upload.install 25 Feb 2009 15:35:58 -0000
@@ -82,4 +82,3 @@ function upload_schema() {
return $schema;
}
-