function tripal_core_chado_load_form_validate
2.x tripal_core.chado_install.inc | tripal_core_chado_load_form_validate($form, &$form_state) |
File
- tripal_core/
includes/ tripal_core.chado_install.inc, line 133 - Functions to install chado schema through Drupal
Code
function tripal_core_chado_load_form_validate($form, &$form_state) {
// We do not want to allow re-installation of Chado if other
// Tripal modules are installed. This is because the install files
// of those modules may add content to Chado and reinstalling Chado
// removes that content which may break the modules.
if ($form_state['values']['action_to_do'] == "Install Chado v1.3" or
$form_state['values']['action_to_do'] == "Install Chado v1.2" or
$form_state['values']['action_to_do'] == "Install Chado v1.11") {
$modules = system_get_info('module');
// The tripal_views module should not be included as it's a rquired
// dependency of tripal_core
unset($modules['tripal_views']);
$list = array();
foreach ($modules as $mname => $module) {
if (array_key_exists('dependencies', $module) and in_array('tripal_core', $module['dependencies'])) {
$list[] = $module['name'] . " ($mname)";
}
}
if (count($list) > 0) {
form_set_error("action_to_do", "Chado cannot be installed while other Tripal modules
are enabled. You must fully uninstall the following modules if you
would like to install or re-install chado.<br>" .
implode("<br>", $list));
}
}
if ($form_state['values']['action_to_do'] == "Upgrade Chado v1.11 to v1.2") {
// Make sure we are already not at v1.2
$real_version = chado_get_version(TRUE);
if ($real_version == "1.2") {
form_set_error("action_to_do", "You are already at v1.2. There is no need to upgrade.");
}
}
if ($form_state['values']['action_to_do'] == "Upgrade Chado v1.2 to v1.3") {
// Make sure we are already not at v1.3
$real_version = chado_get_version(TRUE);
if ($real_version == "1.3") {
form_set_error("action_to_do", "You are already at v1.3. There is no need to upgrade.");
}
}
}