You are here

function panels_update_6290 in Panels 6.3

Update from 6.x v2.

File

./panels.install, line 867

Code

function panels_update_6290() {
  $ret = array();
  if (!module_exists('panels')) {
    $ret['#abort'] = array(
      'success' => FALSE,
      'query' => t('The Panels module cannot be updated while disabled. If you wish to update Panels, please enable it. If you do not wish to update Panels, please uninstall it.'),
    );
    return $ret;
  }

  // Fetch schema version 1.
  $schema = panels_schema_1();

  // Update size of pane 'access' field.
  db_change_field($ret, 'panels_pane', 'access', 'access', $schema['panels_pane']['fields']['access']);

  // Remove the no longer used visibility field
  if (db_column_exists('panels_pane', 'visibility')) {
    db_drop_field($ret, 'panels_pane', 'visibility');
  }

  // Remove panels_object_cache table
  if (db_table_exists('panels_object_cache')) {
    db_drop_table($ret, 'panels_object_cache');
  }

  // Doublecheck that ctools is enabled. If not, automatically disable the module.
  if (!module_exists('ctools')) {

    // Try to enable it:
    drupal_install_modules(array(
      'ctools',
    ));

    // If that fails, shut off all Panels.
    if (!module_exists('ctools')) {
      drupal_set_message(t('Panels now requires the Chaos Tool Suite (ctools) module to function. Panels has been disabled until you can add this module.'));
      module_disable(array(
        'panels',
        'panels_mini',
        'panels_export',
        'panels_node',
        'panels_simple_cache',
      ));
    }
  }
  if (!module_exists('page_manager') && db_table_exists('panels_page')) {
    drupal_set_message('Page manager module has been automatically enabled to replace the Panels pages module.');
    drupal_install_modules(array(
      'page_manager',
    ));
  }
  $ret[] = update_sql("DELETE FROM {system} WHERE name IN ('panels_page', 'panels_views')");
  return $ret;
}