Update the version info of structOntology.
[project/construct.git] / conStruct.install
1 <?php
2
3 /*! @ingroup ConStructModule */
4 //@{
5
6 /*! @file conStruct.install
7 @brief Procedures to execute when the module get installed/uninstalled
8
9 @author Frederick Giasson, Structured Dynamics LLC.
10
11 \n\n\n
12 */
13
14 include_once("framework/utilities.php");
15
16 /*!@brief Instantiation of hook_install
17
18 @author Frederick Giasson, Structured Dynamics LLC.
19
20 \n\n\n
21 */
22 function conStruct_install()
23 {
24 // Create the "dataset" content type with its related additional fields.
25 import_cck_content_types();
26
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'");
30
31 // Create the default conStruct domain name where tor esolve URIs
32 global $base_url;
33
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);
36
37 variable_set("conStruct_UrisDomain", str_replace("http://", "", get_domain($normalized_base_url)));
38
39 // Set the default value for the WSG-Registry Drupal to $base_url
40 variable_set("WSF-Registry", $base_url."/ws/");
41 }
42
43
44 /*!@brief Instantiation of hook_uninstall
45
46 @author Frederick Giasson, Structured Dynamics LLC.
47
48 @todo Improve this method to find all the variables within the varitable table instead of using a fixed count.
49
50 \n\n\n
51 */
52 function conStruct_uninstall()
53 {
54 // Removing the "dataset" content type
55 node_type_delete("dataset");
56
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");
63
64 for ($i = 0; $i < 512; $i++)
65 {
66 variable_del("Dataset-$i-WSF");
67 }
68 }
69
70
71
72 /*!@brief Updating to version 6.1.1.8
73
74 @see http://drupal.org/node/136078
75
76 @author Frederick Giasson, Structured Dynamics LLC.
77
78
79 \n\n\n
80 */
81 function conStruct_update_6118()
82 {
83 // Initial version that supports upgrading.
84 }
85
86 /*!@brief Import needed CCK content types to run conStruct
87
88 @author Frederick Giasson, Structured Dynamics LLC.
89
90 \n\n\n
91 */
92 function import_cck_content_types()
93 {
94 $filename = drupal_get_path('module', 'conStruct') . "/content_types.cck";
95
96 $content = implode('', file($filename));
97
98 // Build form state
99 $form_state = array('values' => array(
100 'type_name' => '<create>',
101 'macro' => $content,
102 ),);
103
104 drupal_execute("content_copy_import_form", $form_state);
105 }
106
107
108 //@}