non security modules update
This commit is contained in:
@@ -17,7 +17,7 @@ function panels_requirements_install() {
|
||||
// Assume that if the user is running an installation profile that both
|
||||
// Panels and CTools are the same release.
|
||||
if (!(defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install')) {
|
||||
// apparently the install process doesn't include .module files,
|
||||
// Apparently the install process doesn't include .module files,
|
||||
// so we need to force the issue in order for our versioning
|
||||
// check to work.
|
||||
if (!defined('PANELS_REQUIRED_CTOOLS_API')) {
|
||||
@@ -30,24 +30,52 @@ function panels_requirements_install() {
|
||||
include_once drupal_get_path('module', 'ctools') . '/ctools.module';
|
||||
}
|
||||
if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
|
||||
$requirements['panels_ctools'] = array(
|
||||
'title' => $t('CTools API Version'),
|
||||
'value' => CTOOLS_API_VERSION,
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
'description' => t('The CTools API version is too old for Panels. Panels needs at least %version.', array('%version' => PANELS_REQUIRED_CTOOLS_API))
|
||||
);
|
||||
$requirements['panels_ctools'] = array(
|
||||
'title' => $t('CTools API Version'),
|
||||
'value' => CTOOLS_API_VERSION,
|
||||
'severity' => REQUIREMENT_ERROR,
|
||||
'description' => t('The CTools API version is too old for Panels. Panels needs at least %version.', array('%version' => PANELS_REQUIRED_CTOOLS_API)),
|
||||
);
|
||||
}
|
||||
}
|
||||
return $requirements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_schema().
|
||||
* Implements of hook_schema().
|
||||
*/
|
||||
function panels_schema() {
|
||||
// This should always point to our 'current' schema. This makes it relatively easy
|
||||
// to keep a record of schema as we make changes to it.
|
||||
return panels_schema_4();
|
||||
// This should always point to our 'current' schema. This makes it relatively
|
||||
// easy to keep a record of schema as we make changes to it.
|
||||
return panels_schema_6();
|
||||
}
|
||||
|
||||
function panels_schema_6() {
|
||||
$schema = panels_schema_5();
|
||||
|
||||
$schema['cache_panels'] = drupal_get_schema_unprocessed('system', 'cache');
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
function panels_schema_5() {
|
||||
$schema = panels_schema_4();
|
||||
|
||||
$schema['panels_display']['fields']['uuid'] = array(
|
||||
'type' => 'char',
|
||||
'length' => '36',
|
||||
);
|
||||
$schema['panels_display']['export']['key'] = 'uuid';
|
||||
$schema['panels_display']['export']['key name'] = 'UUID';
|
||||
|
||||
$schema['panels_pane']['fields']['uuid'] = array(
|
||||
'type' => 'char',
|
||||
'length' => '36',
|
||||
);
|
||||
$schema['panels_pane']['export']['key'] = 'uuid';
|
||||
$schema['panels_pane']['export']['key name'] = 'UUID';
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
||||
function panels_schema_4() {
|
||||
@@ -375,3 +403,92 @@ function panels_update_7301() {
|
||||
|
||||
return t('panels_pane.lock field already existed, update skipped.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding universally unique identifiers to panels.
|
||||
*/
|
||||
function panels_update_7302() {
|
||||
if (!module_load_include('inc', 'ctools', 'includes/uuid')) {
|
||||
throw new DrupalUpdateException(t('Ctools UUID support not detected. You must update to a more recent version of the ctools module.'));
|
||||
}
|
||||
// Load the schema.
|
||||
$schema = panels_schema_5();
|
||||
$msg = array();
|
||||
|
||||
// Add the uuid column to the pane table.
|
||||
$table = 'panels_pane';
|
||||
$field = 'uuid';
|
||||
// Due to a previous failure, the column may already exist:
|
||||
if (!db_field_exists($table, $field)) {
|
||||
$spec = $schema[$table]['fields'][$field];
|
||||
db_add_field($table, $field, $spec);
|
||||
$msg[] = t('Added panels_pane.uuid column.');
|
||||
}
|
||||
|
||||
// Add the uuid column to the display table.
|
||||
$table = 'panels_display';
|
||||
$field = 'uuid';
|
||||
// Due to a previous failure, the column may already exist:
|
||||
if (!db_field_exists($table, $field)) {
|
||||
$spec = $schema[$table]['fields'][$field];
|
||||
db_add_field($table, $field, $spec);
|
||||
$msg[] = t('Added panels_display.uuid column.');
|
||||
}
|
||||
|
||||
if (empty($msg)) {
|
||||
$msg[] = t('UUID column already present in the panels_display & panels_pane tables.');
|
||||
}
|
||||
|
||||
// Update all DB-based panes & displays to ensure that they all contain a UUID.
|
||||
$display_dids = db_select('panels_display')
|
||||
->fields('panels_display', array('did'))
|
||||
->condition(db_or()
|
||||
->condition('uuid', '')
|
||||
->isNull('uuid')
|
||||
)
|
||||
->execute()
|
||||
->fetchCol();
|
||||
|
||||
// Check the panes as well, for paranoia.
|
||||
$pane_dids = db_select('panels_pane')
|
||||
->distinct()
|
||||
->fields('panels_pane', array('did'))
|
||||
->condition(db_or()
|
||||
->condition('uuid', '')
|
||||
->isNull('uuid')
|
||||
)
|
||||
->execute()
|
||||
->fetchCol();
|
||||
|
||||
$dids = array_unique(array_merge($display_dids, $pane_dids));
|
||||
|
||||
// If the Panels module is disabled we don't have access to
|
||||
// panels_load_displays().
|
||||
if (!function_exists('panels_load_displays')) {
|
||||
module_load_include('module', 'panels');
|
||||
}
|
||||
if ($displays = panels_load_displays($dids)) {
|
||||
foreach ($displays as $display) {
|
||||
// A display save also triggers pane saves.
|
||||
panels_save_display($display);
|
||||
}
|
||||
$msg[] = t('Generated UUIDs for database-based panel displays and panes.');
|
||||
}
|
||||
else {
|
||||
$msg[] = t('No database-based panel displays or panes for which to generate UUIDs.');
|
||||
}
|
||||
|
||||
return implode("\n", $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a custom cache table for Panels.
|
||||
*/
|
||||
function panels_update_7303() {
|
||||
$schema = panels_schema_6();
|
||||
|
||||
$table_name = 'cache_panels';
|
||||
if (!db_table_exists($table_name)) {
|
||||
db_create_table($table_name, $schema[$table_name]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user