function views_schema
Implements hook_schema().
11 calls to views_schema()
- views_schema_6003 in ./
views.install - Add missing unique key.
- views_schema_6004 in ./
views.install - Enlarge the views_object_cache.data column to prevent truncation and JS errors.
- views_schema_6005 in ./
views.install - Enlarge the base_table column.
- views_schema_6006 in ./
views.install - Add the cache_views_data table to support standard caching.
- views_schema_6008 in ./
views.install - Add the primary key to views_display table.
File
-
./
views.install, line 23
Code
function views_schema($caller_function = NULL) {
// Generate the current version of the database schema from the sequence of
// schema update functions. Uses a similar method to install.inc's
// drupal_get_schema_versions() to establish the update sequence.
//
// To change the schema, add a new views_schema_N() function to match the
// associated views_update_N().
//
// @param string $caller_function
// The name of the function that called us. Used internally, if requesting a
// specific schema version.
static $get_current;
static $schemas = array();
// If called with no arguments, get the latest version of the schema.
if (!isset($get_current)) {
$get_current = $caller_function ? FALSE : TRUE;
}
// Generate a sorted list of available schema update functions.
if ($get_current || empty($schemas)) {
$get_current = FALSE;
// Provide a worst-case scenario range.
$start_schema = 6000;
$end_schema = 7999;
for ($i = $start_schema; $i <= $end_schema; $i++) {
if (function_exists('views_schema_' . $i)) {
$schemas[] = $i;
}
}
if ($schemas) {
sort($schemas, SORT_NUMERIC);
// If a specific version was requested, drop any later updates from the
// sequence.
if ($caller_function) {
do {
$schema = array_pop($schemas);
} while ($schemas && $caller_function != 'views_schema_' . $schema);
}
}
}
// Call views_schema_<n>, for the highest available <n>.
if ($schema = array_pop($schemas)) {
$function = 'views_schema_' . $schema;
return $function();
}
return array();
}