drupal/views.install

219 lines
7.5 KiB
Plaintext

<?php
/**
* @file
* Contains install and update functions for Views.
*/
use Drupal\Core\Database\Database;
/**
* Implements hook_install().
*/
function views_install() {
db_query("UPDATE {system} SET weight = 10 WHERE name = 'views'");
}
/**
* Implements hook_schema().
*/
function views_schema() {
$schema['views_view'] = array(
'description' => 'Stores the general data for a view.',
'export' => array(
'identifier' => 'view',
'bulk export' => TRUE,
'primary key' => 'vid',
'admin_title' => 'human_name',
'admin_description' => 'description',
'object' => 'Drupal\views\View',
'load all callback' => 'views_get_all_views',
'load callback' => 'views_storage_load',
'save callback' => 'views_storage_save',
'status callback' => 'views_storage_status',
// CRUD callbacks
'create callback' => 'views_new_view',
'save callback' => 'views_save_view',
'delete callback' => 'views_delete_view',
),
'fields' => array(
'vid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The view ID of the field, defined by the database.',
'no export' => TRUE,
),
'name' => array(
'type' => 'varchar',
'length' => '128',
'default' => '',
'not null' => TRUE,
'description' => 'The unique name of the view. This is the primary field views are loaded from, and is used so that views may be internal and not necessarily in the database. May only be alphanumeric characters plus underscores.',
),
'human_name' => array(
'type' => 'varchar',
'length' => '255',
'default' => '',
'description' => 'A human readable name used to be displayed in the admin interface',
),
'description' => array(
'type' => 'varchar',
'length' => '255',
'default' => '',
'description' => 'A description of the view for the admin interface.',
),
'tag' => array(
'type' => 'varchar',
'length' => '255',
'default' => '',
'description' => 'A tag used to group/sort views in the admin interface',
),
'base_table' => array(
'type' => 'varchar',
'length' => '64',
'default' => '',
'not null' => TRUE,
'description' => 'What table this view is based on, such as node, user, comment, or term.',
),
'core' => array(
'type' => 'int',
'default' => 0,
'description' => 'Stores the drupal core version of the view.',
),
),
'primary key' => array('vid'),
'unique keys' => array('name' => array('name')),
);
$schema['views_display'] = array(
'description' => 'Stores information about each display attached to a view.',
'fields' => array(
'vid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The view this display is attached to.',
'no export' => TRUE,
),
'id' => array(
'type' => 'varchar',
'length' => '64',
'default' => '',
'not null' => TRUE,
'description' => 'An identifier for this display; usually generated from the display_plugin, so should be something like page or page_1 or block_2, etc.',
),
'display_title' => array(
'type' => 'varchar',
'length' => '64',
'default' => '',
'not null' => TRUE,
'description' => 'The title of the display, viewable by the administrator.',
),
'display_plugin' => array(
'type' => 'varchar',
'length' => '64',
'default' => '',
'not null' => TRUE,
'description' => 'The type of the display. Usually page, block or embed, but is pluggable so may be other things.',
),
'position' => array(
'type' => 'int',
'default' => 0,
'description' => 'The order in which this display is loaded.',
),
'display_options' => array(
'type' => 'text',
'size' => 'big',
'description' => 'A serialized array of options for this display; it contains options that are generally only pertinent to that display plugin type.',
'serialize' => TRUE,
'serialized default' => 'a:0:{}',
),
),
'primary key' => array('vid', 'id'),
'indexes' => array('vid' => array('vid', 'position')),
);
$schema['cache_views'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_views_data'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['cache_views_data']['description'] = 'Cache table for views to store pre-rendered queries, results, and display output.';
$schema['cache_views_data']['fields']['serialized']['default'] = 1;
$schema['temp_store'] = array(
'description' => t('A temporary data store for objects that are being edited. Allows state to be saved in a stateless environment.'),
'fields' => array(
'owner_id' => array(
'type' => 'varchar',
'length' => '64',
'not null' => TRUE,
'description' => 'The session ID this object belongs to.',
),
'subsystem' => array(
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
'description' => 'The owner (type of the object) for this data store. Allows multiple subsystems to use this data store.',
),
'temp_key' => array(
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
'description' => 'The key of the object this data store is attached to.',
),
'updated' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The time this data store was created or updated.',
),
'data' => array(
'type' => 'text',
'size' => 'big',
'description' => 'Serialized data being stored.',
'serialize' => TRUE,
),
),
'primary key' => array('owner_id', 'subsystem', 'temp_key'),
'indexes' => array('updated' => array('updated')),
);
return $schema;
}
/**
* Implements hook_update_last_removed().
*/
function views_update_last_removed() {
return 7301;
}
/**
* Convert settings to the config system.
*/
function views_update_8000() {
update_variables_to_config('views.settings', array(
'views_ui_show_listing_filters' => 'ui.show.listing_filters',
'views_ui_show_master_display' => 'ui.show.master_display',
'views_ui_show_advanced_column' => 'ui.show.advanced_column',
'views_ui_display_embed' => 'ui.show.display_embed',
'views_ui_custom_theme' => 'ui.custom_theme',
'views_exposed_filter_any_label' => 'exposed_filter_any_label',
'views_ui_always_live_preview' => 'ui.always_live_preview',
'views_ui_always_live_preview_button' => 'ui.always_live_preview_button',
'views_ui_show_preview_information' => 'ui.show.preview_information',
'views_ui_show_sql_query_where' => 'ui.show.sql_query.where',
'views_ui_show_sql_query' => 'ui.show_sql.query.enabled',
'views_ui_show_performance_statistics' => 'ui.show.performance_statistics',
'views_show_additional_queries' => 'ui.show.additional_queries',
'views_skip_cache' => 'skip_cache',
'views_sql_signature' => 'sql_signature',
'views_no_javascript' => 'no_javascript',
'views_devel_output' => 'debug.output',
'views_devel_region' => 'debug.region',
'views_display_extenders' => 'display_extenders',
));
}