t('Stores the details of each import task.'), 'fields' => array( 'taskid' => array( 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), 'name' => array( 'type' => 'varchar', 'length' => '64', 'not null' => TRUE, 'default' => '', ), 'uid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'created' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'changed' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'fid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'has_headers' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 1, ), 'file_options' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'headers' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'type' => array( 'type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => '', ), 'map' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'defaults' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'options' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'offset' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'row_done' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'row_error' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'status' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), ), 'primary key' => array('taskid'), ); $schema['node_import_status'] = array( 'description' => t('Stores status of an imported (or not) row.'), 'fields' => array( 'taskid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'offset' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'errors' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'objid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'status' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), ), 'primary key' => array('taskid', 'offset'), ); // With the schema defined, install all tables. foreach ($schema as $name => $table) { if (!db_table_exists($name)) { db_create_table($result, $name, $table); } } return $result; } /** * Implementation of hook_update_N(). * * 6.x-1.0-rc3 to 6.x-1.0-rc4: * - rebuild menu for admin/content/node_import/%node_import/view. */ function node_import_update_6100() { $result = array(); menu_rebuild(); return $result; } /** * Implementation of hook_update_N(). * * 6.x-1.0-rc4 to 6.x-1.0-rc5: * - rename the offset column to file_offset for pgsql (#384944). */ function node_import_update_6101() { $result = array(); db_change_field($result, 'node_import_tasks', 'offset', 'file_offset', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); db_drop_primary_key($result, 'node_import_status'); db_change_field($result, 'node_import_status', 'offset', 'file_offset', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), array('primary key' => array('taskid', 'file_offset'))); return $result; } /** * Implementation of hook_update_N(). * * 6.x-1.0-rc4 to 6.x-1.0-rc5: * - rebuild menu for admin/content/node_import/list/files. * - rebuild menu for admin/content/node_import/list/tasks. */ function node_import_update_6102() { $result = array(); menu_rebuild(); return $result; } /** * Implementation of hook_schema(). */ function node_import_schema() { $schema = array(); $schema['node_import_tasks'] = array( 'description' => t('Stores the details of each import task.'), 'fields' => array( 'taskid' => array( 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ), 'name' => array( 'type' => 'varchar', 'length' => '64', 'not null' => TRUE, 'default' => '', ), 'uid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'created' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'changed' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'fid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'has_headers' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 1, ), 'file_options' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'headers' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'type' => array( 'type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => '', ), 'map' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'defaults' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'options' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'file_offset' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'row_done' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'row_error' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'status' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), ), 'primary key' => array('taskid'), ); $schema['node_import_status'] = array( 'description' => t('Stores status of an imported (or not) row.'), 'fields' => array( 'taskid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'file_offset' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'errors' => array( 'type' => 'text', 'size' => 'big', 'not null' => TRUE, 'serialize' => TRUE, ), 'objid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'status' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), ), 'primary key' => array('taskid', 'file_offset'), ); return $schema; } /** * Implementation of hook_requirements(). */ function node_import_requirements($phase) { $requirements = array(); $t = get_t(); // Check minimum Drupal version. if (($phase == 'install' || $phase == 'runtime') && version_compare(VERSION, NODE_IMPORT_MINIMUM_DRUPAL) < 0) { $requirements['node_import:minimum_drupal'] = array( 'title' => $t('Drupal version'), 'description' => $t('Node import module requires Drupal %version or later (currently %drupal_version installed).', array('%version' => NODE_IMPORT_MINIMUM_DRUPAL, '%drupal_version' => VERSION)), 'value' => VERSION, 'severity' => REQUIREMENT_ERROR, ); } // Check minimum DateAPI version. if ($phase == 'runtime' && variable_get('date_api_version', 0) < NODE_IMPORT_MINIMUM_DATEAPI) { $requirements['node_import:minimum_dateapi'] = array( 'title' => $t('DateAPI version'), 'description' => $t('Node import module requires DateAPI module %version or later (currently %date_version installed).', array('%version' => NODE_IMPORT_MINIMUM_DATEAPI, '%date_version' => variable_get('date_api_version', 0))), 'value' => variable_get('date_api_version', 0), 'severity' => REQUIREMENT_ERROR, ); } return $requirements; }