modules/custom/deims_data_explorer/deims_data_explorer.install
<?php
/**
* @file
* Install, update, and uninstall functions for the DEIMS data explorer module.
*/
/**
* Implements hook_install().
*/
function deims_data_explorer_install() {
if (!field_info_field('field_deims_data_explorer')) {
$field = array(
'field_name' => 'field_deims_data_explorer',
'type' => 'schema_reference',
);
field_create_field($field);
$instance = array(
'field_name' => 'field_deims_data_explorer',
'entity_type' => 'node',
'label' => 'Remote Data Source',
'bundle' => 'data_source',
);
field_create_instance($instance);
}
}
/**
* Implements hook_requirements().
*/
function deims_data_explorer_requirements($phase) {
$requirements = array();
// NOTE: this is set in a variable_get elsewhere, so this may need to be
// changed if the value is changed in the DB.
$directory = 'public://data-downloads';
// Check to make sure the data-downloads directory is writeable.
if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) {
$requirements['deims_data_explorer'] = array(
'title' => 'Directory must be writeable.',
'description' => 'The directory must be writeable by Drupal.',
'severity' => REQUIREMENT_WARNING,
'value' => 'Not Writable',
);
}
return $requirements;
}