Révision 08475715
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_8();
|
|
50 |
return panels_schema_9();
|
|
51 | 51 |
} |
52 | 52 |
|
53 |
function panels_schema_9() { |
|
54 |
$schema = panels_schema_8(); |
|
55 |
$schema['panels_allowed_types'] = array( |
|
56 |
'fields' => array( |
|
57 |
'module' => array( |
|
58 |
'description' => 'The name of the module requiring allowed type settings.', |
|
59 |
'type' => 'varchar', |
|
60 |
'length' => 255, |
|
61 |
'not null' => TRUE, |
|
62 |
'default' => '', |
|
63 |
), |
|
64 |
'type' => array( |
|
65 |
'description' => 'Ctools content type to allow.', |
|
66 |
'type' => 'varchar', |
|
67 |
'length' => 255, |
|
68 |
'not null' => TRUE, |
|
69 |
'default' => '', |
|
70 |
), |
|
71 |
'allowed' => array( |
|
72 |
'description' => 'A boolean for if the type is allowed or not.', |
|
73 |
'type' => 'int', |
|
74 |
'size' => 'tiny', |
|
75 |
'default' => 1, |
|
76 |
), |
|
77 |
), |
|
78 |
'indexes' => array( |
|
79 |
'type_idx' => array('type'), |
|
80 |
), |
|
81 |
); |
|
82 |
|
|
83 |
return $schema; |
|
84 |
} |
|
85 |
|
|
53 | 86 |
function panels_schema_8() { |
54 | 87 |
$schema = panels_schema_7(); |
55 | 88 |
|
... | ... | |
548 | 581 |
'panels_pane' => array('subtype', 'panel', 'type'), |
549 | 582 |
); |
550 | 583 |
|
551 |
foreach($update_fields as $table => $fields) { |
|
552 |
foreach($fields as $field_name) { |
|
584 |
foreach ($update_fields as $table => $fields) {
|
|
585 |
foreach ($fields as $field_name) {
|
|
553 | 586 |
db_change_field($table, $field_name, $field_name, $schema[$table]['fields'][$field_name]); |
554 | 587 |
} |
555 | 588 |
} |
... | ... | |
607 | 640 |
} |
608 | 641 |
} |
609 | 642 |
} |
643 |
|
|
644 |
/** |
|
645 |
* Add a custom table for allowed types. |
|
646 |
*/ |
|
647 |
function panels_update_7307() { |
|
648 |
$schema = panels_schema_9(); |
|
649 |
|
|
650 |
$table_name = 'panels_allowed_types'; |
|
651 |
if (!db_table_exists($table_name)) { |
|
652 |
db_create_table($table_name, $schema[$table_name]); |
|
653 |
} |
|
654 |
|
|
655 |
// Read existing allowed settings and store them in a new table. |
|
656 |
$variables = db_select('variable', 'v') |
|
657 |
->fields('v', array('name')) |
|
658 |
->condition('name', '%' . db_like('_allowed_types'), 'LIKE') |
|
659 |
->execute() |
|
660 |
->fetchCol(); |
|
661 |
foreach ($variables as $name) { |
|
662 |
$module = str_replace('_allowed_types', '', $name); |
|
663 |
$variable = variable_get($name); |
|
664 |
foreach ($variable as $type => $allowed) { |
|
665 |
$allowed = empty($allowed) ? 0 : 1; |
|
666 |
db_merge('panels_allowed_types') |
|
667 |
->key(array('module' => $module, 'type' => $type)) |
|
668 |
->fields(array( |
|
669 |
'module' => $module, |
|
670 |
'type' => $type, |
|
671 |
'allowed' => $allowed, |
|
672 |
)) |
|
673 |
->execute(); |
|
674 |
} |
|
675 |
variable_del($name); |
|
676 |
} |
|
677 |
} |
|
678 |
|
|
679 |
/** |
|
680 |
* Rename style permissions. |
|
681 |
*/ |
|
682 |
function panels_update_7308() { |
|
683 |
$permissions = array( |
|
684 |
'administer panels display styles', |
|
685 |
'administer panels pane styles', |
|
686 |
'administer panels region styles', |
|
687 |
); |
|
688 |
foreach (array_keys(user_roles(TRUE, 'administer panels styles')) as $rid) { |
|
689 |
user_role_grant_permissions($rid, $permissions); |
|
690 |
} |
|
691 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules