source: extensions/rv_gmaps/trunk/maintain.inc.php @ 12701

Last change on this file since 12701 was 12701, checked in by rvelices, 12 years ago

rv_gmaps auto sync gps with exif + towards full maps api v3 migration

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.5 KB
RevLine 
[3447]1<?php
2function plugin_install()
3{
4  $q = '
5ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lat` DOUBLE(8,6)';
6  pwg_query($q);
7 
8  $q = '
9ALTER TABLE '.IMAGES_TABLE.' ADD INDEX images_lat(`lat`)';
10  pwg_query($q);
11
12  $q = '
13ALTER TABLE '.IMAGES_TABLE.' ADD COLUMN `lon` DOUBLE(9,6)';
14  pwg_query($q);
15 
16  $q = '
17INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
18  VALUES
19  ("gmaps_api_key","","Google Maps API key")
20;';
21  pwg_query($q);
22}
23
24function plugin_activate()
25{
26  $dir_name = basename( dirname(__FILE__) );
27  $c = <<<EOD
28<?php
29define('PHPWG_ROOT_PATH','./');
30include_once( PHPWG_ROOT_PATH. 'plugins/$dir_name/map.php');
31?>
32EOD;
33  $fp = fopen( PHPWG_ROOT_PATH.'map.php', 'w' );
34  fwrite( $fp, $c);
35  fclose( $fp );
36
37        $old = dirname(__FILE__).'/_rvgm_config.dat';
38        if ( is_file($old) )
39        {
40          global $conf;
41                $dest = $conf['local_data_dir'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
42          if (!file_exists($dest) )
43          {
44            mkgetdir( dirname($dest) );
45                copy( $old, $dest );
46          }
47          unlink( $old );
48        }
49}
50
51function plugin_deactivate()
52{
53  @unlink( PHPWG_ROOT_PATH.'map.php' );
54  rvm_invalidate_cache();
55}
56
57function plugin_uninstall()
58{
59  $q = '
60ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lat`';
61  pwg_query( $q );
62
63  $q = '
64ALTER TABLE '.IMAGES_TABLE.' DROP COLUMN `lon`';
65  pwg_query( $q );
66
67  $q = '
[12701]68DELETE FROM '.CONFIG_TABLE.' WHERE param IN("gmaps_api_key","gmaps_auto_sync")';
[3447]69  pwg_query( $q );
70 
71  global $conf;
72        $dest = $conf['local_data_dir'].'/plugins/'.basename(dirname(__FILE__)).'.dat';
73  @unlink( $dest );
74}
75
76?>
Note: See TracBrowser for help on using the repository browser.