> ------------------------------------------------------------------------------ See main.inc.php for release information LMT_Install : classe to manage plugin install --------------------------------------------------------------------------- */ include_once('lmt_version.inc.php'); // => Don't forget to update this file !! @include_once('lmt_root.class.inc.php'); @include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); /* lmt class for install process */ class LMT_Install extends LMT_root { private $tablef; private $exportfile; public function __construct($prefixeTable, $filelocation) { parent::__construct($prefixeTable, $filelocation); $this->tablef= new GPCTables($this->tables); } public function __destruct() { unset($this->tablef); unset($this->exportfile); 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']=LMT_VERSION2; $this->saveConfig(); $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", ); $result=$this->tablef->create($tables_def); GPCCore::register($this->getPluginName(), LMT_VERSION, LMT_GPC_NEEDED); return($result); } /* function for uninstall process */ public function uninstall() { $this->deleteConfig(); $this->tablef->drop(); GPCCore::unregister($this->getPluginName()); return(''); } public function activate() { global $template; $this->initConfig(); $this->loadConfig(); $this->config['installed']=LMT_VERSION2; $this->saveConfig(); GPCCore::register($this->getPluginName(), LMT_VERSION, LMT_GPC_NEEDED); GPCRequestBuilder::register($this->getPluginName(), dirname($this->getFileLocation()).'/lmt_rb_callback.class.inc.php'); return(''); } public function deactivate() { GPCRequestBuilder::unregister($this->getPluginName()); } } //class ?>