diff --git includes/session.inc includes/session.inc index d4dedcc..79d936d 100644 --- includes/session.inc +++ includes/session.inc @@ -242,6 +242,11 @@ function drupal_session_commit() { return; } + // Expire the keep if possible. + if (isset($_SESSION['drupal_keep']) && ($_SESSION['drupal_keep'] > REQUEST_TIME)) { + unset($_SESSION['drupal_keep']); + } + if (empty($user->uid) && empty($_SESSION)) { // There is no session data to store, destroy the session if it was // previously started. @@ -271,6 +276,25 @@ function drupal_session_started($set = NULL) { return $session_started && session_id(); } + /** + * Keep the current user's session open for a given length of time. + * + * @param $duration The length the session needs to remain open, in seconds. + */ +function drupal_session_keep($duration) { + $new_timestamp = REQUEST_TIME + $duration; + if (!isset($_SESSION['drupal_keep']) || ($new_timestamp > $_SESSION['drupal_keep'])) { + $_SESSION['drupal_keep'] = $new_timestamp; + } +} + +/** + * Stop keeping the current user's session open. + */ +function drupal_session_keep_reset() { + unset($_SESSION['drupal_keep']); +} + /** * Called when an anonymous user becomes authenticated or vice-versa. * diff --git includes/update.inc includes/update.inc index 71a40bc..6bc5499 100644 --- includes/update.inc +++ includes/update.inc @@ -177,6 +177,7 @@ function update_fix_d7_requirements() { // Add the cache_path table. $schema['cache_path'] = drupal_get_schema_unprocessed('system', 'cache'); $schema['cache_path']['description'] = 'Cache table used for path alias lookups.'; + db_create_table('cache_path', $schema['cache_path']); // system_update_7042() renames columns, but these are needed to bootstrap. // Add empty columns for now. @@ -249,6 +250,32 @@ function update_fix_d7_requirements() { ); db_create_table('semaphore', $schema['semaphore']); + // Add registry tables since these are required during an update. + $schema['registry'] = array( + 'fields' => array( + 'name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'type' => array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => ''), + 'filename' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'module' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + ), + 'primary key' => array('name', 'type'), + 'indexes' => array( + 'hook' => array('type', 'weight', 'module'), + ), + ); + $schema['registry_file'] = array( + 'fields' => array( + 'filename' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), + 'filectime' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'filemtime' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + ), + 'primary key' => array('filename'), + ); + db_create_table('registry', $schema['registry']); + db_create_table('registry_file', $schema['registry_file']); + + // Create date format tables. $schema['date_format_type'] = array( 'description' => 'Stores configured date format types.', 'fields' => array( diff --git modules/block/block.install modules/block/block.install index 1fab427..a911f74 100644 --- modules/block/block.install +++ modules/block/block.install @@ -207,7 +207,6 @@ function block_schema() { * Implements hook_install(). */ function block_install() { - // Block should go first so that other modules can alter its output // during hook_page_alter(). Almost everything on the page is a block, // so before block module runs, there will not be much to alter. diff --git modules/filter/filter.install modules/filter/filter.install index 0c9e22e..216b6ef 100644 --- modules/filter/filter.install +++ modules/filter/filter.install @@ -234,7 +234,7 @@ function filter_update_7004() { // Enable all existing filters ({filter} contained only enabled previously). db_update('filter') - ->fields('status', '1') + ->fields(array('status' => '1')) ->execute(); // Move filter settings from system variables into {filter}.settings. @@ -262,7 +262,7 @@ function filter_update_7004() { } } if (!empty($settings)) { - db_upddate('filter') + db_update('filter') ->fields(array('settings' => serialize($settings))) ->condition('format', $filter->format) ->condition('name', $filter->name) diff --git modules/node/node.install modules/node/node.install index cdf381e..e3932d0 100644 --- modules/node/node.install +++ modules/node/node.install @@ -369,6 +369,9 @@ function node_update_7000() { ->fields(array('module' => 'node_content')) ->condition('module', 'node') ->execute(); + + // Rename the module column to base. + db_change_field('node_type', 'module', 'base', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE)); } /** @@ -461,6 +464,12 @@ function node_update_7006(&$context) { else { // Subsequent invocations. + // Save the field IDs for field_sql_storage_field_storage_write(). + $title_field = field_info_field('title'); + $title_field_id = $title_field['id']; + $body_field = field_info_field('body'); + $body_field_id = $body_field['id']; + $found = FALSE; if ($context['total']) { // Operate on every revision of every node (whee!), in batches. @@ -507,7 +516,7 @@ function node_update_7006(&$context) { $node->body[LANGUAGE_NONE][0]['format'] = !empty($revision->format) ? $revision->format : variable_get('filter_default_format', 1); // This is a core update and no contrib modules are enabled yet, so // we can assume default field storage for a faster update. - field_sql_storage_field_storage_write('node', $node, FIELD_STORAGE_INSERT, array()); + field_sql_storage_field_storage_write('node', $node, FIELD_STORAGE_INSERT, array($title_field_id, $body_field_id)); } // Migrate the status columns to the {node_revision} table. diff --git modules/system/system.install modules/system/system.install index aafc362..a67d4b7 100644 --- modules/system/system.install +++ modules/system/system.install @@ -1838,30 +1838,7 @@ function system_update_7005() { * longer needed. */ function system_update_7006() { - $schema['registry'] = array( - 'fields' => array( - 'name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'type' => array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => ''), - 'filename' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'module' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'weight' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - ), - 'primary key' => array('name', 'type'), - 'indexes' => array( - 'hook' => array('type', 'weight', 'module'), - ), - ); - $schema['registry_file'] = array( - 'fields' => array( - 'filename' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), - 'filectime' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'filemtime' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - ), - 'primary key' => array('filename'), - ); - db_create_table('registry', $schema['registry']); - db_create_table('registry_file', $schema['registry_file']); - registry_rebuild(); + // Update moved to update_fix_d7_requirements(). } /** diff --git modules/taxonomy/taxonomy.install modules/taxonomy/taxonomy.install index 9a34597..035396f 100644 --- modules/taxonomy/taxonomy.install +++ modules/taxonomy/taxonomy.install @@ -332,8 +332,9 @@ function taxonomy_update_7004() { foreach ($vocabulary->nodes as $bundle) { $instance = array( - 'label' => $vocabulary->name, 'field_name' => $field_name, + 'object_type' => 'taxonomy_term', + 'label' => $vocabulary->name, 'bundle' => $bundle, 'object_type' => 'node', 'description' => $vocabulary->help, diff --git modules/user/user.install modules/user/user.install index a544ae3..8add1c1 100644 --- modules/user/user.install +++ modules/user/user.install @@ -427,13 +427,13 @@ function user_update_7004(&$sandbox) { // Initialize batch update information. $sandbox['progress'] = 0; $sandbox['last_user_processed'] = -1; - $sandbox['max'] = db_query("SELECT COUNT(*) FROM {user} WHERE picture <> ''")->fetchField(); + $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE picture <> ''")->fetchField(); } // As a batch operation move the photos into the {file} table and update the // {users} records. $limit = 500; - $result = db_query_range("SELECT uid, picture FROM {user} WHERE picture <> '' AND uid > :uid ORDER BY uid", 0, $limit, array(':uid' => $sandbox['last_user_processed'])); + $result = db_query_range("SELECT uid, picture FROM {users} WHERE picture <> '' AND uid > :uid ORDER BY uid", 0, $limit, array(':uid' => $sandbox['last_user_processed'])); foreach ($result as $user) { // Don't bother adding files that don't exist. if (!file_exists($user->picture)) { @@ -473,8 +473,8 @@ function user_update_7004(&$sandbox) { // When we're finished, drop the old picture field and rename the new one to // replace it. if (isset($sandbox['#finished']) && $sandbox['#finished'] == 1) { - db_drop_field('user', 'picture'); - db_change_field('user', 'picture_fid', 'picture', $picture_field); + db_drop_field('users', 'picture'); + db_change_field('users', 'picture_fid', 'picture', $picture_field); } } diff --git update.php update.php index 6d52f6e..1a52798 100644 --- update.php +++ update.php @@ -395,6 +395,9 @@ else { if (isset($output) && $output) { // Explictly start a session so that the update.php token will be accepted. drupal_session_start(); + // Force the session to stay open for 15 minutes. + drupal_session_keep(300); + // We defer the display of messages until all updates are done. $progress_page = ($batch = batch_get()) && isset($batch['running']); print theme('update_page', array('content' => $output, 'show_messages' => !$progress_page));