1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
*/
|
6
|
|
7
|
/**
|
8
|
* Test requirements for installation and running.
|
9
|
*/
|
10
|
function panels_requirements($phase) {
|
11
|
$function = "panels_requirements_$phase";
|
12
|
return function_exists($function) ? $function() : array();
|
13
|
}
|
14
|
|
15
|
/**
|
16
|
* Check install-time requirements.
|
17
|
*/
|
18
|
function panels_requirements_install() {
|
19
|
$requirements = array();
|
20
|
$t = get_t();
|
21
|
// Assume that if the user is running an installation profile that both
|
22
|
// Panels and CTools are the same release.
|
23
|
if (!(defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install')) {
|
24
|
// Apparently the install process doesn't include .module files,
|
25
|
// so we need to force the issue in order for our versioning
|
26
|
// check to work.
|
27
|
if (!defined('PANELS_REQUIRED_CTOOLS_API')) {
|
28
|
include_once drupal_get_path('module', 'panels') . '/panels.module';
|
29
|
}
|
30
|
|
31
|
// In theory we should check module_exists, but Drupal's gating should
|
32
|
// actually prevent us from getting here otherwise.
|
33
|
if (!defined('CTOOLS_API_VERSION')) {
|
34
|
include_once drupal_get_path('module', 'ctools') . '/ctools.module';
|
35
|
}
|
36
|
if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) {
|
37
|
$requirements['panels_ctools'] = array(
|
38
|
'title' => $t('CTools API Version'),
|
39
|
'value' => CTOOLS_API_VERSION,
|
40
|
'severity' => REQUIREMENT_ERROR,
|
41
|
'description' => t('The CTools API version is too old for Panels. Panels needs at least %version.', array('%version' => PANELS_REQUIRED_CTOOLS_API)),
|
42
|
);
|
43
|
}
|
44
|
}
|
45
|
return $requirements;
|
46
|
}
|
47
|
|
48
|
/**
|
49
|
* Implements of hook_schema().
|
50
|
*/
|
51
|
function panels_schema() {
|
52
|
// This should always point to our 'current' schema. This makes it relatively
|
53
|
// easy to keep a record of schema as we make changes to it.
|
54
|
return panels_schema_9();
|
55
|
}
|
56
|
|
57
|
function panels_schema_9() {
|
58
|
$schema = panels_schema_8();
|
59
|
$schema['panels_allowed_types'] = array(
|
60
|
'fields' => array(
|
61
|
'module' => array(
|
62
|
'description' => 'The name of the module requiring allowed type settings.',
|
63
|
'type' => 'varchar',
|
64
|
'length' => 255,
|
65
|
'not null' => TRUE,
|
66
|
'default' => '',
|
67
|
),
|
68
|
'type' => array(
|
69
|
'description' => 'Ctools content type to allow.',
|
70
|
'type' => 'varchar',
|
71
|
'length' => 255,
|
72
|
'not null' => TRUE,
|
73
|
'default' => '',
|
74
|
),
|
75
|
'allowed' => array(
|
76
|
'description' => 'A boolean for if the type is allowed or not.',
|
77
|
'type' => 'int',
|
78
|
'size' => 'tiny',
|
79
|
'default' => 1,
|
80
|
),
|
81
|
),
|
82
|
'indexes' => array(
|
83
|
'type_idx' => array('type'),
|
84
|
),
|
85
|
);
|
86
|
|
87
|
return $schema;
|
88
|
}
|
89
|
|
90
|
function panels_schema_8() {
|
91
|
$schema = panels_schema_7();
|
92
|
|
93
|
// Add the storage type and id columns.
|
94
|
$schema['panels_display']['fields']['storage_type'] = array(
|
95
|
'type' => 'varchar',
|
96
|
'length' => 255,
|
97
|
'default' => '',
|
98
|
);
|
99
|
$schema['panels_display']['fields']['storage_id'] = array(
|
100
|
'type' => 'varchar',
|
101
|
'length' => 255,
|
102
|
'default' => '',
|
103
|
);
|
104
|
|
105
|
return $schema;
|
106
|
}
|
107
|
|
108
|
function panels_schema_7() {
|
109
|
$schema = panels_schema_6();
|
110
|
|
111
|
// Update field lengths to 255 chars.
|
112
|
$schema['panels_pane']['fields']['subtype']['length'] = '255';
|
113
|
$schema['panels_pane']['fields']['panel']['length'] = '255';
|
114
|
$schema['panels_pane']['fields']['type']['length'] = '255';
|
115
|
|
116
|
return $schema;
|
117
|
}
|
118
|
|
119
|
function panels_schema_6() {
|
120
|
$schema = panels_schema_5();
|
121
|
|
122
|
$schema['cache_panels'] = drupal_get_schema_unprocessed('system', 'cache');
|
123
|
|
124
|
return $schema;
|
125
|
}
|
126
|
|
127
|
function panels_schema_5() {
|
128
|
$schema = panels_schema_4();
|
129
|
|
130
|
$schema['panels_display']['fields']['uuid'] = array(
|
131
|
'type' => 'char',
|
132
|
'length' => '36',
|
133
|
);
|
134
|
$schema['panels_display']['export']['key'] = 'uuid';
|
135
|
$schema['panels_display']['export']['key name'] = 'UUID';
|
136
|
|
137
|
$schema['panels_pane']['fields']['uuid'] = array(
|
138
|
'type' => 'char',
|
139
|
'length' => '36',
|
140
|
);
|
141
|
$schema['panels_pane']['export']['key'] = 'uuid';
|
142
|
$schema['panels_pane']['export']['key name'] = 'UUID';
|
143
|
|
144
|
return $schema;
|
145
|
}
|
146
|
|
147
|
function panels_schema_4() {
|
148
|
$schema = panels_schema_3();
|
149
|
|
150
|
$schema['panels_pane']['fields']['locks'] = array(
|
151
|
'type' => 'text',
|
152
|
'size' => 'big',
|
153
|
'serialize' => TRUE,
|
154
|
'object default' => array(),
|
155
|
'initial' => array(),
|
156
|
);
|
157
|
|
158
|
return $schema;
|
159
|
}
|
160
|
|
161
|
/**
|
162
|
* Schema from the D6 version.
|
163
|
*/
|
164
|
function panels_schema_3() {
|
165
|
// Schema 3 is now locked. If you need to make changes, please create
|
166
|
// schema 4 and add them.
|
167
|
$schema = array();
|
168
|
|
169
|
$schema['panels_display'] = array(
|
170
|
'export' => array(
|
171
|
'object' => 'panels_display',
|
172
|
'bulk export' => FALSE,
|
173
|
'export callback' => 'panels_export_display',
|
174
|
'can disable' => FALSE,
|
175
|
'identifier' => 'display',
|
176
|
),
|
177
|
'fields' => array(
|
178
|
'did' => array(
|
179
|
'type' => 'serial',
|
180
|
'not null' => TRUE,
|
181
|
'no export' => TRUE,
|
182
|
),
|
183
|
'layout' => array(
|
184
|
'type' => 'varchar',
|
185
|
'length' => '255',
|
186
|
'default' => '',
|
187
|
),
|
188
|
'layout_settings' => array(
|
189
|
'type' => 'text',
|
190
|
'size' => 'big',
|
191
|
'serialize' => TRUE,
|
192
|
'object default' => array(),
|
193
|
'initial' => array(),
|
194
|
),
|
195
|
'panel_settings' => array(
|
196
|
'type' => 'text',
|
197
|
'size' => 'big',
|
198
|
'serialize' => TRUE,
|
199
|
'object default' => array(),
|
200
|
'initial' => array(),
|
201
|
),
|
202
|
'cache' => array(
|
203
|
'type' => 'text',
|
204
|
'serialize' => TRUE,
|
205
|
'object default' => array(),
|
206
|
'initial' => array(),
|
207
|
),
|
208
|
'title' => array(
|
209
|
'type' => 'varchar',
|
210
|
'length' => '255',
|
211
|
'default' => '',
|
212
|
),
|
213
|
'hide_title' => array(
|
214
|
'type' => 'int',
|
215
|
'size' => 'tiny',
|
216
|
'default' => 0,
|
217
|
'no export' => TRUE,
|
218
|
),
|
219
|
'title_pane' => array(
|
220
|
'type' => 'int',
|
221
|
'default' => 0,
|
222
|
'no export' => TRUE,
|
223
|
),
|
224
|
),
|
225
|
'primary key' => array('did'),
|
226
|
);
|
227
|
|
228
|
$schema['panels_pane'] = array(
|
229
|
'export' => array(
|
230
|
'can disable' => FALSE,
|
231
|
'identifier' => 'pane',
|
232
|
'bulk export' => FALSE,
|
233
|
),
|
234
|
'fields' => array(
|
235
|
'pid' => array(
|
236
|
'type' => 'serial',
|
237
|
'not null' => TRUE,
|
238
|
),
|
239
|
'did' => array(
|
240
|
'type' => 'int',
|
241
|
'not null' => TRUE,
|
242
|
'default' => 0,
|
243
|
'no export' => TRUE,
|
244
|
),
|
245
|
'panel' => array(
|
246
|
'type' => 'varchar',
|
247
|
'length' => '32',
|
248
|
'default' => '',
|
249
|
),
|
250
|
'type' => array(
|
251
|
'type' => 'varchar',
|
252
|
'length' => '32',
|
253
|
'default' => '',
|
254
|
),
|
255
|
'subtype' => array(
|
256
|
'type' => 'varchar',
|
257
|
'length' => '64',
|
258
|
'default' => '',
|
259
|
),
|
260
|
'shown' => array(
|
261
|
'type' => 'int',
|
262
|
'size' => 'tiny',
|
263
|
'default' => 1,
|
264
|
),
|
265
|
'access' => array(
|
266
|
'type' => 'text',
|
267
|
'size' => 'big',
|
268
|
'serialize' => TRUE,
|
269
|
'object default' => array(),
|
270
|
'initial' => array(),
|
271
|
),
|
272
|
'configuration' => array(
|
273
|
'type' => 'text',
|
274
|
'size' => 'big',
|
275
|
'serialize' => TRUE,
|
276
|
'object default' => array(),
|
277
|
'initial' => array(),
|
278
|
),
|
279
|
'cache' => array(
|
280
|
'type' => 'text',
|
281
|
'size' => 'big',
|
282
|
'serialize' => TRUE,
|
283
|
'object default' => array(),
|
284
|
'initial' => array(),
|
285
|
),
|
286
|
'style' => array(
|
287
|
'type' => 'text',
|
288
|
'size' => 'big',
|
289
|
'serialize' => TRUE,
|
290
|
'object default' => array(),
|
291
|
'initial' => array(),
|
292
|
),
|
293
|
'css' => array(
|
294
|
'type' => 'text',
|
295
|
'size' => 'big',
|
296
|
'serialize' => TRUE,
|
297
|
'object default' => array(),
|
298
|
'initial' => array(),
|
299
|
),
|
300
|
'extras' => array(
|
301
|
'type' => 'text',
|
302
|
'size' => 'big',
|
303
|
'serialize' => TRUE,
|
304
|
'object default' => array(),
|
305
|
'initial' => array(),
|
306
|
),
|
307
|
'position' => array(
|
308
|
'type' => 'int',
|
309
|
'size' => 'small',
|
310
|
'default' => 0,
|
311
|
),
|
312
|
),
|
313
|
'primary key' => array('pid'),
|
314
|
'indexes' => array(
|
315
|
'did_idx' => array('did'),
|
316
|
),
|
317
|
);
|
318
|
|
319
|
$schema['panels_renderer_pipeline'] = array(
|
320
|
'description' => 'Contains renderer pipelines for Panels. Each pipeline contains one or more renderers and access rules to select which renderer gets used.',
|
321
|
'export' => array(
|
322
|
'identifier' => 'pipeline',
|
323
|
'bulk export' => TRUE,
|
324
|
'primary key' => 'rpid',
|
325
|
'api' => array(
|
326
|
'owner' => 'panels',
|
327
|
'api' => 'pipelines',
|
328
|
'minimum_version' => 1,
|
329
|
'current_version' => 1,
|
330
|
),
|
331
|
),
|
332
|
'fields' => array(
|
333
|
'rpid' => array(
|
334
|
'type' => 'serial',
|
335
|
'description' => 'A database primary key to ensure uniqueness.',
|
336
|
'not null' => TRUE,
|
337
|
'no export' => TRUE,
|
338
|
),
|
339
|
'name' => array(
|
340
|
'type' => 'varchar',
|
341
|
'length' => '255',
|
342
|
'description' => 'Unique ID for this content. Used to identify it programmatically.',
|
343
|
),
|
344
|
'admin_title' => array(
|
345
|
'type' => 'varchar',
|
346
|
'length' => '255',
|
347
|
'description' => 'Administrative title for this pipeline.',
|
348
|
),
|
349
|
'admin_description' => array(
|
350
|
'type' => 'text',
|
351
|
'size' => 'big',
|
352
|
'description' => 'Administrative description for this pipeline.',
|
353
|
'object default' => '',
|
354
|
),
|
355
|
'weight' => array(
|
356
|
'type' => 'int',
|
357
|
'size' => 'small',
|
358
|
'default' => 0,
|
359
|
),
|
360
|
'settings' => array(
|
361
|
'type' => 'text',
|
362
|
'size' => 'big',
|
363
|
'description' => 'Serialized settings for the actual pipeline. The contents of this field are up to the plugin that uses it.',
|
364
|
'serialize' => TRUE,
|
365
|
'object default' => array(),
|
366
|
),
|
367
|
),
|
368
|
'primary key' => array('rpid'),
|
369
|
);
|
370
|
|
371
|
$schema['panels_layout'] = array(
|
372
|
'description' => 'Contains exportable customized layouts for this site.',
|
373
|
'export' => array(
|
374
|
'identifier' => 'layout',
|
375
|
'bulk export' => TRUE,
|
376
|
'primary key' => 'lid',
|
377
|
'api' => array(
|
378
|
'owner' => 'panels',
|
379
|
'api' => 'layouts',
|
380
|
'minimum_version' => 1,
|
381
|
'current_version' => 1,
|
382
|
),
|
383
|
),
|
384
|
'fields' => array(
|
385
|
'lid' => array(
|
386
|
'type' => 'serial',
|
387
|
'description' => 'A database primary key to ensure uniqueness.',
|
388
|
'not null' => TRUE,
|
389
|
'no export' => TRUE,
|
390
|
),
|
391
|
'name' => array(
|
392
|
'type' => 'varchar',
|
393
|
'length' => '255',
|
394
|
'description' => 'Unique ID for this content. Used to identify it programmatically.',
|
395
|
),
|
396
|
'admin_title' => array(
|
397
|
'type' => 'varchar',
|
398
|
'length' => '255',
|
399
|
'description' => 'Administrative title for this layout.',
|
400
|
),
|
401
|
'admin_description' => array(
|
402
|
'type' => 'text',
|
403
|
'size' => 'big',
|
404
|
'description' => 'Administrative description for this layout.',
|
405
|
'object default' => '',
|
406
|
),
|
407
|
'category' => array(
|
408
|
'type' => 'varchar',
|
409
|
'length' => '255',
|
410
|
'description' => 'Administrative category for this layout.',
|
411
|
),
|
412
|
'plugin' => array(
|
413
|
'type' => 'varchar',
|
414
|
'length' => '255',
|
415
|
'description' => 'The layout plugin that owns this layout.',
|
416
|
),
|
417
|
'settings' => array(
|
418
|
'type' => 'text',
|
419
|
'size' => 'big',
|
420
|
'description' => 'Serialized settings for the actual layout. The contents of this field are up to the plugin that uses it.',
|
421
|
'serialize' => TRUE,
|
422
|
'object default' => array(),
|
423
|
),
|
424
|
),
|
425
|
'primary key' => array('lid'),
|
426
|
);
|
427
|
|
428
|
return $schema;
|
429
|
}
|
430
|
|
431
|
/**
|
432
|
* Change panels_display.layout to match the size of panels_layout.name.
|
433
|
*/
|
434
|
function panels_update_7300() {
|
435
|
// Load the schema.
|
436
|
$schema = panels_schema_3();
|
437
|
$table = 'panels_display';
|
438
|
$field = 'layout';
|
439
|
$spec = $schema[$table]['fields'][$field];
|
440
|
|
441
|
// Re-define the column.
|
442
|
db_change_field($table, $field, $field, $spec);
|
443
|
|
444
|
return t('Changed the panels_display.layout field to the correct size.');
|
445
|
}
|
446
|
|
447
|
/**
|
448
|
* Add lock field to panels_pane table.
|
449
|
*/
|
450
|
function panels_update_7301() {
|
451
|
// Load the schema.
|
452
|
// Due to a previous failure, the field may already exist:
|
453
|
$schema = panels_schema_4();
|
454
|
$table = 'panels_pane';
|
455
|
$field = 'locks';
|
456
|
|
457
|
if (!db_field_exists($table, $field)) {
|
458
|
$spec = $schema[$table]['fields'][$field];
|
459
|
|
460
|
// Core does not properly respect 'initial' and 'serialize'.
|
461
|
unset($spec['initial']);
|
462
|
|
463
|
// Re-define the column.
|
464
|
db_add_field($table, $field, $spec);
|
465
|
return t('Added panels_pane.lock field.');
|
466
|
}
|
467
|
|
468
|
return t('panels_pane.lock field already existed, update skipped.');
|
469
|
}
|
470
|
|
471
|
/**
|
472
|
* Adding universally unique identifiers to panels.
|
473
|
*
|
474
|
* Note: This update hook is not written well. It calls apis which uses the
|
475
|
* most updated drupal database, causing missing columns or tables errors. To
|
476
|
* mitigate the issue, we've added updates from 7303 and 7305. Future updates
|
477
|
* should go below the 7305 update.
|
478
|
*
|
479
|
* See https://www.drupal.org/node/2787123 for more info.
|
480
|
*/
|
481
|
function panels_update_7302() {
|
482
|
if (!module_load_include('inc', 'ctools', 'includes/uuid')) {
|
483
|
throw new DrupalUpdateException(t('Ctools UUID support not detected. You must update to a more recent version of the ctools module.'));
|
484
|
}
|
485
|
// Run the 7303 update first to avoid caching issues.
|
486
|
// This *probably* should be placed right above update 7305, however it was
|
487
|
// tested here and re-testing this update is difficult, so it stays here.
|
488
|
panels_update_7303();
|
489
|
|
490
|
// Load the schema.
|
491
|
$schema = panels_schema_5();
|
492
|
$msg = array();
|
493
|
|
494
|
// Add the uuid column to the pane table.
|
495
|
$table = 'panels_pane';
|
496
|
$field = 'uuid';
|
497
|
// Due to a previous failure, the column may already exist:
|
498
|
if (!db_field_exists($table, $field)) {
|
499
|
$spec = $schema[$table]['fields'][$field];
|
500
|
db_add_field($table, $field, $spec);
|
501
|
$msg[] = t('Added panels_pane.uuid column.');
|
502
|
}
|
503
|
|
504
|
// Add the uuid column to the display table.
|
505
|
$table = 'panels_display';
|
506
|
$field = 'uuid';
|
507
|
// Due to a previous failure, the column may already exist:
|
508
|
if (!db_field_exists($table, $field)) {
|
509
|
$spec = $schema[$table]['fields'][$field];
|
510
|
db_add_field($table, $field, $spec);
|
511
|
$msg[] = t('Added panels_display.uuid column.');
|
512
|
}
|
513
|
|
514
|
if (empty($msg)) {
|
515
|
$msg[] = t('UUID column already present in the panels_display & panels_pane tables.');
|
516
|
}
|
517
|
|
518
|
// Update all DB-based panes & displays to ensure that they all contain a UUID.
|
519
|
$display_dids = db_select('panels_display')
|
520
|
->fields('panels_display', array('did'))
|
521
|
->condition(db_or()
|
522
|
->condition('uuid', '')
|
523
|
->isNull('uuid')
|
524
|
)
|
525
|
->execute()
|
526
|
->fetchCol();
|
527
|
|
528
|
// Check the panes as well, for paranoia.
|
529
|
$pane_dids = db_select('panels_pane')
|
530
|
->distinct()
|
531
|
->fields('panels_pane', array('did'))
|
532
|
->condition(db_or()
|
533
|
->condition('uuid', '')
|
534
|
->isNull('uuid')
|
535
|
)
|
536
|
->execute()
|
537
|
->fetchCol();
|
538
|
|
539
|
$dids = array_unique(array_merge($display_dids, $pane_dids));
|
540
|
|
541
|
// Before using panels_save_display(), we have to make sure any new fields
|
542
|
// are added from future updates.
|
543
|
panels_update_7305();
|
544
|
|
545
|
// If the Panels module is disabled we don't have access to
|
546
|
// panels_load_displays().
|
547
|
if (!function_exists('panels_load_displays')) {
|
548
|
module_load_include('module', 'panels');
|
549
|
}
|
550
|
if ($displays = panels_load_displays($dids)) {
|
551
|
foreach ($displays as $display) {
|
552
|
// A display save also triggers pane saves.
|
553
|
panels_save_display($display);
|
554
|
}
|
555
|
$msg[] = t('Generated UUIDs for database-based panel displays and panes.');
|
556
|
}
|
557
|
else {
|
558
|
$msg[] = t('No database-based panel displays or panes for which to generate UUIDs.');
|
559
|
}
|
560
|
|
561
|
return implode("\n", $msg);
|
562
|
}
|
563
|
|
564
|
/**
|
565
|
* Add a custom cache table for Panels.
|
566
|
*/
|
567
|
function panels_update_7303() {
|
568
|
$schema = panels_schema_6();
|
569
|
|
570
|
$table_name = 'cache_panels';
|
571
|
if (!db_table_exists($table_name)) {
|
572
|
db_create_table($table_name, $schema[$table_name]);
|
573
|
}
|
574
|
}
|
575
|
|
576
|
/**
|
577
|
* Update "panels_pane" table field lengths to 255 chars.
|
578
|
*/
|
579
|
function panels_update_7304() {
|
580
|
$schema = panels_schema_7();
|
581
|
|
582
|
$update_fields = array(
|
583
|
'panels_pane' => array('subtype', 'panel', 'type'),
|
584
|
);
|
585
|
|
586
|
foreach ($update_fields as $table => $fields) {
|
587
|
foreach ($fields as $field_name) {
|
588
|
db_change_field($table, $field_name, $field_name, $schema[$table]['fields'][$field_name]);
|
589
|
}
|
590
|
}
|
591
|
}
|
592
|
|
593
|
/**
|
594
|
* Add the "storage_type" and "storage_id" columns to "panels_display".
|
595
|
*/
|
596
|
function panels_update_7305() {
|
597
|
$schema = panels_schema_8();
|
598
|
|
599
|
$new_fields = array(
|
600
|
'panels_display' => array('storage_type', 'storage_id'),
|
601
|
);
|
602
|
|
603
|
foreach ($new_fields as $table => $fields) {
|
604
|
foreach ($fields as $field_name) {
|
605
|
// Due to a previous failure, the column may already exist:
|
606
|
if (!db_field_exists($table, $field_name)) {
|
607
|
db_add_field($table, $field_name, $schema[$table]['fields'][$field_name]);
|
608
|
}
|
609
|
}
|
610
|
}
|
611
|
}
|
612
|
|
613
|
/**
|
614
|
* Set the storage type and id on existing page manager panels displays.
|
615
|
*/
|
616
|
function panels_update_7306() {
|
617
|
if (!db_table_exists('page_manager_handlers')) {
|
618
|
return t('Skipping update - page_manager is not installed.');
|
619
|
}
|
620
|
|
621
|
// Get all page_manager_handlers that have a panels context.
|
622
|
$result = db_query("SELECT pm.name, pm.conf FROM {page_manager_handlers} pm WHERE pm.handler = 'panel_context'");
|
623
|
$page_manager_panels = array();
|
624
|
foreach ($result as $row) {
|
625
|
$conf = unserialize($row->conf);
|
626
|
if (isset($conf['did'])) {
|
627
|
$page_manager_panels[$conf['did']] = $row->name;
|
628
|
}
|
629
|
}
|
630
|
|
631
|
if (!empty($page_manager_panels)) {
|
632
|
// Check panels displays that only have empty storage types.
|
633
|
$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)));
|
634
|
foreach ($result as $row) {
|
635
|
db_update('panels_display')
|
636
|
->fields(array(
|
637
|
'storage_type' => 'page_manager',
|
638
|
'storage_id' => $page_manager_panels[$row->did],
|
639
|
))
|
640
|
->condition('did', $row->did)
|
641
|
->execute();
|
642
|
}
|
643
|
}
|
644
|
}
|
645
|
|
646
|
/**
|
647
|
* Add a custom table for allowed types.
|
648
|
*/
|
649
|
function panels_update_7307() {
|
650
|
$schema = panels_schema_9();
|
651
|
|
652
|
$table_name = 'panels_allowed_types';
|
653
|
if (!db_table_exists($table_name)) {
|
654
|
db_create_table($table_name, $schema[$table_name]);
|
655
|
}
|
656
|
|
657
|
/*
|
658
|
The version of this update hook in release 3.8 included code that
|
659
|
converted storage of allowed_types configuration from variables to the new
|
660
|
table, and also deleted existing allowed_types configuration variables.
|
661
|
See https://www.drupal.org/node/2479879.
|
662
|
|
663
|
In order to prevent data loss on sites that had not yet updated to 3.8, the
|
664
|
conversion and variable-deletion code has been removed from this update hook.
|
665
|
*/
|
666
|
}
|
667
|
|
668
|
/**
|
669
|
* Rename style permissions.
|
670
|
*/
|
671
|
function panels_update_7308() {
|
672
|
$permissions = array(
|
673
|
'administer panels display styles',
|
674
|
'administer panels pane styles',
|
675
|
'administer panels region styles',
|
676
|
);
|
677
|
foreach (array_keys(user_roles(TRUE, 'administer panels styles')) as $rid) {
|
678
|
user_role_grant_permissions($rid, $permissions);
|
679
|
}
|
680
|
}
|