Révision 136a805a
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/panels/panels.install | ||
---|---|---|
47 | 47 |
function panels_schema() { |
48 | 48 |
// This should always point to our 'current' schema. This makes it relatively |
49 | 49 |
// easy to keep a record of schema as we make changes to it. |
50 |
return panels_schema_6(); |
|
50 |
return panels_schema_8(); |
|
51 |
} |
|
52 |
|
|
53 |
function panels_schema_8() { |
|
54 |
$schema = panels_schema_7(); |
|
55 |
|
|
56 |
// Add the storage type and id columns. |
|
57 |
$schema['panels_display']['fields']['storage_type'] = array( |
|
58 |
'type' => 'varchar', |
|
59 |
'length' => 255, |
|
60 |
'default' => '', |
|
61 |
); |
|
62 |
$schema['panels_display']['fields']['storage_id'] = array( |
|
63 |
'type' => 'varchar', |
|
64 |
'length' => 255, |
|
65 |
'default' => '', |
|
66 |
); |
|
67 |
|
|
68 |
return $schema; |
|
69 |
} |
|
70 |
|
|
71 |
function panels_schema_7() { |
|
72 |
$schema = panels_schema_6(); |
|
73 |
|
|
74 |
// Update field lengths to 255 chars. |
|
75 |
$schema['panels_pane']['fields']['subtype']['length'] = '255'; |
|
76 |
$schema['panels_pane']['fields']['panel']['length'] = '255'; |
|
77 |
$schema['panels_pane']['fields']['type']['length'] = '255'; |
|
78 |
|
|
79 |
return $schema; |
|
51 | 80 |
} |
52 | 81 |
|
53 | 82 |
function panels_schema_6() { |
... | ... | |
492 | 521 |
db_create_table($table_name, $schema[$table_name]); |
493 | 522 |
} |
494 | 523 |
} |
524 |
|
|
525 |
/** |
|
526 |
* Update "panels_pane" table field lengths to 255 chars. |
|
527 |
*/ |
|
528 |
function panels_update_7304() { |
|
529 |
$schema = panels_schema_7(); |
|
530 |
|
|
531 |
$update_fields = array( |
|
532 |
'panels_pane' => array('subtype', 'panel', 'type'), |
|
533 |
); |
|
534 |
|
|
535 |
foreach($update_fields as $table => $fields) { |
|
536 |
foreach($fields as $field_name) { |
|
537 |
db_change_field($table, $field_name, $field_name, $schema[$table]['fields'][$field_name]); |
|
538 |
} |
|
539 |
} |
|
540 |
} |
|
541 |
|
|
542 |
/** |
|
543 |
* Add the "storage_type" and "storage_id" columns to "panels_display". |
|
544 |
*/ |
|
545 |
function panels_update_7305() { |
|
546 |
$schema = panels_schema_8(); |
|
547 |
|
|
548 |
$new_fields = array( |
|
549 |
'panels_display' => array('storage_type', 'storage_id'), |
|
550 |
); |
|
551 |
|
|
552 |
foreach ($new_fields as $table => $fields) { |
|
553 |
foreach ($fields as $field_name) { |
|
554 |
db_add_field($table, $field_name, $schema[$table]['fields'][$field_name]); |
|
555 |
} |
|
556 |
} |
|
557 |
} |
|
558 |
|
|
559 |
/** |
|
560 |
* Set the storage type and id on existing page manager panels displays. |
|
561 |
*/ |
|
562 |
function panels_update_7306() { |
|
563 |
if (!db_table_exists('page_manager_handlers')) { |
|
564 |
return t('Skipping update - page_manager is not installed.'); |
|
565 |
} |
|
566 |
|
|
567 |
// Get all page_manager_handlers that have a panels context. |
|
568 |
$result = db_query("SELECT pm.name, pm.conf FROM {page_manager_handlers} pm WHERE pm.handler = 'panel_context'"); |
|
569 |
$page_manager_panels = array(); |
|
570 |
foreach ($result as $row) { |
|
571 |
$conf = unserialize($row->conf); |
|
572 |
if (isset($conf['did'])) { |
|
573 |
$page_manager_panels[$conf['did']] = $row->name; |
|
574 |
} |
|
575 |
} |
|
576 |
|
|
577 |
if (!empty($page_manager_panels)) { |
|
578 |
// Check panels displays that only have empty storage types |
|
579 |
$result = db_query("SELECT pd.did FROM {panels_display} pd WHERE pd.did IN (:dids) AND storage_type = ''", array(':dids' => array_keys($page_manager_panels))); |
|
580 |
foreach ($result as $row) { |
|
581 |
db_update('panels_display') |
|
582 |
->fields(array( |
|
583 |
'storage_type' => 'page_manager', |
|
584 |
'storage_id' => $page_manager_panels[$row->did], |
|
585 |
)) |
|
586 |
->condition('did', $row->did) |
|
587 |
->execute(); |
|
588 |
} |
|
589 |
} |
|
590 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules