Revision 6325712d
Added by Andreas Kohlbecker almost 2 years ago
modules/cdm_dataportal/ext_links/ext_links.install | ||
---|---|---|
27 | 27 |
], |
28 | 28 |
'link' => [ |
29 | 29 |
'type' => 'varchar', |
30 |
'length' => 255,
|
|
30 |
'length' => 2048,
|
|
31 | 31 |
'not null' => TRUE, |
32 | 32 |
'description' => 'The link url template', |
33 | 33 |
], |
... | ... | |
90 | 90 |
* Update function to migrate previous versions |
91 | 91 |
*/ |
92 | 92 |
function ext_links_update_7001(){ |
93 |
$connection_info = Database::parseConnectionInfo(); |
|
94 |
$db_prefix = $connection_info['default']['default']['prefix']; |
|
93 | 95 |
foreach(ext_links_schema() as $table_name => $schema){ |
94 |
if(!db_table_exists($table_name)){ |
|
95 |
db_create_table($table_name, $schema); |
|
96 |
|
|
97 |
if(!db_table_exists($db_prefix . $table_name)){ |
|
98 |
db_create_table($db_prefix . $table_name, $schema); |
|
96 | 99 |
} |
97 | 100 |
} |
98 | 101 |
ext_links_install(); |
99 |
return "ext_links table crated and old settings migrated."; |
|
102 |
return "ext_links table created and old settings migrated."; |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* Update ext_link to cdm_tokens functionality |
|
107 |
*/ |
|
108 |
function ext_links_update_7002(){ |
|
109 |
$tasks_performed = []; |
|
110 |
$column_glue_exists = db_query("SHOW COLUMNS FROM {ext_links} LIKE 'glue';")->rowCount(); |
|
111 |
|
|
112 |
if($column_glue_exists){ |
|
113 |
db_query("ALTER TABLE {ext_links} DROP COLUMN glue;"); |
|
114 |
$tasks_performed[] = "ext_links table: Column glue removed."; |
|
115 |
} |
|
116 |
|
|
117 |
db_query("ALTER TABLE {ext_links} MODIFY COLUMN link varchar(2048) NOT NULL COMMENT 'The link url template';"); |
|
118 |
$tasks_performed[] = "ext_links.link modified to varchar 2048."; |
|
119 |
ext_links_template_links_update(); |
|
120 |
$tasks_performed[] = "ext_link template links updated."; |
|
121 |
|
|
122 |
return join("; \n", $tasks_performed); |
|
100 | 123 |
} |
101 | 124 |
|
125 |
|
|
102 | 126 |
/** |
103 | 127 |
* Migrates old ext link templates from drupal vars to the ext_link table. |
104 | 128 |
*/ |
... | ... | |
111 | 135 |
return $links_templates; |
112 | 136 |
} |
113 | 137 |
|
138 |
/** |
|
139 |
* Updates the ext_links.link column with new urls from the default templates. |
|
140 |
*/ |
|
141 |
function ext_links_template_links_update(){ |
|
142 |
$template_default_arrays = ext_links_template_defaults(); |
|
143 |
foreach ($template_default_arrays as $template_array) { |
|
144 |
$return = db_merge('ext_links') |
|
145 |
->key(['id' => $template_array['id']]) |
|
146 |
->fields([ |
|
147 |
'link' => $template_array['link'], |
|
148 |
]) |
|
149 |
->execute(); |
|
150 |
} |
|
151 |
} |
|
152 |
|
|
153 |
|
|
114 | 154 |
/** |
115 | 155 |
* Merge the old settings stored in drupal vars into the ext_link template object |
116 | 156 |
* @param $ext_link object |
Also available in: Unified diff
ref #9659 updating install script for ext_links using cdm_tokens