> ------------------------------------------------------------------------------ See main.inc.php for release information GMaps_Install : classe to manage plugin install --------------------------------------------------------------------------- */ include_once('gmaps_version.inc.php'); // => Don't forget to update this file !! include_once('gmaps_root.class.inc.php'); include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); /* GMaps class for install process */ class GMaps_Install extends GMaps_root { private $tablef; public function __construct($prefixeTable, $filelocation) { parent::__construct($prefixeTable, $filelocation); $this->tablef= new GPCTables($this->tables); } public function __destruct() { unset($this->tablef); parent::__destruct(); } /* function for installation process return true if install process is ok, otherwise false */ public function install() { $this->initConfig(); $this->loadConfig(); $this->config['installed']=GMAPS_VERSION2; $this->config['newInstall']='y'; $this->saveConfig(); $tables_def=array( "CREATE TABLE `".$this->tables['maps']."` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(80) NOT NULL, `displayType` char(2) NOT NULL, `sizeMode` char(1) NOT NULL, `width` int(10) unsigned NOT NULL default '470', `height` int(10) unsigned NOT NULL default '210', `zoomLevel` smallint(6) NOT NULL default '4', `mapType` varchar(9) NOT NULL default 'hybrid', `mapTypeControl` smallint(6) NOT NULL default '0', `navigationControl` smallint(6) NOT NULL default '0', `scaleControl` char(1) NOT NULL default 'y', `style` varchar(512) NOT NULL, PRIMARY KEY (`id`) )", "CREATE TABLE `".$this->tables['category_maps']."` ( `id` int(10) unsigned NOT NULL auto_increment, `categoryId` smallint(5) unsigned NOT NULL, `mapId` int(11) NOT NULL, `imgSort` smallint(5) unsigned NOT NULL default '0', `applySubCat` char(1) NOT NULL default 'y', `kmlFileUrl` varchar(255) NOT NULL, `icon` varchar(255) NOT NULL, `title` varchar(200) NOT NULL, PRIMARY KEY (`id`), KEY `byCategorie` (`categoryId`,`mapId`) )", "CREATE TABLE `".$this->tables['cache']."` ( `userId` smallint(5) NOT NULL, `requestId` timestamp NOT NULL default '0000-00-00 00:00:00', `imageId` mediumint(8) NOT NULL, `latitude` decimal(20,17) NOT NULL default '0.00000000000000000', `longitude` decimal(20,17) NOT NULL default '0.00000000000000000', `imageName` varchar(255) NOT NULL, `imageTnFile` varchar(255) NOT NULL, `imageCatsId` varchar(255) NOT NULL, `imageCatsNames` varchar(255) NOT NULL, `imageCatsPLink` varchar(255) NOT NULL, PRIMARY KEY USING BTREE (`userId`,`requestId`,`imageId`) )" ); $tables_def = create_table_add_character_set($tables_def); $result=$this->tablef->create($tables_def); unset($tables_def); GPCCore::register($this->getPluginName(), GMAPS_VERSION, GMAPS_GPC_NEEDED); return($result); } /* function for uninstall process */ public function uninstall() { $this->deleteConfig(); $this->tablef->drop(); GPCCore::unregister($this->getPluginName()); return(''); } public function activate() { $this->initConfig(); $this->loadConfig(); /* * migration code */ switch($this->config['installed']) { // actually, there no migration possible from previous release default: // nothing to do... break; } $this->config['installed']=GMAPS_VERSION2; $this->saveConfig(); GPCCore::register($this->getPluginName(), GMAPS_VERSION, GMAPS_GPC_NEEDED); return(''); } public function deactivate() { GPCRequestBuilder::unregister($this->getPluginName()); } } //class ?>