function update_fix_d6_requirements

8.0.x update_6.inc update_fix_d6_requirements()
6.x update_6.inc update_fix_d6_requirements()
7.x update_6.inc update_fix_d6_requirements()
3.x update_6.inc update_fix_d6_requirements()
4.x update_6.inc update_fix_d6_requirements()
5.x update_6.inc update_fix_d6_requirements()

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().

1 call to update_fix_d6_requirements()
update_main_prepare in commands/core/drupal/update_6.inc

File

commands/core/drupal/update_6.inc, line 186
Update.php for provisioned sites. This file is a derivative of the standard drupal update.php, which has been modified to allow being run from the command line.

Code

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']);

    // Create the semaphore table now -- the menu system after 6.15 depends on
    // this table, and menu code runs in updates prior to the table being
    // created in its original update function, system_update_6054().
    $schema['semaphore'] = array(
      'fields' => array(
        'name' => array(
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'default' => '',
        ),
        'value' => array(
          'type' => 'varchar',
          'length' => 255,
          'not null' => TRUE,
          'default' => '',
        ),
        'expire' => array(
          'type' => 'float',
          'size' => 'big',
          'not null' => TRUE,
        ),
      ),
      'indexes' => array('expire' => array('expire')),
      'primary key' => array('name'),
    );
    db_create_table($ret, 'semaphore', $schema['semaphore']);
  }

  return $ret;
}