additions from #1297980
[project/gmap.git] / gmap.install
CommitLineData
bba8e92a 1<?php
bba8e92a
BB
2
3/**
4 * @file
1e481919 5 * GMap install/uninstall routines.
bba8e92a
BB
6 */
7
8/**
9 * Implementation of hook_uninstall().
10 */
11function gmap_uninstall() {
12 variable_del('gmap_method');
13 variable_del('gmap_wms');
14 variable_del('gmap_default');
15 variable_del('gmap_mm_type');
16 variable_del('gmap_load_zoom_plugin');
17 variable_del('gmap_markermanager');
18 variable_del('gmap_markerfiles');
19 variable_del('gmap_node_markers');
71773ef7 20 variable_del('gmap_private_markerfile');
bba8e92a
BB
21
22 variable_del('googlemap_api_key');
23}
24
25/**
26 * Updates from 5.x-1.0alpha1 to 5.x-1.0.
27 * Do some tidying up of the settings.
28 */
29function gmap_update_5000() {
30 $ret = array();
31
32 $d = variable_get('gmap_default', array());
33
34 // Add the previous implicit baselayers back in.
35 if (!isset($d['baselayers'])) {
36 $d['baselayers'] = array(
37 // Default map type
38 'maptype' => isset($d['maptype']) ? $d['maptype'] : 'Map',
39 'Map' => 1,
40 'Satellite' => 1,
41 'Hybrid' => 1,
42 'Physical' => 0,
43 );
44 }
45
46 // Default maptype was moved into baselayers.
47 unset($d['maptype']);
48
49 // Determine the map type control that was in use.
50 if (!isset($d['mtc'])) {
51 // User had the notype behavior flag set.
52 if (!empty($d['behavior']['notype'])) {
53 $d['mtc'] = 'none';
54 }
55 else {
56 $d['mtc'] = 'standard';
57 }
58 }
59
60 // notype is gone, mtc is more generic.
61 if (isset($d['behavior']['notype'])) {
62 unset($d['behavior']['notype']);
63 }
64
65 variable_set('gmap_default', $d);
66 return $ret;
67}
68
69/**
70 * Post 5.x-1.0beta2 update 1.
71 * We added a menu callback, force a rebuild.
72 */
73function gmap_update_5001() {
74 $ret = array();
75 menu_rebuild();
76 return $ret;
77}
09c7d0ce
BB
78
79/**
80 * Mini-update -- mousewheel.js no longer needed.
81 */
82function gmap_update_5002() {
83 $ret = array();
84 variable_del('gmap_load_zoom_plugin');
85 return $ret;
86}
7643f8ca
BB
87
88/**
89 * Mini-update -- slight tweak to marker manager settings format.
90 */
91function gmap_update_5003() {
92 $ret = array();
93 $val = variable_get('gmap_markermanager', array());
94 if (isset($val['clusterer']) && isset($val['clusterer']['clusterer_file']) && !empty($val['clusterer']['clusterer_file'])) {
95 $val['clusterer']['filename'] = $val['clusterer']['clusterer_file'];
96 unset($val['clusterer']['clusterer_file']);
97 variable_set('gmap_markermanager', $val);
98 }
99 drupal_set_message(t('Border Padding on marker managers is now defaulting to the recommended 256 pixels, rather than 0 pixels. You may wish to change your marker manager settings on the <a href="@url">GMap settings page</a> to match.', array('@url' => url('admin/settings/gmap'))));
100 return $ret;
101}