3 /*! @ingroup ConStructModule */
6 /*! @file conStruct.install
7 @brief Procedures to execute when the module get installed/uninstalled
9 @author Frederick Giasson, Structured Dynamics LLC.
14 include_once("framework/utilities.php");
16 /*!@brief Instantiation of hook_install
18 @author Frederick Giasson, Structured Dynamics LLC.
22 function conStruct_install()
24 // Create the "dataset" content type with its related additional fields.
25 import_cck_content_types();
27 // Fix the weight of the conStruct module
28 // We want conStruct to be called first (at least before OG)
29 db_query("UPDATE {system} SET weight = -50 WHERE name = 'conStruct'");
31 // Create the default conStruct domain name where tor esolve URIs
34 // Normalization of the URL of the node. Here we remove the "www" to normalize it.
35 $normalized_base_url = str_replace("www.", "", $base_url);
37 variable_set("conStruct_UrisDomain", str_replace("http://", "", get_domain($normalized_base_url)));
39 // Set the default value for the WSG-Registry Drupal to $base_url
40 variable_set("WSF-Registry", $base_url.
"/ws/");
44 /*!@brief Instantiation of hook_uninstall
46 @author Frederick Giasson, Structured Dynamics LLC.
48 @todo Improve this method to find all the variables within the varitable table instead of using a fixed count.
52 function conStruct_uninstall()
54 // Removing the "dataset" content type
55 node_type_delete("dataset");
57 // Making sure we remove all global variables we created
58 variable_del("Linked-Dataset-Registry");
59 variable_del("WSF-Registry");
60 variable_del("SID-Registry");
61 variable_del("Datasets-Registry");
62 variable_del("conStruct_UrisDomain");
64 for ($i = 0; $i < 512; $i++)
66 variable_del("Dataset-$i-WSF");
72 /*!@brief Updating to version 6.1.1.8
74 @see http://drupal.org/node/136078
76 @author Frederick Giasson, Structured Dynamics LLC.
81 function conStruct_update_6118()
83 // Initial version that supports upgrading.
86 /*!@brief Import needed CCK content types to run conStruct
88 @author Frederick Giasson, Structured Dynamics LLC.
92 function import_cck_content_types()
94 $filename = drupal_get_path('module', 'conStruct') .
"/content_types.cck";
96 $content = implode('', file($filename));
99 $form_state = array('values' => array(
100 'type_name' => '<create>',
104 drupal_execute("content_copy_import_form", $form_state);