You are here

function boost_update_6103 in Boost 6

Update 6103 - Add new columns to tables

File

./boost.install, line 885
Handles Boost module installation and upgrade tasks.

Code

function boost_update_6103() {
  $GLOBALS['_boost_max_execution_time'] = ini_get('max_execution_time');
  ini_set('max_execution_time', 10800);

  //3 Hours
  _boost_install_set_time_limit(0);
  $ret = array();

  // Add in base_dir column
  db_add_field($ret, 'boost_cache', 'base_dir', array(
    'description' => 'Path of the cache root dir relative to Drupal webroot.',
    'type' => 'varchar',
    'length' => 128,
    'not null' => TRUE,
    'default' => '',
  ));
  db_add_field($ret, 'boost_cache_settings', 'base_dir', array(
    'description' => 'Path of the cache root dir relative to Drupal webroot.',
    'type' => 'varchar',
    'length' => 128,
    'not null' => TRUE,
    'default' => '',
  ));
  db_add_index($ret, 'boost_cache', 'base_dir', array(
    'base_dir',
  ));
  db_add_index($ret, 'boost_cache_settings', 'base_dir', array(
    'base_dir',
  ));

  // Add in page_id column
  db_add_field($ret, 'boost_cache', 'page_id', array(
    'description' => 'The ID of the page.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_field($ret, 'boost_cache_settings', 'page_id', array(
    'description' => 'The ID of the page.',
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
  ));
  db_add_index($ret, 'boost_cache', 'page_id', array(
    'page_id',
  ));
  db_add_index($ret, 'boost_cache_settings', 'page_id', array(
    'page_id',
  ));

  // Add in timer column
  db_add_field($ret, 'boost_cache', 'timer', array(
    'type' => 'int',
    'unsigned' => TRUE,
    'not null' => TRUE,
    'default' => 0,
    'description' => 'Time in milliseconds that the page took to be generated.',
  ));
  db_add_index($ret, 'boost_cache', 'timer', array(
    'timer',
  ));

  // Add in timer_average column
  db_add_field($ret, 'boost_cache', 'timer_average', array(
    'type' => 'float',
    'not null' => TRUE,
    'default' => 0,
    'description' => 'Average time in milliseconds that the page took to be generated.',
  ));
  db_add_index($ret, 'boost_cache', 'timer_average', array(
    'timer_average',
  ));

  // Add indexes
  db_add_index($ret, 'boost_cache', 'page_callback', array(
    'page_callback',
  ));
  db_add_index($ret, 'boost_cache', 'page_arguments', array(
    'page_arguments',
  ));

  // Set Defaults
  db_field_set_default($ret, 'boost_cache_settings', 'page_arguments', '0');
  ini_set('max_execution_time', $GLOBALS['_boost_max_execution_time']);
  return $ret;
}