Newer
Older
Brandon Bergren
committed
// $Id$
Brandon Bergren
committed
/**
* Implementation of hook_install().
*/
function gmap_location_install() {
// Gmap no longer provides the location table.
drupal_set_message(t('WARNING! Obsolete gmap_location update #@num was triggered! Please verify the schema of your location table manually!', array('@num' => '1')));
drupal_set_message(t('WARNING! Obsolete gmap_location update #@num was triggered! Please verify the schema of your location table manually!', array('@num' => '2')));
Brandon Bergren
committed
// 5.x-0.8 first update
function gmap_location_update_5080() {
// Convert role markers to single variable.
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'gmap_role_map_marker_%'");
$markers = array();
while ($row = db_fetch_object($result)) {
$num = (int)substr($row->name, 21);
$markers[$num] = variable_get($row->name, 'drupal');
variable_del($row->name);
}
variable_set('gmap_role_markers', $markers);
// It's pointless to have a default when the roles will take effect in all cases.
variable_del('gmap_user_map_marker');
// Convert node type markers to single variable.
$result = db_query("SELECT name FROM {variable} WHERE name LIKE 'gmap_node_marker_%'");
$markers = array();
while ($row = db_fetch_object($result)) {
$type = substr($row->name, 17);
$markers[$type] = variable_get($row->name, 'drupal');
variable_del($row->name);
}
variable_set('gmap_node_markers', $markers);
// User location setting functionality is moving to location.module.
Brandon Bergren
committed
//variable_del('gmap_user');
//variable_del('gmap_user_profile_category');
Brandon Bergren
committed
// gmap_user_map is a single variable now.
$temp = array(
'macro' => variable_get('gmap_user_map', '[gmap |id=usermap|center=40,0|zoom=3|width=100%|height=400px]'),
'header' => variable_get('gmap_user_map_header', 'This map illustrates the extent of users of this website. Each marker indicates a user that has entered their locations.'),
'footer' => '',
);
variable_set('gmap_user_map', $temp);
variable_del('gmap_user_map_header');
// gmap_node_map is a single variable now.
$temp = array(
'macro' => variable_get('gmap_node_map', '[gmap |id=nodemap|center=40,0|zoom=3|width=100%|height=400px]'),
'header' => variable_get('gmap_node_map_header', 'This map illustrates the locations of the nodes on this website. Each marker indicates a node associated with a specific location.'),
'footer' => '',
);
variable_set('gmap_node_map', $temp);
variable_del('gmap_node_map_header');
return array();
}
/**
* Implementation of hook_uninstall().
*/
function gmap_location_uninstall() {
variable_del('gmap_user_map');
variable_del('gmap_node_map');
variable_del('gmap_node_markers');
variable_del('gmap_role_markers');