= 0) { print "Current Ensemble version is " . $ENSEMBLE_VERSION . "\n"; print "Proceeding with upgrade.\n"; } else { print "Your Ensemble version could not be determined.\n"; print "This is usually reported by " . $versionInfoFile . "\n"; print "Your Ensemble version must be at least 1.7.0 in order to run this script.\n"; print "Exiting the upgrade script now.\n"; die(); } } //END VERSION, FILE, AND DIRECTORY CHECKING /********************************************************************************************************/ // BACKUP THE DATABASE print "\nDirectory to save database backup "; $backupDir = checkDirectoryInput($_ENV['HOME']); $dbBackupFpath = backupDB($backupDir,$versionInfo); /********************************************************************************************************/ //VARIABLE UPDATES //DATABASE UPDATES //add 'theme' enum to attribute classes //first get existing class list and add theme if necessary $sql_describe_enum = "show columns from `attribute` like 'class'"; $describe_enum = mysql_select($sql_describe_enum); preg_match_all("/('.*?')/", $describe_enum['Type'], $enum_array); $enum_fields = $enum_array[1]; if(!in_array("'theme'",$enum_fields)) $enum_fields[] = "'theme'"; $sql_add_subject_group = sprintf("ALTER TABLE `attribute` CHANGE `class` `class` ENUM( %s ) " . "CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'stim_set'", implode(',',$enum_fields)); print "\n\nSubmitting query:\n"; print $sql_add_subject_group . "\n\n"; mysql_query($sql_add_subject_group) or die(mysql_error()); print "DONE UPDATING!\n\n"; print "Please test your installation by verifying that old experiments still run\n"; ?>