> ------------------------------------------------------------------------------ See main.inc.php for release information HGram_Install : classe to manage plugin install --------------------------------------------------------------------------- */ if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); include_once('hgram_version.inc.php'); // => Don't forget to update this file !! include_once('hgram_root.class.inc.php'); include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); /* HGram class for install process */ class HGram_Install extends HGram_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() { if(!file_exists(GPCCore::getPiwigoSystemPath().self::LOCAL_DIRECTORY)) { mkdir(GPCCore::getPiwigoSystemPath().self::LOCAL_DIRECTORY, 0755, true); } $this->initConfig(); $this->loadConfig(); $this->config['installed']=HGRAM_VERSION2; $this->config['newInstall']='y'; $this->saveConfig(); $tables_def=array( "CREATE TABLE `".$this->tables['histo']."` ( `imageId` INTEGER UNSIGNED NOT NULL DEFAULT 0, `valueL` VARCHAR(1792) NOT NULL, `valueA` VARCHAR(1792) NOT NULL, `valueM` VARCHAR(1792) NOT NULL, `valueR` VARCHAR(1792) NOT NULL, `valueG` VARCHAR(1792) NOT NULL, `valueB` VARCHAR(1792) NOT NULL, `graphFile` VARCHAR(36) NOT NULL, PRIMARY KEY (`imageId`) ) CHARACTER SET utf8 COLLATE utf8_general_ci", ); $result=$this->tablef->create($tables_def); GPCCore::register($this->getPluginName(), HGRAM_VERSION, HGRAM_GPC_NEEDED); return($result); } /* function for uninstall process */ public function uninstall() { GPCCore::unregister($this->getPluginName()); $this->purgeHistoCache(); $this->deleteConfig(); $this->tablef->drop(); return(''); } public function activate() { global $template; $this->initConfig(); $this->loadConfig(); $this->config['installed']=HGRAM_VERSION2; $this->saveConfig(); return(''); } public function deactivate() { } } //class ?>