> ------------------------------------------------------------------------------ See main.inc.php for release information LMT_Install : classe to manage plugin install --------------------------------------------------------------------------- */ @include_once('lmt_root.class.inc.php'); @include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php'); /* lmt class for install process */ class LMT_Install extends LMT_root { private $tablef; private $exportfile; public function LMT_Install($prefixeTable, $filelocation) { parent::__construct($prefixeTable, $filelocation); $this->tablef= new manage_tables($this->tables); $this->exportfile=dirname($this->filelocation).'/'.$this->plugin_name_files.'.sql'; } /* function for installation process return true if install process is ok, otherwise false */ public function install() { $tables_def=array( "CREATE TABLE `".$this->tables['images']."` ( `image_id` mediumint(8) unsigned NOT NULL default '0', `licence_type` char(8) NOT NULL default 'cc-none', `author_id` int UNSIGNED NOT NULL default '0', PRIMARY KEY (`image_id`), KEY `by_licence` (`licence_type`), KEY `by_author_id` (`author_id`) ) ENGINE=MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci", "CREATE TABLE `".$this->tables['licence_author']."` ( `id` int UNSIGNED NOT NULL AUTO_INCREMENT, `text1` CHAR(25) NOT NULL, `text2` CHAR(25) NOT NULL, PRIMARY KEY (`id`) ) ENGINE = MyISAM CHARACTER SET utf8 COLLATE utf8_general_ci", ); //if present, try to import backup //if backup file $import=$this->tablef->import($this->exportfile); if($import['errors']<0) { $result=$this->tablef->create_tables($tables_def); return($result); } else { return(true); } } /* function for uninstall process */ public function uninstall() { $this->tablef->export($this->exportfile); $this->delete_config(); $this->tablef->drop_tables(); return(''); } public function activate() { global $template; $this->init_config(); $this->load_config(); $this->save_config(); return(''); } public function deactivate() { } } //class ?>