| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: panels.install,v 1.4.2.40 2010/10/19 20:42:32 merlinofchaos Exp $ 3 4 /** 5 * Test requirements for installation and running. 6 */ 7 function panels_requirements($phase) { 8 $function = "panels_requirements_$phase"; 9 return function_exists($function) ? $function() : array(); 10 } 11 12 /** 13 * Check install-time requirements. 14 */ 15 function panels_requirements_install() { 16 $requirements = array(); 17 $t = get_t(); 18 // Assume that if the user is running an installation profile that both 19 // Panels and CTools are the same release. 20 if (!(defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install')) { 21 // apparently the install process doesn't include .module files, 22 // so we need to force the issue in order for our versioning 23 // check to work. 24 if (!defined('PANELS_REQUIRED_CTOOLS_API')) { 25 include_once drupal_get_path('module', 'panels') . '/panels.module'; 26 } 27 28 // In theory we should check module_exists, but Drupal's gating should 29 // actually prevent us from getting here otherwise. 30 if (!defined('CTOOLS_API_VERSION')) { 31 include_once drupal_get_path('module', 'ctools') . '/ctools.module'; 32 } 33 if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) { 34 $requirements['panels_ctools'] = array( 35 'title' => $t('CTools API Version'), 36 'value' => CTOOLS_API_VERSION, 37 'severity' => REQUIREMENT_ERROR, 38 'description' => t('The CTools API version is too old for Panels. Panels needs at least %version.', array('%version' => PANELS_REQUIRED_CTOOLS_API)) 39 ); 40 } 41 } 42 return $requirements; 43 } 44 45 /** 46 * Check runtime requirements (status report). 47 */ 48 function panels_requirements_runtime() { 49 $requirements = array(); 50 $legacy = panels_get_legacy_state(); 51 $t = get_t(); 52 $state = $legacy->getStatus(); 53 if (empty($state)) { 54 $requirements['panels_legacy'] = array( 55 'title' => $t('Panels operating normally'), 56 'value' => NULL, 57 'severity' => REQUIREMENT_OK, 58 'description' => $t('Panels is operating normally - no out-of-date plugins or modules are forcing it into legacy mode'), 59 ); 60 } 61 else { 62 $description = $t("Panels is operating in Legacy mode due to the following issues:\n"); 63 64 // Add the reasons why Panels is acting in legacy mode. 65 $list = array(); 66 foreach ($state as $values) { 67 $modules = array(); 68 foreach ($values['modules'] as $module => $type) { 69 $modules[] = array('data' => check_plain($module) . ' - ' . $type); 70 } 71 72 $list[] = array('data' => $values['explanation'] ."\n" . theme('item_list', $modules)); 73 } 74 75 $description .= theme('item_list', $list); 76 77 $requirements['panels_legacy'] = array( 78 'title' => $t('Panels operating in Legacy mode'), 79 'value' => NULL, 80 'severity' => REQUIREMENT_WARNING, 81 'description' => $description, 82 ); 83 } 84 return $requirements; 85 } 86 87 /** 88 * Implementation of hook_schema(). 89 */ 90 function panels_schema() { 91 // This should always point to our 'current' schema. This makes it relatively easy 92 // to keep a record of schema as we make changes to it. 93 return panels_schema_3(); 94 } 95 96 /** 97 * Schema that adds the panels_layout table. 98 */ 99 function panels_schema_3() { 100 // Schema 3 is now locked. If you need to make changes, please create 101 // schema 4 and add them. 102 $schema = panels_schema_2(); 103 104 $schema['panels_renderer_pipeline'] = array( 105 'description' => 'Contains renderer pipelines for Panels. Each pipeline contains one or more renderers and access rules to select which renderer gets used.', 106 'export' => array( 107 'identifier' => 'pipeline', 108 'bulk export' => TRUE, 109 'primary key' => 'rpid', 110 'api' => array( 111 'owner' => 'panels', 112 'api' => 'pipelines', 113 'minimum_version' => 1, 114 'current_version' => 1, 115 ), 116 ), 117 'fields' => array( 118 'rpid' => array( 119 'type' => 'serial', 120 'description' => 'A database primary key to ensure uniqueness.', 121 'not null' => TRUE, 122 'no export' => TRUE, 123 ), 124 'name' => array( 125 'type' => 'varchar', 126 'length' => '255', 127 'description' => 'Unique ID for this content. Used to identify it programmatically.', 128 ), 129 'admin_title' => array( 130 'type' => 'varchar', 131 'length' => '255', 132 'description' => 'Administrative title for this pipeline.', 133 ), 134 'admin_description' => array( 135 'type' => 'text', 136 'size' => 'big', 137 'description' => 'Administrative description for this pipeline.', 138 'object default' => '', 139 ), 140 'weight' => array( 141 'type' => 'int', 142 'size' => 'small', 143 'default' => 0, 144 ), 145 'settings' => array( 146 'type' => 'text', 147 'size' => 'big', 148 'description' => 'Serialized settings for the actual pipeline. The contents of this field are up to the plugin that uses it.', 149 'serialize' => TRUE, 150 'object default' => array(), 151 ), 152 ), 153 'primary key' => array('rpid'), 154 ); 155 156 $schema['panels_layout'] = array( 157 'description' => 'Contains exportable customized layouts for this site.', 158 'export' => array( 159 'identifier' => 'layout', 160 'bulk export' => TRUE, 161 'primary key' => 'lid', 162 'api' => array( 163 'owner' => 'panels', 164 'api' => 'layouts', 165 'minimum_version' => 1, 166 'current_version' => 1, 167 ), 168 ), 169 'fields' => array( 170 'lid' => array( 171 'type' => 'serial', 172 'description' => 'A database primary key to ensure uniqueness.', 173 'not null' => TRUE, 174 'no export' => TRUE, 175 ), 176 'name' => array( 177 'type' => 'varchar', 178 'length' => '255', 179 'description' => 'Unique ID for this content. Used to identify it programmatically.', 180 ), 181 'admin_title' => array( 182 'type' => 'varchar', 183 'length' => '255', 184 'description' => 'Administrative title for this layout.', 185 ), 186 'admin_description' => array( 187 'type' => 'text', 188 'size' => 'big', 189 'description' => 'Administrative description for this layout.', 190 'object default' => '', 191 ), 192 'category' => array( 193 'type' => 'varchar', 194 'length' => '255', 195 'description' => 'Administrative category for this layout.', 196 ), 197 'plugin' => array( 198 'type' => 'varchar', 199 'length' => '255', 200 'description' => 'The layout plugin that owns this layout.', 201 ), 202 'settings' => array( 203 'type' => 'text', 204 'size' => 'big', 205 'description' => 'Serialized settings for the actual layout. The contents of this field are up to the plugin that uses it.', 206 'serialize' => TRUE, 207 'object default' => array(), 208 ), 209 ), 210 'primary key' => array('lid'), 211 ); 212 213 return $schema; 214 } 215 216 /** 217 * Schema that adds the title_pane field. 218 */ 219 function panels_schema_2() { 220 $schema = panels_schema_1(); 221 222 $schema['panels_display']['fields']['title_pane'] = array( 223 'type' => 'int', 224 'default' => 0, 225 'no export' => TRUE, 226 ); 227 228 return $schema; 229 } 230 231 /** 232 * Schema version 1 for Panels in D6. 233 * 234 * Schema v1 is now LOCKED; any changes should be done via panels_schema_2. 235 */ 236 function panels_schema_1() { 237 $schema = array(); 238 239 $schema['panels_display'] = array( 240 'export' => array( 241 'object' => 'panels_display', 242 'bulk export' => FALSE, 243 'export callback' => 'panels_export_display', 244 'can disable' => FALSE, 245 'identifier' => 'display', 246 ), 247 'fields' => array( 248 'did' => array( 249 'type' => 'serial', 250 'not null' => TRUE, 251 'no export' => TRUE, 252 ), 253 'layout' => array( 254 'type' => 'varchar', 255 'length' => '32', 256 'default' => '', 257 ), 258 'layout_settings' => array( 259 'type' => 'text', 260 'size' => 'big', 261 'serialize' => TRUE, 262 'object default' => array(), 263 'initial ' => array(), 264 ), 265 'panel_settings' => array( 266 'type' => 'text', 267 'size' => 'big', 268 'serialize' => TRUE, 269 'object default' => array(), 270 'initial ' => array(), 271 ), 272 'cache' => array( 273 'type' => 'text', 274 'serialize' => TRUE, 275 'object default' => array(), 276 'initial ' => array(), 277 ), 278 'title' => array( 279 'type' => 'varchar', 280 'length' => '255', 281 'default' => '', 282 ), 283 'hide_title' => array( 284 'type' => 'int', 285 'size' => 'tiny', 286 'default' => 0, 287 'no export' => TRUE, 288 ), 289 ), 290 'primary key' => array('did'), 291 ); 292 293 $schema['panels_pane'] = array( 294 'export' => array( 295 'can disable' => FALSE, 296 'identifier' => 'pane', 297 'bulk export' => FALSE, 298 ), 299 'fields' => array( 300 'pid' => array( 301 'type' => 'serial', 302 'not null' => TRUE, 303 ), 304 'did' => array( 305 'type' => 'int', 306 'not null' => TRUE, 307 'default' => 0, 308 'no export' => TRUE, 309 ), 310 'panel' => array( 311 'type' => 'varchar', 312 'length' => '32', 313 'default' => '', 314 ), 315 'type' => array( 316 'type' => 'varchar', 317 'length' => '32', 318 'default' => '', 319 ), 320 'subtype' => array( 321 'type' => 'varchar', 322 'length' => '64', 323 'default' => '', 324 ), 325 'shown' => array( 326 'type' => 'int', 327 'size' => 'tiny', 328 'default' => 1, 329 ), 330 'access' => array( 331 'type' => 'text', 332 'size' => 'big', 333 'serialize' => TRUE, 334 'object default' => array(), 335 'initial ' => array(), 336 ), 337 'configuration' => array( 338 'type' => 'text', 339 'size' => 'big', 340 'serialize' => TRUE, 341 'object default' => array(), 342 'initial ' => array(), 343 ), 344 'cache' => array( 345 'type' => 'text', 346 'size' => 'big', 347 'serialize' => TRUE, 348 'object default' => array(), 349 'initial ' => array(), 350 ), 351 'style' => array( 352 'type' => 'text', 353 'size' => 'big', 354 'serialize' => TRUE, 355 'object default' => array(), 356 'initial ' => array(), 357 ), 358 'css' => array( 359 'type' => 'text', 360 'size' => 'big', 361 'serialize' => TRUE, 362 'object default' => array(), 363 'initial ' => array(), 364 ), 365 'extras' => array( 366 'type' => 'text', 367 'size' => 'big', 368 'serialize' => TRUE, 369 'object default' => array(), 370 'initial ' => array(), 371 ), 372 'position' => array( 373 'type' => 'int', 374 'size' => 'small', 375 'default' => 0, 376 ), 377 ), 378 'primary key' => array('pid'), 379 'indexes' => array( 380 'did_idx' => array('did') 381 ), 382 ); 383 384 return $schema; 385 } 386 387 /** 388 * Implementation of hook_install(). 389 */ 390 function panels_install() { 391 drupal_install_schema('panels'); 392 } 393 394 /** 395 * Implementation of hook_uninstall(). 396 */ 397 function panels_uninstall() { 398 drupal_uninstall_schema('panels'); 399 } 400 401 function panels_update_1000() { 402 // Panels D6 2 had *no* update functions in it, so the schema version is 403 // completely wrong. If we run this update with no schema version, we 404 // were actually that version and we must therefore skip to the proper 405 // update. 406 if (db_table_exists('panels_pane')) { 407 $GLOBALS['SKIP_PANELS_UPDATES'] = TRUE; 408 return array(); 409 } 410 $ret = array(); 411 412 $ret[] = update_sql("ALTER TABLE {panels_info} RENAME {panels_page}"); 413 $ret[] = update_sql("ALTER TABLE {panels_page} CHANGE COLUMN did pid int(10) NOT NULL DEFAULT 0;"); 414 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN did int(10) NOT NULL DEFAULT 0 AFTER pid"); 415 $ret[] = update_sql("UPDATE {panels_page} SET did = pid"); 416 417 $max_pid = db_result(db_query("SELECT MAX(pid) FROM {panels_page}")); 418 if ($max_pid) { 419 $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{panels_page}_pid', $max_pid)"); 420 } 421 422 $ret[] = update_sql("ALTER TABLE {panels_area} RENAME {panels_pane}"); 423 $ret[] = update_sql("ALTER TABLE {panels_pane} ADD COLUMN pid int(10) NOT NULL DEFAULT 0 FIRST"); 424 $ret[] = update_sql("ALTER TABLE {panels_pane} CHANGE area panel varchar(32)"); 425 $result = db_query("SELECT * FROM {panels_pane}"); 426 while ($pane = db_fetch_object($result)) { 427 $count++; 428 $ret[] = update_sql("UPDATE {panels_pane} SET pid = $count WHERE did = $pane->did AND panel = '$pane->panel' AND position = $pane->position"); 429 } 430 if ($count) { 431 $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{panels_pane}_pid', $count)"); 432 } 433 434 $ret[] = update_sql(<<<EOT 435 CREATE TABLE {panels_display} ( 436 did INT(10) NOT NULL DEFAULT 0 PRIMARY KEY, 437 layout VARCHAR(32) 438 ) /*!40100 DEFAULT CHARACTER SET utf8 */ 439 EOT 440 ); 441 $result = db_query("SELECT did, layout FROM {panels_page}"); 442 $max_did = 0; 443 while ($display = db_fetch_object($result)) { 444 $ret[] = update_sql("INSERT INTO {panels_display} VALUES ($display->did, '$display->layout')"); 445 if ($display->did > $max_did) { 446 $max_did = $display->did; 447 } 448 } 449 $ret[] = update_sql("ALTER TABLE {panels_page} DROP COLUMN layout"); 450 if ($max_did) { 451 $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{panels_display}_did', $max_did)"); 452 } 453 return $ret; 454 } 455 456 function panels_update_1001() { 457 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 458 return array(); 459 } 460 $ret = array(); 461 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN no_blocks int(1)"); 462 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN menu int(1) DEFAULT 0"); 463 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN menu_tab int(1)"); 464 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN menu_tab_weight int(4)"); 465 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN menu_title varchar(255)"); 466 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN menu_tab_default int(1)"); 467 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN menu_tab_default_parent_type varchar(10)"); 468 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN menu_parent_title varchar(255)"); 469 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN menu_parent_tab_weight int(4)"); 470 return $ret; 471 } 472 473 // Create a field for the layout settings 474 function panels_update_1002() { 475 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 476 return array(); 477 } 478 $ret = array(); 479 $ret[] = update_sql("ALTER TABLE {panels_display} ADD COLUMN layout_settings longtext"); 480 $ret[] = update_sql("ALTER TABLE {panels_pane} ADD COLUMN access varchar(128) AFTER type"); 481 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN css longtext AFTER css_id"); 482 return $ret; 483 } 484 485 // Create a field for the panel settings. 486 function panels_update_1003() { 487 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 488 return array(); 489 } 490 $ret = array(); 491 $ret[] = update_sql("ALTER TABLE {panels_display} ADD COLUMN panel_settings longtext"); 492 return $ret; 493 } 494 495 // Kept up updates from older versions of Panels 2 for D5 to smooth updates. 496 // Create a field for the panel settings. 497 // Renumbering to proper numbering scheme. 498 function panels_update_5204() { 499 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 500 return array(); 501 } 502 $ret = array(); 503 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN name varchar(255) UNIQUE"); 504 $ret[] = update_sql("ALTER TABLE {panels_display} ADD COLUMN name varchar(255) UNIQUE"); 505 // Give all our panels a name. 506 $ret[] = update_sql("UPDATE {panels_page} SET name = CONCAT('panel_page_', pid)"); 507 $ret[] = update_sql("UPDATE {panels_display} SET name = CONCAT('display_', did)"); 508 return $ret; 509 } 510 511 // Add the arguments field 512 function panels_update_5205() { 513 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 514 return array(); 515 } 516 $ret = array(); 517 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN arguments longtext"); 518 return $ret; 519 } 520 521 // Add a field so that panes can remember their subtype so we can retrieve 522 // context information about it. 523 function panels_update_5206() { 524 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 525 return array(); 526 } 527 $ret = array(); 528 $ret[] = update_sql("ALTER TABLE {panels_pane} ADD COLUMN subtype varchar(64)"); 529 return $ret; 530 } 531 532 // Add fields for displays and extra contexts 533 function panels_update_5207() { 534 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 535 return array(); 536 } 537 $ret = array(); 538 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN displays longtext"); 539 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN contexts longtext"); 540 return $ret; 541 } 542 543 // Correct the mistaken {panels_display}_id when it should be {panels_display}_did 544 function panels_update_5208() { 545 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 546 return array(); 547 } 548 $ret = array(); 549 $count = db_result(db_query("SELECT MAX(did) FROM {panels_display}")); 550 $ret[] = update_sql("DELETE FROM {sequences} WHERE name = '{panels_display}_did'"); 551 $ret[] = update_sql("DELETE FROM {sequences} WHERE name = '{panels_display}_id'"); 552 if ($count) { 553 $ret[] = update_sql("INSERT INTO {sequences} (name, id) VALUES ('{panels_display}_did', 554 $count)"); 555 } 556 557 return $ret; 558 } 559 560 // Update argument, relationship and context code to be more correct. 561 function panels_update_5209() { 562 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 563 return array(); 564 } 565 $ret = array(); 566 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN relationships longtext"); 567 $result = db_query("SELECT * FROM {panels_page}"); 568 569 // This code removed due to call to panels_get_argument(). People with 570 // older versions will just have to suffer. 571 return $ret; 572 ctools_include('plugins', 'panels'); 573 574 while ($page = db_fetch_object($result)) { 575 $args = unserialize($page->arguments); 576 $arguments = $ids = $keywords = array(); 577 if (!empty($args)) { 578 // Update each argument 579 foreach ($args as $id => $argument) { 580 $name = $argument['name']; 581 $info = panels_get_argument($name); 582 if (!$info) { 583 continue; 584 } 585 // Make sure the id is valid 586 if (empty($argument['id'])) { 587 if (empty($ids[$name])) { 588 $ids[$name] = 1; 589 } 590 else { 591 $ids[$name]++; 592 } 593 594 $argument['id'] = $ids[$name]; 595 } 596 597 // Give it an identifier if it doesn't already have one 598 if (empty($argument['identifier'])) { 599 $argument['identifier'] = $info['title'] . ($id > 1 ? ' ' . $id : ''); 600 } 601 602 // Give it a unique keyword if it doesn't already have one 603 if (empty($argument['keyword'])) { 604 $keyword = $base = $info['keyword']; 605 $count = 0; 606 while (!empty($keywords[$keyword])) { 607 $keyword = $base . '_' . ++$count; 608 } 609 $keywords[$keyword] = TRUE; 610 $argument['keyword'] = $keyword; 611 } 612 $arguments[$id] = $argument; 613 } 614 } 615 // Move old relationships (stored as contexts) to relationships, where 616 // the belong 617 $rels = unserialize($page->contexts); 618 // Not resetting $keywords! 619 $relationships = $ids = array(); 620 if (!empty($rels)) { 621 foreach ($rels as $id => $relationship) { 622 $name = $relationship['name']; 623 $info = panels_get_relationship($name); 624 if (!$info) { 625 continue; 626 } 627 // Make sure the id is valid 628 if (empty($relationship['id'])) { 629 if (empty($ids[$name])) { 630 $ids[$name] = 1; 631 } 632 else { 633 $ids[$name]++; 634 } 635 636 $relationship['id'] = $ids[$name]; 637 } 638 639 // Give it an identifier if it doesn't already have one 640 if (empty($relationship['identifier'])) { 641 $relationship['identifier'] = $info['title'] . ($id > 1 ? ' ' . $id : ''); 642 } 643 644 // Give it a unique keyword if it doesn't already have one 645 if (empty($relationship['keyword'])) { 646 $keyword = $base = $info['keyword']; 647 $count = 0; 648 while (!empty($keywords[$keyword])) { 649 $keyword = $base . '_' . ++$count; 650 } 651 $keywords[$keyword] = TRUE; 652 $relationship['keyword'] = $keyword; 653 } 654 $relationships[$id] = $relationship; 655 } 656 } 657 db_query("UPDATE {panels_page} " . 658 "SET arguments = '%s', " . 659 "relationships = '%s', " . 660 "contexts = '%s' " . 661 "WHERE pid = $page->pid", serialize($arguments), serialize($relationships), serialize(array()), $page->pid 662 ); 663 } 664 return $ret; 665 } 666 667 function panels_update_5210() { 668 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 669 return array(); 670 } 671 $ret = array(); 672 $ret[] = update_sql("UPDATE {system} SET weight = 10 WHERE name = 'panels'"); 673 return $ret; 674 } 675 676 /** 677 * Force a menu update 678 */ 679 function panels_update_5211() { 680 // menu_rebuild(); 681 return array(); 682 } 683 684 /** 685 * Add a field to store pane caching information. 686 */ 687 function panels_update_5213() { 688 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 689 return array(); 690 } 691 $ret = array(); 692 switch ($GLOBALS['db_type']) { 693 case 'mysql': 694 case 'mysqli': 695 $ret[] = update_sql("ALTER TABLE {panels_pane} ADD COLUMN cache longtext AFTER configuration"); 696 $ret[] = update_sql("ALTER TABLE {panels_display} ADD COLUMN cache longtext AFTER panel_settings"); 697 break; 698 699 case 'pgsql': 700 db_add_column($ret, 'panels_pane', 'cache', 'text'); 701 db_add_column($ret, 'panels_display', 'cache', 'text'); 702 } 703 return $ret; 704 } 705 706 /** 707 * Create a new table for object caching. This isn't part of the cache 708 * system. 709 */ 710 function panels_update_5214() { 711 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 712 return array(); 713 } 714 $ret = array(); 715 return $ret; 716 switch ($GLOBALS['db_type']) { 717 case 'mysql': 718 case 'mysqli': 719 $ret[] = update_sql(<<<EOT 720 CREATE TABLE {panels_object_cache} ( 721 sid varchar(64), 722 did integer, 723 obj varchar(255), 724 timestamp integer, 725 data text, 726 KEY (sid, obj, did), 727 KEY (timestamp) 728 ) /*!40100 DEFAULT CHARACTER SET utf8 */ 729 EOT 730 ); 731 case 'pgsql': 732 } 733 return !empty($ret) ? $ret : $ret; 734 } 735 736 /** 737 * Increase the size of the data column in the {panels_object_cache} table 738 * on MySQL. 739 * 740 * Also gets rid of some duplicate indexes resulting the CREATE TABLE queries 741 * in the install() of schema 5214 742 */ 743 function panels_update_5215() { 744 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 745 return array(); 746 } 747 $ret = array(); 748 switch ($GLOBALS['db_type']) { 749 case 'mysql': 750 case 'mysqli': 751 $ret[] = update_sql("ALTER TABLE {panels_pane} ADD PRIMARY KEY (pid)"); 752 break; 753 754 case 'pgsql': 755 $ret[] = update_sql("ALTER TABLE {panels_pane} ADD PRIMARY KEY (pid)"); 756 } 757 return $ret; 758 } 759 760 /** 761 * Adds the 'shown' field to the panels_pane table in order to accomodate 762 * the new show/hide panes feature. 763 */ 764 function panels_update_5216() { 765 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 766 return array(); 767 } 768 $ret = array(); 769 switch ($GLOBALS['db_type']) { 770 case 'mysql': 771 case 'mysqli': 772 $ret[] = update_sql("ALTER TABLE {panels_pane} ADD COLUMN shown int(1) DEFAULT 1 AFTER subtype"); 773 $ret[] = update_sql("ALTER TABLE {panels_display} ADD COLUMN title varchar(128) AFTER cache"); 774 $ret[] = update_sql("ALTER TABLE {panels_display} ADD COLUMN hide_title int(1) AFTER title"); 775 $ret[] = update_sql("ALTER TABLE {panels_display} DROP COLUMN name"); 776 $ret[] = update_sql("ALTER TABLE {panels_pane} ADD COLUMN visibility text AFTER access"); 777 break; 778 779 case 'pgsql': 780 db_add_column($ret, 'panels_pane', 'shown', 'tinyint', array('default' => 1)); 781 db_add_column($ret, 'panels_display', 'title', 'varchar(128)'); 782 db_add_column($ret, 'panels_display', 'hide_title', 'tinyint', array('default' => 0)); 783 $ret = update_sql("ALTER TABLE {panels_display} DROP name"); 784 db_add_column($ret, 'panels_pane', 'visibility', 'text'); 785 } 786 return $ret; 787 } 788 789 /** 790 * Add the switcher fields to the database 791 */ 792 function panels_update_5217() { 793 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 794 return array(); 795 } 796 $ret = array(); 797 switch ($GLOBALS['db_type']) { 798 case 'mysql': 799 case 'mysqli': 800 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN switcher_type varchar(128) AFTER no_blocks"); 801 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN switcher_name varchar(128) AFTER no_blocks"); 802 $ret[] = update_sql("ALTER TABLE {panels_page} ADD COLUMN switcher_options longtext AFTER switcher_type"); 803 break; 804 805 case 'pgsql': 806 db_add_column($ret, 'panels_page', 'switcher_type', 'varchar(128)'); 807 db_add_column($ret, 'panels_page', 'switcher_name', 'varchar(128)'); 808 db_add_column($ret, 'panels_page', 'switcher_options', 'text'); 809 } 810 return $ret; 811 } 812 813 814 /** 815 * Oversight in 5216: 'tinyint' is not a field type in pgsql; the type we wanted 816 * was 'smallint.' 817 */ 818 function panels_update_5218() { 819 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 820 return array(); 821 } 822 $ret = array(); 823 switch ($GLOBALS['db_type']) { 824 case 'mysql': 825 case 'mysqli': 826 $ret[] = array('success' => TRUE, 'query' => t('Update #5218 only has changes for PostgreSQL. There are no updates for MySQL databases - since you\'re running MySQL, you should consider this update successful.')); 827 break; 828 829 case 'pgsql': 830 db_add_column($ret, 'panels_pane', 'shown', 'smallint', array('default' => 1)); 831 db_add_column($ret, 'panels_display', 'hide_title', 'smallint', array('default' => 0)); 832 $ret[] = array('success' => TRUE, 'query' => t('You can disregard failed attempts to add new columns in update #5216 as long as the two queries preceding this text were successful.')); 833 } 834 return $ret; 835 } 836 837 /** 838 * Update from 5.x v2 839 */ 840 function panels_update_5299() { 841 if (!empty($GLOBALS['SKIP_PANELS_UPDATES'])) { 842 return array(); 843 } 844 $ret = array(); 845 // Fetch schema version 1. 846 $schema = panels_schema_1(); 847 848 // Certain really old versions of Panels had errors that would cause invalid 849 // panes to be written. This wipes them so that the conversion won't fail: 850 $ret[] = update_sql("DELETE FROM {panels_pane} WHERE pid = 0"); 851 852 // update pid and did to be serial 853 db_drop_primary_key($ret, 'panels_pane'); 854 db_change_field($ret, 'panels_pane', 'pid', 'pid', $schema['panels_pane']['fields']['pid'], array('primary key' => array('pid'))); 855 db_drop_primary_key($ret, 'panels_display'); 856 db_change_field($ret, 'panels_display', 'did', 'did', $schema['panels_display']['fields']['did'], array('primary key' => array('did'))); 857 858 drupal_set_message(t('Please note that the Panels upgrade from Drupal 5 to Drupal 6 is far from perfect, especially where Views and CCK are involved. Please check all your panels carefully and compare them against the originals. You may need to do some rework to regain your original functionality.')); 859 860 return $ret; 861 } 862 863 /** 864 * Update from 6.x v2. 865 */ 866 function panels_update_6290() { 867 $ret = array(); 868 if (!module_exists('panels')) { 869 $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.')); 870 return $ret; 871 } 872 873 // Fetch schema version 1. 874 $schema = panels_schema_1(); 875 876 // Update size of pane 'access' field. 877 db_change_field($ret, 'panels_pane', 'access', 'access', $schema['panels_pane']['fields']['access']); 878 879 // Remove the no longer used visibility field 880 if (db_column_exists('panels_pane', 'visibility')) { 881 db_drop_field($ret, 'panels_pane', 'visibility'); 882 } 883 884 // Remove panels_object_cache table 885 if (db_table_exists('panels_object_cache')) { 886 db_drop_table($ret, 'panels_object_cache'); 887 } 888 889 // Doublecheck that ctools is enabled. If not, automatically disable the module. 890 if (!module_exists('ctools')) { 891 // Try to enable it: 892 drupal_install_modules(array('ctools')); 893 894 // If that fails, shut off all Panels. 895 if (!module_exists('ctools')) { 896 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.')); 897 module_disable(array('panels', 'panels_mini', 'panels_export', 'panels_node', 'panels_simple_cache')); 898 } 899 } 900 901 if (!module_exists('page_manager') && db_table_exists('panels_page')) { 902 drupal_set_message('Page manager module has been automatically enabled to replace the Panels pages module.'); 903 drupal_install_modules(array('page_manager')); 904 } 905 906 $ret[] = update_sql("DELETE FROM {system} WHERE name IN ('panels_page', 'panels_views')"); 907 908 return $ret; 909 } 910 911 /** 912 * Special update function for the alpha2 to alpha3 transition after 913 * I messed it up. 914 */ 915 function panels_update_6291() { 916 $ret = array(); 917 if (!module_exists('panels')) { 918 $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.')); 919 return $ret; 920 } 921 922 // Fetch schema version 1. 923 $schema = panels_schema_1(); 924 925 926 // Add some new fields 927 db_add_field($ret, 'panels_pane', 'style', $schema['panels_pane']['fields']['style']); 928 db_add_field($ret, 'panels_pane', 'css', $schema['panels_pane']['fields']['css']); 929 db_add_field($ret, 'panels_pane', 'extras', $schema['panels_pane']['fields']['extras']); 930 931 return $ret; 932 } 933 934 /** 935 * Update panels pane fields using batch API. 936 */ 937 function panels_update_6292(&$sandbox) { 938 $ret = array(); 939 if (!module_exists('panels')) { 940 $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.')); 941 return $ret; 942 } 943 944 if (!isset($sandbox['progress'])) { 945 $sandbox['progress'] = 0; 946 // We'll -1 to disregard the uid 0... 947 $sandbox['max'] = db_result(db_query('SELECT COUNT(*) FROM {panels_pane}')); 948 } 949 950 // configuration 951 $result = db_query_range("SELECT pid, access, configuration FROM {panels_pane} ORDER BY pid ASC", $sandbox['progress'], 20); 952 while ($pane = db_fetch_object($result)) { 953 // access 954 if (!empty($pane->access)) { 955 $rids = explode(', ', $pane->access); 956 // For safety, eliminate any non-numeric rids, as we occasionally had 957 // problems with nulls and such getting in here: 958 foreach ($rids as $id => $rid) { 959 if (!is_numeric($rid)) { 960 unset($rids[$id]); 961 } 962 } 963 964 if (empty($rids)) { 965 $pane->access = array(); 966 } 967 else { 968 // The old access style was just a role based system, so let's convert 969 // it to that. 970 $pane->access = array( 971 'plugins' => array( 972 array( 973 'name' => 'role', 974 'context' => 'logged-in-user', 975 'settings' => array( 976 'rids' => array_values($rids), 977 ) 978 ), 979 ), 980 ); 981 } 982 } 983 else { 984 $pane->access = array(); 985 } 986 987 // Move style from configuration. 988 $pane->configuration = unserialize($pane->configuration); 989 $pane->style = array(); 990 if (!empty($pane->configuration['style'])) { 991 $pane->style['style'] = $pane->configuration['style']; 992 unset($pane->configuration['style']); 993 } 994 995 $pane->css = array(); 996 // Move css configuration from configuration 997 if (isset($pane->configuration['css_id'])) { 998 $pane->css['css_id'] = $pane->configuration['css_id']; 999 unset($pane->configuration['css_id']); 1000 } 1001 1002 if (isset($pane->configuration['css_class'])) { 1003 $pane->css['css_class'] = $pane->configuration['css_class']; 1004 unset($pane->configuration['css_class']); 1005 } 1006 1007 // Make sure extras is an array. This isn't used by anything in Panels 1008 // yet, so an empty array is just fine. 1009 $pane->extras = array(); 1010 db_query("UPDATE {panels_pane} SET " . 1011 "access = '%s', css = '%s', style = '%s', configuration = '%s', extras = '%s'" . 1012 " WHERE pid = %d", 1013 serialize($pane->access), 1014 serialize($pane->css), 1015 serialize($pane->style), 1016 serialize($pane->configuration), 1017 serialize($pane->extras), 1018 $pane->pid); 1019 1020 $sandbox['progress']++; 1021 } 1022 1023 $ret['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']); 1024 if ($ret['#finished'] === 1) { 1025 $ret[] = array('success' => TRUE, 'query' => t('Panel panes were updated')); 1026 } 1027 return $ret; 1028 } 1029 1030 /** 1031 * Update panels display fields using batch API. 1032 */ 1033 function panels_update_6293(&$sandbox) { 1034 $ret = array(); 1035 if (!module_exists('panels')) { 1036 $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.')); 1037 return $ret; 1038 } 1039 1040 if (!isset($sandbox['progress'])) { 1041 $sandbox['progress'] = 0; 1042 // We'll -1 to disregard the uid 0... 1043 $sandbox['max'] = db_result(db_query('SELECT COUNT(*) FROM {panels_display}')); 1044 } 1045 1046 // configuration 1047 $result = db_query_range("SELECT did, panel_settings FROM {panels_display} ORDER BY did ASC", $sandbox['progress'], 20); 1048 while ($display = db_fetch_object($result)) { 1049 if (empty($display->panel_settings)) { 1050 $display->panel_settings = array(); 1051 } 1052 else { 1053 $display->panel_settings = unserialize($display->panel_settings); 1054 if (!is_array($display->panel_settings)) { 1055 $display->panel_settings = array(); 1056 } 1057 } 1058 1059 if (isset($display->panel_settings['panel'])) { 1060 foreach ($display->panel_settings['panel'] as $key => $settings) { 1061 $display->panel_settings[$key] = $settings; 1062 } 1063 unset($display->panel_settings['panel']); 1064 } 1065 1066 if (isset($display->panel_settings['individual'])) { 1067 unset($display->panel_settings['individual']); 1068 } 1069 1070 db_query("UPDATE {panels_display} SET " . 1071 "panel_settings = '%s'" . 1072 " WHERE did = %d", 1073 serialize($display->panel_settings), 1074 $display->did); 1075 1076 $sandbox['progress']++; 1077 } 1078 1079 $ret['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']); 1080 if ($ret['#finished'] === 1) { 1081 $ret[] = array('success' => TRUE, 'query' => t('Panel displays were updated')); 1082 } 1083 return $ret; 1084 } 1085 1086 /** 1087 * Establish a baseline schema version for 6.x-3.x 1088 */ 1089 function panels_update_6300() { 1090 return array(); 1091 } 1092 1093 function panels_update_6302() { 1094 $ret = array(); 1095 if (!module_exists('panels')) { 1096 $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.')); 1097 return $ret; 1098 } 1099 1100 if (!module_exists('page_manager') && db_table_exists('panels_page')) { 1101 $ret['#abort'] = array('success' => FALSE, 'query' => t('Conversion of panels pages cannot be completed without page manager module from CTools installed. Please install CTools, activate page manager, and attempt the update again.')); 1102 return $ret; 1103 } 1104 1105 if (!db_table_exists('panels_page')) { 1106 return $ret; 1107 } 1108 1109 // Store the node edit handlers because we merged the edit/add path and we 1110 // need to be able to keep these together to make sure the names work ok. 1111 $node_edit_handlers = array(); 1112 page_manager_get_task('page'); 1113 $result = db_query("SELECT * FROM {panels_page}"); 1114 while ($p = db_fetch_object($result)) { 1115 $page = page_manager_page_new(); 1116 $page->default_handlers = array(); 1117 // Should we check for uniqueness here? It doesn't seem really 1118 // plausible that there could be page manager pages already. 1119 $page->name = $p->name; 1120 $page->task = 'page'; // could become custom later. 1121 $page->subtask = $p->name; 1122 $page->admin_title = $p->name; 1123 $page->path = $p->path; 1124 // convert access 1125 if (!empty($p->access)) { 1126 $rids = explode(', ', $p->access); 1127 // For safety, eliminate any non-numeric rids, as we occasionally had 1128 // problems with nulls and such getting in here: 1129 foreach ($rids as $id => $rid) { 1130 if (!is_numeric($rid)) { 1131 unset($rids[$id]); 1132 } 1133 } 1134 1135 if (empty($rids)) { 1136 $page->access = array(); 1137 } 1138 else { 1139 // The old access style was just a role based system, so let's convert 1140 // it to that. 1141 $page->access = array( 1142 'plugins' => array( 1143 array( 1144 'name' => 'role', 1145 'context' => 'logged-in-user', 1146 'settings' => array( 1147 'rids' => array_values($rids), 1148 ) 1149 ), 1150 ), 1151 ); 1152 } 1153 } 1154 1155 // Convert menu stuff. 1156 $page->menu = array( 1157 'type' => 'none', 1158 'title' => '', 1159 'weight' => 0, 1160 'name' => 'navigation', 1161 'parent' => array( 1162 'type' => 'none', 1163 'title' => '', 1164 'weight' => 0, 1165 'name' => 'navigation', 1166 ), 1167 ); 1168 1169 if ($p->menu) { 1170 if ($p->menu_tab) { 1171 if ($p->menu_tab_default) { 1172 $page->menu['type'] = 'default tab'; 1173 $page->menu['parent']['type'] = $p->menu_tab_default_parent_type; 1174 $page->menu['parent']['title'] = $p->menu_parent_title; 1175 $page->menu['parent']['weight'] = $p->menu_parent_tab_weight; 1176 } 1177 else { 1178 $page->menu['type'] = 'tab'; 1179 } 1180 } 1181 else { 1182 $page->menu['type'] = 'normal'; 1183 } 1184 1185 $page->menu['title'] = $p->menu_title; 1186 $page->menu['weight'] = $p->menu_tab_weight; 1187 } 1188 1189 $page->conf = array(); 1190 $displays = unserialize($p->displays); 1191 $arguments = unserialize($p->arguments); 1192 1193 foreach ($arguments as $id => $argument) { 1194 $page->arguments[$argument['keyword']] = array( 1195 'name' => $argument['name'], 1196 'identifier' => $argument['identifier'], 1197 'title' => $argument['title'], 1198 'id' => $argument['id'], 1199 'settings' => isset($argument['argument_settings']) ? $argument['argument_settings'] : array(), 1200 ); 1201 1202 $match = FALSE; 1203 $bits = explode('/', $page->path); 1204 foreach ($bits as $pos => $bit) { 1205 if ($bit == '%') { 1206 $bits[$pos] = '%' . $argument['keyword']; 1207 $match = TRUE; 1208 $page->path = implode('/', $bits); 1209 break; 1210 } 1211 } 1212 1213 if (!$match) { 1214 if ($argument['default'] == '404') { 1215 $page->path .= '/%' . $argument['keyword']; 1216 } 1217 else { 1218 $page->path .= '/!' . $argument['keyword']; 1219 } 1220 } 1221 1222 // save this for later use. 1223 $arguments[$id]['context'] = 'argument_' . $argument['name'] . '_' . $argument['id']; 1224 } 1225 1226 // Reset the task type here if it's one of our overrides. This ensures 1227 // that we get the right names. 1228 switch ($p->path) { 1229 case 'node/%': 1230 $page->task = 'node_view'; 1231 $page->subtask = ''; 1232 variable_set('page_manager_node_view_disabled', FALSE); 1233 break; 1234 case 'node/add/%': 1235 // It seems nearly impossible to actually upgrade this properly. 1236 continue; 1237 case 'node/%/edit': 1238 // Could we get conflicts here if they had both? 1239 $page->task = 'node_edit'; 1240 $page->subtask = ''; 1241 variable_set('page_manager_node_edit_disabled', FALSE); 1242 break; 1243 case 'taxonomy/term': 1244 case 'taxonomy/term/%': 1245 $page->task = 'term_view'; 1246 $page->subtask = ''; 1247 if ($arguments[0]['name'] == 'term') { 1248 variable_set('page_manager_term_view_type', 'single'); 1249 } 1250 variable_set('page_manager_term_view_disabled', FALSE); 1251 break; 1252 case 'user/%': 1253 $page->task = 'user_view'; 1254 $page->subtask = ''; 1255 variable_set('page_manager_user_view_disabled', FALSE); 1256 break; 1257 // There is no default here. 1258 } 1259 1260 if (empty($displays)) { 1261 // only one display on this panel, mak 1262 $cache = new stdClass(); 1263 if ($page->task != 'node_edit') { 1264 $cache->handlers = array(); 1265 } 1266 else { 1267 $cache->handlers = $node_edit_handlers; 1268 } 1269 _panels_update_create_handler($page, $p, NULL, array('did' => $p->did, 'title' => t('Panel')), $arguments, 0, $cache); 1270 $page->default_handlers = $cache->handlers; 1271 } 1272 else { 1273 // for each display we need to create a new handler. 1274 $weight = 0; 1275 $cache = new stdClass(); 1276 if ($page->task != 'node_edit') { 1277 $cache->handlers = array(); 1278 } 1279 else { 1280 $cache->handlers = $node_edit_handlers; 1281 $weight = count($cache->handlers) + 1; 1282 } 1283 foreach ($displays as $origin => $info) { 1284 if (!isset($info['argument_id'])) { 1285 $info['argument_id'] = 0; 1286 } 1287 1288 _panels_update_create_handler($page, $p, $origin, $info, $arguments, $weight++, $cache); 1289 } 1290 1291 // Also add the primary display as a default with no selector. 1292 // _panels_update_create_handler($page, $p, NULL, array('did' => $p->did, 'title' => t('Default')), $arguments, $weight++, $cache); 1293 $page->default_handlers = $cache->handlers; 1294 } 1295 1296 if ($page->task != 'page') { 1297 // just save the handlers. 1298 foreach ($cache->handlers as $name => $handler) { 1299 page_manager_save_task_handler($handler); 1300 1301 // Keep all node edit handlers for later use. 1302 if ($page->task == 'node_edit') { 1303 $node_edit_handlers[$name] = $handler; 1304 } 1305 } 1306 } 1307 else { 1308 page_manager_page_save($page); 1309 } 1310 } 1311 1312 $ret[] = update_sql("DROP TABLE {panels_page}"); 1313 1314 // Update a couple of pane types that changed and are easily moved: 1315 switch ($GLOBALS['db_type']) { 1316 case 'mysql': 1317 case 'mysqli': 1318 $ret[] = update_sql("UPDATE {panels_pane} SET type = CONCAT(type, '_', subtype) WHERE type = 'node_form'"); 1319 break; 1320 1321 case 'pgsql': 1322 $ret[] = update_sql("UPDATE {panels_pane} SET type = type || '_' || subtype WHERE type = 'node_form'"); 1323 } 1324 $ret[] = update_sql("UPDATE {panels_pane} SET type = 'node_form_path' WHERE type = 'node_form_url_path'"); 1325 1326 if (module_exists('ctools') && !module_exists('views_content') && db_result(db_query("SELECT pid FROM {panels_pane} WHERE type = 'views'"))) { 1327 drupal_install_modules(array('views_content')); 1328 } 1329 1330 return $ret; 1331 } 1332 1333 function _panels_update_create_handler($page, $p, $origin, $info, $arguments, $weight, &$cache) { 1334 $task = page_manager_get_task($page->task); 1335 $task_name = 'page-' . $page->name; 1336 $plugin = page_manager_get_task_handler('panel_context'); 1337 $handler = page_manager_new_task_handler($plugin); 1338 1339 $handler->weight = $weight; 1340 $handler->task = $page->task; 1341 if ($page->task == 'page') { 1342 $handler->subtask = $page->name; 1343 } 1344 $handler->export_type = EXPORT_IN_DATABASE; 1345 $handler->type = t('Normal'); 1346 1347 $handler->name = page_manager_handler_get_name($task_name, $cache->handlers, $handler); 1348 1349 $handler->conf['css'] = $p->css; 1350 $handler->conf['css_id'] = $p->css_id; 1351 $handler->conf['no_blocks'] = $p->no_blocks; 1352 if (!empty($info['did']) && is_numeric($info['did'])) { 1353 $handler->conf['did'] = $info['did']; 1354 } 1355 else { 1356 $d = panels_load_display($p->did); 1357 if ($d) { 1358 $display_code = panels_export_display($d); 1359 eval($display_code); 1360 1361 $handler->conf['did'] = 'new'; 1362 $handler->conf['display'] = $display; 1363 } 1364 } 1365 $handler->conf['title'] = !empty($info['title']) ? $info['title'] : ''; 1366 $handler->conf['contexts'] = unserialize($p->contexts); 1367 $handler->conf['relationships'] = unserialize($p->relationships); 1368 1369 if ($origin && strpos($origin, '-')) { 1370 $handler->conf['access'] = array( 1371 'logic' => 'and', 1372 'plugins' => array(), 1373 ); 1374 1375 // Only 4 types of arguments supported having their own displays: 1376 // nid, node_add_form, node_edit_form and term. 3 of those simply used 1377 // node type and the last simply used vocabulary. 1378 list($junk, $key) = explode('-', $origin); 1379 if ($key && $key != 'default') { 1380 if ($arguments[$info['argument_id']]['name'] == 'term') { 1381 $handler->conf['access']['plugins'][] = array( 1382 'name' => 'term_vocabulary', 1383 'context' => $arguments[$info['argument_id']]['context'], 1384 'settings' => array( 1385 'vids' => array($key), 1386 ), 1387 ); 1388 } 1389 else { 1390 $handler->conf['access']['plugins'][] = array( 1391 'name' => 'node_type', 1392 'context' => $arguments[$info['argument_id']]['context'], 1393 'settings' => array( 1394 'type' => array($key), 1395 ), 1396 ); 1397 } 1398 } 1399 else { 1400 // make sure defaults float to the bottom: 1401 $handler->weight += 100; 1402 } 1403 } 1404 $cache->handlers[$handler->name] = $handler; 1405 1406 return $handler; 1407 } 1408 1409 /** 1410 * Ensure the panels_simple_cache module does not exist. 1411 */ 1412 function panels_update_6303() { 1413 $ret = array(); 1414 if (module_exists('panels_simple_cache')) { 1415 drupal_set_message(t('Your installation contains a module that no longer exists. When updating modules, you should always remove the module directory first, then replace it with the new code. The "Panels Simple Cache" module is being automatically disabled for you. Please do not re-enable it as it will cause your system to crash.')); 1416 $ret[] = update_sql("DELETE FROM {system} WHERE name = 'panels_simple_cache'"); 1417 } 1418 1419 return $ret; 1420 } 1421 1422 /** 1423 * Ensure that users are informed about the page manager module. 1424 */ 1425 function panels_update_6304() { 1426 if (!module_exists('page_manager')) { 1427 drupal_set_message(t('The delegator module has been replaced by the Page Manager module. You should enable the page manager module to ensure that any panel pages you have will not be lost.')); 1428 } 1429 1430 return array(); 1431 } 1432 1433 /** 1434 * Add the title_pane field. 1435 */ 1436 function panels_update_6305() { 1437 $ret = array(); 1438 1439 // Fetch schema version 2. 1440 $schema = panels_schema_2(); 1441 1442 // Add new field 1443 db_add_field($ret, 'panels_display', 'title_pane', $schema['panels_display']['fields']['title_pane']); 1444 1445 return $ret; 1446 } 1447 1448 /** 1449 * Drop a table that should have been gone long ago. 1450 */ 1451 function panels_update_6306() { 1452 $ret = array(); 1453 1454 if (db_table_exists('panels_page_router_store')) { 1455 db_drop_table($ret, 'panels_page_router_store'); 1456 } 1457 1458 return $ret; 1459 } 1460 1461 /** 1462 * This update function does nothing, it was committed in error and is 1463 * left in to prevent update problems. 1464 */ 1465 function panels_update_6307() { 1466 return array(); 1467 } 1468 1469 /** 1470 * Add the panels_layout table 1471 */ 1472 function panels_update_6308() { 1473 $ret = array(); 1474 1475 // Schema 3 is locked and should not be changed. 1476 $schema = panels_schema_3(); 1477 1478 db_create_table($ret, 'panels_layout', $schema['panels_layout']); 1479 return $ret; 1480 } 1481 1482 /** 1483 * Add the panels_renderer_pipeline table 1484 */ 1485 function panels_update_6309() { 1486 $ret = array(); 1487 1488 // Schema 3 is locked and should not be changed. 1489 $schema = panels_schema_3(); 1490 1491 db_create_table($ret, 'panels_renderer_pipeline', $schema['panels_renderer_pipeline']); 1492 return $ret; 1493 } 1494 1495 /** 1496 * Move stylizer data from Panels to CTools. 1497 */ 1498 function panels_update_6310() { 1499 $ret = array(); 1500 // load the module files, if possible 1501 if (!defined('PANELS_REQUIRED_CTOOLS_API')) { 1502 include_once drupal_get_path('module', 'panels') . '/panels.module'; 1503 } 1504 if (!defined('CTOOLS_API_VERSION')) { 1505 include_once drupal_get_path('module', 'ctools') . '/ctools.module'; 1506 } 1507 // Safety: go away if CTools is not at an appropriate version. 1508 if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) { 1509 $ret['#abort'] = array('success' => FALSE, 'query' => t('Panels cannot be updated because CTools 1.7 (API v1.7.2) is required. Please update CTools and then try update.php again.')); 1510 return $ret; 1511 } 1512 1513 // Enable the stylizer module to make everything as seamless as possible. 1514 drupal_install_modules(array('stylizer')); 1515 return $ret; 1516 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |