View source
<?php
function views_data_export_schema() {
$schema = array();
$schema['views_data_export'] = array(
'description' => t('Keep track of currently executing exports.'),
'fields' => array(
'eid' => array(
'description' => 'Unique id for each on-going export.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'view_name' => array(
'type' => 'varchar',
'length' => '32',
'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.',
),
'view_display_id' => array(
'type' => 'varchar',
'length' => '32',
'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.',
),
'time_stamp' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The time this export started',
),
'fid' => array(
'description' => 'Files ID.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'batch_state' => array(
'type' => 'varchar',
'length' => '32',
'default' => 'init',
'not null' => TRUE,
'description' => 'The current state of the batch.',
),
'sandbox' => array(
'type' => 'text',
'not null' => TRUE,
'serialize' => TRUE,
),
),
'primary key' => array(
'eid',
),
);
$schema['views_data_export_object_cache'] = array(
'description' => 'A modified version of the views_object_cache that ignores session id.',
'fields' => array(
'eid' => array(
'type' => 'varchar',
'length' => '64',
'description' => 'The export ID this view equates too.',
),
'updated' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The time this cache was created or updated.',
),
'data' => array(
'type' => 'text',
'size' => 'big',
'description' => 'Serialized data being stored.',
'serialize' => TRUE,
),
),
'indexes' => array(
'eid' => array(
'eid',
),
'updated' => array(
'updated',
),
),
);
return $schema;
}
function views_data_export_install() {
drupal_install_schema('views_data_export');
}
function views_data_export_uninstall() {
views_data_export_garbage_collect(0, -1);
drupal_uninstall_schema('views_data_export');
}
function views_data_export_update_6200() {
$ret = array();
$new_field = array(
'type' => 'text',
'size' => 'big',
'description' => 'Serialized data being stored.',
'serialize' => TRUE,
);
db_drop_field($ret, 'views_data_export_object_cache', 'data');
db_add_field($ret, 'views_data_export_object_cache', 'data', $new_field);
return $ret;
}
function views_data_export_requirements($phase) {
global $db_type;
$requirements = array();
$t = get_t();
switch ($phase) {
case 'runtime':
switch ($db_type) {
case 'mysql':
case 'mysqli':
$max_allowed_packet = db_result(db_query("SHOW VARIABLES WHERE variable_name = '%s'", array(
'max_allowed_packet',
)));
if (is_numeric($max_allowed_packet)) {
if ($max_allowed_packet < 16 * 1024 * 1024) {
$requirements['views_data_export'] = array(
'title' => $t('MySQL - max allowed packet'),
'value' => format_size($max_allowed_packet),
'description' => $t("Your MySQL 'max_allowed_packet' setting may be too low for Views data export to function correctly, Drupal's requirements recommend setting it to at least 16M. See: !link", array(
'!link' => l('http://drupal.org/requirements', 'http://drupal.org/requirements'),
)),
'severity' => REQUIREMENT_WARNING,
);
}
}
break;
}
break;
}
return $requirements;
}