Changeset 6722 for extensions/AMetaData/amd_install.class.inc.php
- Timestamp:
- Jul 28, 2010, 10:48:17 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMetaData/amd_install.class.inc.php
r5959 r6722 91 91 `order` INTEGER UNSIGNED NOT NULL DEFAULT 0, 92 92 PRIMARY KEY (`groupId`) 93 );" 94 ); 95 //$table_def array 93 );", 94 "CREATE TABLE `".$this->tables['user_tags_label']."` ( 95 `numId` INTEGER UNSIGNED NOT NULL, 96 `lang` CHAR(5) NOT NULL, 97 `label` VARCHAR(200) NOT NULL, 98 PRIMARY KEY (`numId`, `lang`) 99 );", 100 "CREATE TABLE `".$this->tables['user_tags_def']."` ( 101 `defId` int(10) unsigned NOT NULL auto_increment, 102 `parentId` int(10) unsigned NOT NULL default '0' COMMENT 'Id of the parent', 103 `numId` int(10) unsigned NOT NULL COMMENT 'Id of the tag', 104 `order` int(10) unsigned NOT NULL COMMENT 'Order, relative to the parent', 105 `type` char(1) NOT NULL default 'T' COMMENT 'T = static text ; M = metadata value ; C = condition', 106 `value` varchar(200) NOT NULL, 107 `conditionType` char(2) NOT NULL default 'E', 108 `conditionValue` varchar(200) NOT NULL, 109 PRIMARY KEY (`defId`), 110 KEY `byTagNumId` (`numId`,`parentId`,`order`), 111 KEY `byTagParentId` (`parentId`,`order`) 112 );", 113 ); 114 115 96 116 $tables_def = create_table_add_character_set($tables_def); 97 117 $result=$this->tablef->create($tables_def); … … 133 153 { 134 154 global $template, $user; 155 156 $this->initConfig(); 157 $this->loadConfig(); 158 159 /* 160 * if there is no version information available, assume the previous 161 * installed release of the plugin is 0.4.0 162 */ 163 if(!isset($this->config['installed'])) $this->config['installed']='00.04.00'; 164 165 switch($this->config['installed']) 166 { 167 case '00.04.00': 168 $this->updateFrom_000400(); 169 break; 170 default: 171 /* 172 * default is applied for fresh install, and consist to fill the 173 * database with default values 174 */ 175 $this->initializeDatabase(); 176 break; 177 } 178 179 $this->config['installed']=AMD_VERSION2; //update the installed release number 180 $this->saveConfig(); 181 } 182 183 184 public function deactivate() 185 { 186 } 187 188 /** 189 * update the database from the release 0.4.0 190 */ 191 private function updateFrom_000400() 192 { 193 /* 194 * create new tables 195 */ 196 $tableDef=array( 197 "CREATE TABLE `".$this->tables['user_tags_label']."` ( 198 `numId` INTEGER UNSIGNED NOT NULL, 199 `lang` CHAR(5) NOT NULL, 200 `label` VARCHAR(200) NOT NULL, 201 PRIMARY KEY (`numId`, `lang`) 202 );", 203 "CREATE TABLE `".$this->tables['user_tags_def']."` ( 204 `defId` int(10) unsigned NOT NULL auto_increment, 205 `parentId` int(10) unsigned NOT NULL default '0' COMMENT 'Id of the parent', 206 `numId` int(10) unsigned NOT NULL COMMENT 'Id of the tag', 207 `order` int(10) unsigned NOT NULL COMMENT 'Order, relative to the parent', 208 `type` char(1) NOT NULL default 'T' COMMENT 'T = static text ; M = metadata value ; C = condition', 209 `value` varchar(200) NOT NULL, 210 `conditionType` char(2) NOT NULL default 'E', 211 `conditionValue` varchar(200) NOT NULL, 212 PRIMARY KEY (`defId`), 213 KEY `byTagNumId` (`numId`,`parentId`,`order`), 214 KEY `byTagParentId` (`parentId`,`order`) 215 );" 216 ); 217 $tablesDef = create_table_add_character_set($tablesDef); 218 $result=$this->tablef->create($tablesDef); 219 unset($tablesDef); 220 221 /* 222 * update old tables 223 */ 224 225 // no tables to update 226 } 227 228 229 230 231 /** 232 * fill the database with some default value 233 */ 234 private function initializeDatabase() 235 { 135 236 L10n::setLanguage('en_UK'); 136 237 … … 212 313 $this->makeStatsConsolidation(); 213 314 } 214 215 $this->initConfig();216 $this->loadConfig();217 $this->config['installed']=AMD_VERSION2; //update the installed release number218 $this->saveConfig();219 }220 221 222 public function deactivate()223 {224 315 } 225 316
Note: See TracChangeset
for help on using the changeset viewer.