123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377 |
- <?php
- /**
- * Test requirements for installation and running.
- */
- function panels_requirements($phase) {
- $function = "panels_requirements_$phase";
- return function_exists($function) ? $function() : array();
- }
- /**
- * Check install-time requirements.
- */
- function panels_requirements_install() {
- $requirements = array();
- $t = get_t();
- // 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,
- // so we need to force the issue in order for our versioning
- // check to work.
- if (!defined('PANELS_REQUIRED_CTOOLS_API')) {
- include_once drupal_get_path('module', 'panels') . '/panels.module';
- }
- // In theory we should check module_exists, but Drupal's gating should
- // actually prevent us from getting here otherwise.
- if (!defined('CTOOLS_API_VERSION')) {
- 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))
- );
- }
- }
- return $requirements;
- }
- /**
- * Implementation 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();
- }
- function panels_schema_4() {
- $schema = panels_schema_3();
- $schema['panels_pane']['fields']['locks'] = array(
- 'type' => 'text',
- 'size' => 'big',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- );
- return $schema;
- }
- /**
- * Schema from the D6 version.
- */
- function panels_schema_3() {
- // Schema 3 is now locked. If you need to make changes, please create
- // schema 4 and add them.
- $schema = array();
- $schema['panels_display'] = array(
- 'export' => array(
- 'object' => 'panels_display',
- 'bulk export' => FALSE,
- 'export callback' => 'panels_export_display',
- 'can disable' => FALSE,
- 'identifier' => 'display',
- ),
- 'fields' => array(
- 'did' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- 'no export' => TRUE,
- ),
- 'layout' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- ),
- 'layout_settings' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- ),
- 'panel_settings' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- ),
- 'cache' => array(
- 'type' => 'text',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- ),
- 'title' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'default' => '',
- ),
- 'hide_title' => array(
- 'type' => 'int',
- 'size' => 'tiny',
- 'default' => 0,
- 'no export' => TRUE,
- ),
- 'title_pane' => array(
- 'type' => 'int',
- 'default' => 0,
- 'no export' => TRUE,
- ),
- ),
- 'primary key' => array('did'),
- );
- $schema['panels_pane'] = array(
- 'export' => array(
- 'can disable' => FALSE,
- 'identifier' => 'pane',
- 'bulk export' => FALSE,
- ),
- 'fields' => array(
- 'pid' => array(
- 'type' => 'serial',
- 'not null' => TRUE,
- ),
- 'did' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'no export' => TRUE,
- ),
- 'panel' => array(
- 'type' => 'varchar',
- 'length' => '32',
- 'default' => '',
- ),
- 'type' => array(
- 'type' => 'varchar',
- 'length' => '32',
- 'default' => '',
- ),
- 'subtype' => array(
- 'type' => 'varchar',
- 'length' => '64',
- 'default' => '',
- ),
- 'shown' => array(
- 'type' => 'int',
- 'size' => 'tiny',
- 'default' => 1,
- ),
- 'access' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- ),
- 'configuration' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- ),
- 'cache' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- ),
- 'style' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- ),
- 'css' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- ),
- 'extras' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'serialize' => TRUE,
- 'object default' => array(),
- 'initial' => array(),
- ),
- 'position' => array(
- 'type' => 'int',
- 'size' => 'small',
- 'default' => 0,
- ),
- ),
- 'primary key' => array('pid'),
- 'indexes' => array(
- 'did_idx' => array('did')
- ),
- );
- $schema['panels_renderer_pipeline'] = array(
- 'description' => 'Contains renderer pipelines for Panels. Each pipeline contains one or more renderers and access rules to select which renderer gets used.',
- 'export' => array(
- 'identifier' => 'pipeline',
- 'bulk export' => TRUE,
- 'primary key' => 'rpid',
- 'api' => array(
- 'owner' => 'panels',
- 'api' => 'pipelines',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'rpid' => array(
- 'type' => 'serial',
- 'description' => 'A database primary key to ensure uniqueness.',
- 'not null' => TRUE,
- 'no export' => TRUE,
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'description' => 'Unique ID for this content. Used to identify it programmatically.',
- ),
- 'admin_title' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'description' => 'Administrative title for this pipeline.',
- ),
- 'admin_description' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'description' => 'Administrative description for this pipeline.',
- 'object default' => '',
- ),
- 'weight' => array(
- 'type' => 'int',
- 'size' => 'small',
- 'default' => 0,
- ),
- 'settings' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'description' => 'Serialized settings for the actual pipeline. The contents of this field are up to the plugin that uses it.',
- 'serialize' => TRUE,
- 'object default' => array(),
- ),
- ),
- 'primary key' => array('rpid'),
- );
- $schema['panels_layout'] = array(
- 'description' => 'Contains exportable customized layouts for this site.',
- 'export' => array(
- 'identifier' => 'layout',
- 'bulk export' => TRUE,
- 'primary key' => 'lid',
- 'api' => array(
- 'owner' => 'panels',
- 'api' => 'layouts',
- 'minimum_version' => 1,
- 'current_version' => 1,
- ),
- ),
- 'fields' => array(
- 'lid' => array(
- 'type' => 'serial',
- 'description' => 'A database primary key to ensure uniqueness.',
- 'not null' => TRUE,
- 'no export' => TRUE,
- ),
- 'name' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'description' => 'Unique ID for this content. Used to identify it programmatically.',
- ),
- 'admin_title' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'description' => 'Administrative title for this layout.',
- ),
- 'admin_description' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'description' => 'Administrative description for this layout.',
- 'object default' => '',
- ),
- 'category' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'description' => 'Administrative category for this layout.',
- ),
- 'plugin' => array(
- 'type' => 'varchar',
- 'length' => '255',
- 'description' => 'The layout plugin that owns this layout.',
- ),
- 'settings' => array(
- 'type' => 'text',
- 'size' => 'big',
- 'description' => 'Serialized settings for the actual layout. The contents of this field are up to the plugin that uses it.',
- 'serialize' => TRUE,
- 'object default' => array(),
- ),
- ),
- 'primary key' => array('lid'),
- );
- return $schema;
- }
- /**
- * Change panels_display.layout to match the size of panels_layout.name.
- */
- function panels_update_7300() {
- // Load the schema.
- $schema = panels_schema_3();
- $table = 'panels_display';
- $field = 'layout';
- $spec = $schema[$table]['fields'][$field];
- // Re-define the column.
- db_change_field($table, $field, $field, $spec);
- return t('Changed the panels_display.layout field to the correct size.');
- }
- /**
- * Add lock field to panels_pane table.
- */
- function panels_update_7301() {
- // Load the schema.
- // Due to a previous failure, the field may already exist:
- $schema = panels_schema_4();
- $table = 'panels_pane';
- $field = 'locks';
- if (!db_field_exists($table, $field)) {
- $spec = $schema[$table]['fields'][$field];
- // Core does not properly respect 'initial' and 'serialize'.
- unset($spec['initial']);
- // Re-define the column.
- db_add_field($table, $field, $spec);
- return t('Added panels_pane.lock field.');
- }
- return t('panels_pane.lock field already existed, update skipped.');
- }
|