123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?php
- function tripal_organism_install(){
-
- tripal_create_moddir('tripal_organism');
-
-
-
-
-
- $dest = file_directory_path() . "/tripal/tripal_organism/images";
- file_check_directory($dest,FILE_CREATE_DIRECTORY);
-
-
- drupal_install_schema('tripal_organism');
- }
- function tripal_organism_schema() {
- $schema = tripal_organism_get_schemas();
- return $schema;
- }
- function tripal_organism_uninstall(){
- drupal_uninstall_schema('tripal_organism');
-
- $sql_lib_id = "SELECT nid, vid ".
- "FROM {node} ".
- "WHERE type='chado_organism'";
- $result = db_query($sql_lib_id);
- while ($node = db_fetch_object($result)) {
- node_delete($node->nid);
- }
-
-
-
- if (db_table_exists('tripal_organism_views_common_name')) {
- $sql = "DROP TABLE {tripal_organism_views_common_name}";
- db_query ($sql);
- }
- }
- function tripal_organism_get_schemas (){
- $schema = array();
- $schema['chado_organism'] = array(
- 'fields' => array(
- 'vid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0
- ),
- 'nid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- 'default' => 0
- ),
- 'organism_id' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0
- )
- ),
- 'indexes' => array(
- 'organism_id' => array('organism_id')
- ),
- 'unique keys' => array(
- 'nid_vid' => array('nid','vid'),
- 'vid' => array('vid')
- ),
- 'primary key' => array('nid'),
- );
- return $schema;
- }
- function tripal_organism_requirements($phase) {
- $requirements = array();
- if ($phase == 'install') {
- if (!function_exists('tripal_create_moddir')) {
- $requirements ['tripal_organism'] = array(
- 'title' => "tripal_organism",
- 'value' => "error. Some required modules are just being installed. Please try again.",
- 'severity' => REQUIREMENT_ERROR,
- );
- }
- }
- return $requirements;
- }
|