Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/views.install | ||
---|---|---|
19 | 19 |
|
20 | 20 |
/** |
21 | 21 |
* Implements hook_schema(). |
22 |
* |
|
23 |
* Generate the current version of the database schema from |
|
24 |
* the sequence of schema update functions. Uses a similar |
|
25 |
* method to install.inc's drupal_get_schema_versions() to |
|
26 |
* establish the update sequence. |
|
27 |
* |
|
28 |
* To change the schema, add a new views_schema_N() |
|
29 |
* function to match the associated views_update_N() |
|
30 |
* |
|
31 |
* @param $caller_function |
|
32 |
* The name of the function that called us. |
|
33 |
* Used internally, if requesting a specific schema version. |
|
34 | 22 |
*/ |
35 |
function views_schema($caller_function = FALSE) { |
|
23 |
function views_schema($caller_function = NULL) { |
|
24 |
// Generate the current version of the database schema from the sequence of |
|
25 |
// schema update functions. Uses a similar method to install.inc's |
|
26 |
// drupal_get_schema_versions() to establish the update sequence. |
|
27 |
// |
|
28 |
// To change the schema, add a new views_schema_N() function to match the |
|
29 |
// associated views_update_N(). |
|
30 |
// |
|
31 |
// @param string $caller_function |
|
32 |
// The name of the function that called us. Used internally, if requesting a |
|
33 |
// specific schema version. |
|
36 | 34 |
static $get_current; |
37 | 35 |
static $schemas = array(); |
38 | 36 |
|
... | ... | |
55 | 53 |
if ($schemas) { |
56 | 54 |
sort($schemas, SORT_NUMERIC); |
57 | 55 |
|
58 |
// If a specific version was requested, drop any later |
|
59 |
// updates from the sequence.
|
|
56 |
// If a specific version was requested, drop any later updates from the
|
|
57 |
// sequence. |
|
60 | 58 |
if ($caller_function) { |
61 | 59 |
do { |
62 | 60 |
$schema = array_pop($schemas); |
63 |
} while ($schemas && $caller_function != 'views_schema_'. $schema); |
|
61 |
} while ($schemas && $caller_function != 'views_schema_' . $schema);
|
|
64 | 62 |
} |
65 | 63 |
} |
66 | 64 |
} |
67 | 65 |
|
68 | 66 |
// Call views_schema_<n>, for the highest available <n>. |
69 | 67 |
if ($schema = array_pop($schemas)) { |
70 |
$function = 'views_schema_'. $schema; |
|
68 |
$function = 'views_schema_' . $schema;
|
|
71 | 69 |
return $function(); |
72 | 70 |
} |
73 | 71 |
|
... | ... | |
76 | 74 |
|
77 | 75 |
/** |
78 | 76 |
* Views 2's initial schema. |
77 |
* |
|
79 | 78 |
* Called directly by views_update_6000() for updates from Drupal 5. |
80 | 79 |
* |
81 | 80 |
* Important: Do not edit this schema! |
82 | 81 |
* |
83 |
* Updates to the views schema must be provided as views_schema_6xxx() functions, |
|
84 |
* which views_schema() automatically sees and applies. See below for examples. |
|
82 |
* Updates to the views schema must be provided as views_schema_6xxx() |
|
83 |
* functions, which views_schema() automatically sees and applies. See below for |
|
84 |
* examples. |
|
85 | 85 |
* |
86 | 86 |
* Please do document updates with comments in this function, however. |
87 | 87 |
*/ |
... | ... | |
102 | 102 |
'current_version' => '3.0', |
103 | 103 |
), |
104 | 104 |
'object' => 'view', |
105 |
// the callback to load the displays |
|
105 |
// the callback to load the displays.
|
|
106 | 106 |
'subrecords callback' => 'views_load_display_records', |
107 |
// the variable that holds enabled/disabled status |
|
107 |
// the variable that holds enabled/disabled status.
|
|
108 | 108 |
'status' => 'views_defaults', |
109 |
// CRUD callbacks |
|
109 |
// CRUD callbacks.
|
|
110 | 110 |
'create callback' => 'views_new_view', |
111 | 111 |
'save callback' => 'views_save_view', |
112 | 112 |
'delete callback' => 'views_delete_view', |
... | ... | |
148 | 148 |
), |
149 | 149 |
'base_table' => array( |
150 | 150 |
'type' => 'varchar', |
151 |
'length' => '32', // Updated to '64' in views_schema_6005() |
|
151 |
'length' => '32', |
|
152 |
// Updated to '64' in views_schema_6005() |
|
152 | 153 |
'default' => '', |
153 | 154 |
'not null' => TRUE, |
154 | 155 |
'description' => 'What table this view is based on, such as node, user, comment, or term.', |
... | ... | |
161 | 162 |
), |
162 | 163 |
), |
163 | 164 |
'primary key' => array('vid'), |
164 |
'unique key' => array('name' => array('name')), // Updated to 'unique keys' in views_schema_6003() |
|
165 |
'unique key' => array('name' => array('name')), |
|
166 |
// Updated to 'unique keys' in views_schema_6003() |
|
165 | 167 |
); |
166 | 168 |
|
167 | 169 |
$schema['views_display'] = array( |
... | ... | |
241 | 243 |
'description' => 'The time this cache was created or updated.', |
242 | 244 |
), |
243 | 245 |
'data' => array( |
244 |
'type' => 'blob', // Updated to 'text' (with size => 'big') in views_schema_6004() |
|
246 |
'type' => 'blob', |
|
247 |
// Updated to 'text' (with size => 'big') in views_schema_6004() |
|
245 | 248 |
'description' => 'Serialized data being stored.', |
246 | 249 |
'serialize' => TRUE, |
247 | 250 |
), |
... | ... | |
294 | 297 |
update_sql("UPDATE {blocks} SET delta = CONCAT(delta, '-block_1') WHERE module = 'views'"); |
295 | 298 |
} |
296 | 299 |
|
297 |
/* |
|
300 |
/**
|
|
298 | 301 |
* NOTE: Update 6002 removed because it did not always work. |
299 | 302 |
* Update 6004 implements the change correctly. |
300 | 303 |
*/ |
... | ... | |
337 | 340 |
} |
338 | 341 |
|
339 | 342 |
/** |
340 |
* Enlarge the base_table column |
|
343 |
* Enlarge the base_table column.
|
|
341 | 344 |
*/ |
342 | 345 |
function views_schema_6005() { |
343 | 346 |
$schema = views_schema(__FUNCTION__); |
... | ... | |
444 | 447 |
} |
445 | 448 |
|
446 | 449 |
/** |
447 |
* Remove the view_php field |
|
450 |
* Remove the view_php field.
|
|
448 | 451 |
*/ |
449 | 452 |
function views_schema_6010() { |
450 | 453 |
$schema = views_schema(__FUNCTION__); |
... | ... | |
454 | 457 |
} |
455 | 458 |
|
456 | 459 |
/** |
457 |
* Remove the view_php and is_cacheable field |
|
460 |
* Remove the view_php and is_cacheable field.
|
|
458 | 461 |
*/ |
459 | 462 |
function views_update_6010() { |
460 | 463 |
db_drop_field('views_view', 'view_php'); |
... | ... | |
578 | 581 |
} |
579 | 582 |
|
580 | 583 |
/** |
581 |
* Fix missing items from Views administrative breadcrumb |
|
584 |
* Fix missing items from Views administrative breadcrumb.
|
|
582 | 585 |
*/ |
583 | 586 |
function views_update_7001() { |
584 | 587 |
$depth = db_select('menu_links') |
... | ... | |
619 | 622 |
} |
620 | 623 |
|
621 | 624 |
/** |
622 |
* Enlarge the name column |
|
625 |
* Enlarge the name column.
|
|
623 | 626 |
*/ |
624 | 627 |
function views_update_7301() { |
625 | 628 |
$new_field = array( |
... | ... | |
633 | 636 |
} |
634 | 637 |
|
635 | 638 |
/** |
636 |
* Remove headers field from cache tables |
|
639 |
* Remove headers field from cache tables.
|
|
637 | 640 |
* |
638 |
* @see system_update_7054().
|
|
641 |
* @see system_update_7054() |
|
639 | 642 |
*/ |
640 | 643 |
function views_update_7302() { |
641 | 644 |
if (db_field_exists('cache_views', 'headers')) { |
Formats disponibles : Unified diff
Weekly update of contrib modules