2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
// Call views_schema_<n>, for the highest available <n>.
if($schema=array_pop($schemas)){
$function='views_schema_'.$schema;
return$function();
}
returnarray();
}
/**
* Views 2's initial schema.
* Called directly by views_update_6000() for updates from Drupal 5.
*
* Important: Do not edit this schema!
*
* Updates to the views schema must be provided as views_schema_6xxx() functions,
* which views_schema() automatically sees and applies. See below for examples.
*
* Please do document updates with comments in this function, however.
*/
functionviews_schema_6000(){
$schema['views_view']=array(
$schema['views_view']=array(
'description'=>'Stores the general data for a view.',
'description'=>'Stores the general data for a view.',
'export'=>array(
'export'=>array(
...
@@ -128,11 +57,17 @@ function views_schema_6000() {
...
@@ -128,11 +57,17 @@ function views_schema_6000() {
),
),
'name'=>array(
'name'=>array(
'type'=>'varchar',
'type'=>'varchar',
'length'=>'32',
'length'=>'128',
'default'=>'',
'default'=>'',
'not null'=>TRUE,
'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.',
'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(
'description'=>array(
'type'=>'varchar',
'type'=>'varchar',
'length'=>'255',
'length'=>'255',
...
@@ -145,26 +80,21 @@ function views_schema_6000() {
...
@@ -145,26 +80,21 @@ function views_schema_6000() {
'default'=>'',
'default'=>'',
'description'=>'A tag used to group/sort views in the admin interface',
'description'=>'A tag used to group/sort views in the admin interface',
),
),
'view_php'=>array(
'type'=>'blob',
'description'=>'A chunk of PHP code that can be used to provide modifications to the view prior to building.',
),
'base_table'=>array(
'base_table'=>array(
'type'=>'varchar',
'type'=>'varchar',
'length'=>'32',// Updated to '64' in views_schema_6005()
'length'=>'64',
'default'=>'',
'default'=>'',
'not null'=>TRUE,
'not null'=>TRUE,
'description'=>'What table this view is based on, such as node, user, comment, or term.',
'description'=>'What table this view is based on, such as node, user, comment, or term.',
),
),
'is_cacheable'=>array(
'core'=>array(
'type'=>'int',
'type'=>'int',
'default'=>0,
'default'=>0,
'size'=>'tiny',
'description'=>'Stores the drupal core version of the view.',
'description'=>'A boolean to indicate whether or not this view may have its query cached.',
),
),
),
),
'primary key'=>array('vid'),
'primary key'=>array('vid'),
'unique key'=>array('name'=>array('name')),// Updated to 'unique keys' in views_schema_6003()
'unique keys'=>array('name'=>array('name')),
);
);
$schema['views_display']=array(
$schema['views_display']=array(
...
@@ -205,433 +135,31 @@ function views_schema_6000() {
...
@@ -205,433 +135,31 @@ function views_schema_6000() {
'description'=>'The order in which this display is loaded.',
'description'=>'The order in which this display is loaded.',
),
),
'display_options'=>array(
'display_options'=>array(
// Type corrected in update 6009
'type'=>'text',
'type'=>'blob',
'size'=>'big',
'description'=>'A serialized array of options for this display; it contains options that are generally only pertinent to that display plugin type.',
'description'=>'A serialized array of options for this display; it contains options that are generally only pertinent to that display plugin type.',
'description'=>'A special cache used to store objects that are being edited; it serves to save state in an ordinarily stateless environment.',
'fields'=>array(
'sid'=>array(
'type'=>'varchar',
'length'=>'64',
'description'=>'The session ID this cache object belongs to.',
),
'name'=>array(
'type'=>'varchar',
'length'=>'32',
'description'=>'The name of the view this cache is attached to.',
),
'obj'=>array(
'type'=>'varchar',
'length'=>'32',
'description'=>'The name of the object this cache is attached to; this essentially represents the owner so that several sub-systems can use this cache.',
),
'updated'=>array(
'type'=>'int',
'unsigned'=>TRUE,
'not null'=>TRUE,
'default'=>0,
'description'=>'The time this cache was created or updated.',
),
'data'=>array(
'type'=>'blob',// Updated to 'text' (with size => 'big') in views_schema_6004()
'description'=>'Serialized data being stored.',
'serialize'=>TRUE,
),
),
'indexes'=>array(
'sid_obj_name'=>array('sid','obj','name'),
'updated'=>array('updated'),
),
);
// $schema['cache_views_data'] added in views_schema_6006()
return$schema;
}
/**
* Update a site to Drupal 6! Contains a bit of special code to detect
* if you've been running a beta version or something.
*/
functionviews_update_6000(){
if(db_table_exists('views_view')){
return;
}
// This has the beneficial effect of wiping out any Views 1 cache at the
// same time; not wiping that cache could easily cause problems with Views 2.
if(db_table_exists('cache_views')){
db_drop_table('cache_views');
}
// This is mostly the same as drupal_install_schema, but it forces
// views_schema_6000() rather than the default views_schema().
// This is important for processing subsequent table updates.
$schema=views_schema_6000();
_drupal_schema_initialize($schema,'views');
foreach($schemaas$name=>$table){
db_create_table($name,$table);
}
}
/**
* Remove '$' symbol in special blocks, as it is invalid for theming.
*/
functionviews_update_6001(){
$result=db_query("SELECT * FROM {blocks} WHERE module = 'views' AND delta LIKE '\$exp%'");
foreach($resultas$block){
$new=strtr($block->delta,'$','-');
update_sql("UPDATE {blocks} SET delta = '".db_escape_string($new)."' WHERE module = 'views' AND delta = '".db_escape_string($block->delta)."'");
}
update_sql("UPDATE {blocks} SET delta = CONCAT(delta, '-block_1') WHERE module = 'views'");
}
// NOTE: Update 6002 removed because it did not always work.
'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.',