Changeset 3031 for branches/2.2/phpgwapi/setup/tables_update.inc.php
- Timestamp:
- 07/12/10 10:39:22 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/phpgwapi/setup/tables_update.inc.php
r1835 r3031 10 10 \**************************************************************************/ 11 11 12 13 /* Include older phpGroupWare update support */ 14 include('tables_update_0_9_9.inc.php'); 15 include('tables_update_0_9_10.inc.php'); 16 include('tables_update_0_9_12.inc.php'); 17 18 /* This is since the last release */ 19 $test[] = '0.9.12'; 20 function phpgwapi_upgrade0_9_12() 21 { 22 global $setup_info,$phpgw_setup; 23 $setup_info['phpgwapi']['currentver'] = '0.9.13.001'; 24 return $setup_info['phpgwapi']['currentver']; 25 } 26 27 $test[] = '0.9.13.001'; 28 function phpgwapi_upgrade0_9_13_001() 29 { 30 global $setup_info,$phpgw_setup; 31 32 $phpgw_setup->oProc->AlterColumn('phpgw_categories','cat_access', array('type' => 'varchar', 'precision' => 7)); 33 34 $setup_info['phpgwapi']['currentver'] = '0.9.13.002'; 35 return $setup_info['phpgwapi']['currentver']; 36 } 37 38 $test[] = '0.9.13.002'; 39 function phpgwapi_upgrade0_9_13_002() 40 { 41 global $setup_info,$phpgw_setup; 42 43 $phpgw_setup->oProc->AddColumn('phpgw_accounts','account_file_space', array ('type' => 'varchar', 'precision' => 25)); 44 45 $setup_info['phpgwapi']['currentver'] = '0.9.13.003'; 46 return $setup_info['phpgwapi']['currentver']; 47 } 48 49 $test[] = '0.9.13.003'; 50 function phpgwapi_upgrade0_9_13_003() 51 { 52 global $setup_info,$phpgw_setup; 53 54 $phpgw_setup->oProc->AlterColumn('phpgw_access_log','sessionid',array('type' => 'char', 'precision' => 32)); 55 56 $setup_info['phpgwapi']['currentver'] = '0.9.13.004'; 57 return $setup_info['phpgwapi']['currentver']; 58 } 59 60 $test[] = '0.9.13.004'; 61 function phpgwapi_upgrade0_9_13_004() 62 { 63 global $setup_info, $phpgw_setup; 64 65 $phpgw_setup->oProc->AddColumn('phpgw_access_log','account_id',array('type' => 'int', 'precision' => 4, 'default' => 0, 'nullable' => False)); 66 67 $phpgw_setup->setup_account_object(); 68 69 $phpgw_setup->oProc->query("select * from phpgw_access_log"); 70 while($phpgw_setup->oProc->next_record()) 71 { 72 $lid = explode('@',$phpgw_setup->oProc->f('loginid')); 73 $account_lid = $lid[0]; 74 $account_id = $accounts->name2id($account_lid); 75 76 $phpgw_setup->db->query("update phpgw_access_log set account_id='" . $account_id 77 . "' where sessionid='" . $phpgw_setup->oProc->f('sessionid') . "'"); 78 } 79 80 $setup_info['phpgwapi']['currentver'] = '0.9.13.005'; 81 return $setup_info['phpgwapi']['currentver']; 82 } 83 84 $test[] = '0.9.13.005'; 85 function phpgwapi_upgrade0_9_13_005() 86 { 87 global $setup_info, $phpgw_setup; 88 89 $newtbldef = array( 90 'fd' => array( 91 'account_id' => array('type' => 'auto', 'nullable' => false), 92 'account_lid' => array('type' => 'varchar', 'precision' => 25, 'nullable' => false), 93 'account_pwd' => array('type' => 'varchar', 'precision' => 32, 'nullable' => false), 94 'account_firstname' => array('type' => 'varchar', 'precision' => 50), 95 'account_lastname' => array('type' => 'varchar', 'precision' => 50), 96 'account_permissions' => array('type' => 'text'), 97 'account_groups' => array('type' => 'varchar', 'precision' => 30), 98 'account_lastlogin' => array('type' => 'int', 'precision' => 4), 99 'account_lastloginfrom' => array('type' => 'varchar', 'precision' => 255), 100 'account_lastpwd_change' => array('type' => 'int', 'precision' => 4), 101 'account_status' => array('type' => 'char', 'precision' => 1, 'nullable' => false, 'default' => 'A'), 102 'account_expires' => array('type' => 'int', 'precision' => 4), 103 'account_type' => array('type' => 'char', 'precision' => 1, 'nullable' => true) 104 ), 105 'pk' => array('account_id'), 106 'fk' => array(), 107 'ix' => array(), 108 'uc' => array('account_lid') 109 ); 110 111 $phpgw_setup->oProc->DropColumn('phpgw_accounts',$newtbldef,'account_file_space'); 112 113 $setup_info['phpgwapi']['currentver'] = '0.9.13.006'; 114 return $setup_info['phpgwapi']['currentver']; 115 } 116 117 $test[] = '0.9.13.006'; 118 function phpgwapi_upgrade0_9_13_006() 119 { 120 global $setup_info, $phpgw_setup; 121 122 $phpgw_setup->oProc->CreateTable( 123 'phpgw_log', array( 124 'fd' => array( 125 'log_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => False), 126 'log_date' => array('type' => 'timestamp', 'nullable' => False), 127 'log_user' => array('type' => 'int', 'precision' => 4, 'nullable' => False), 128 'log_app' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), 129 'log_severity' => array('type' => 'char', 'precision' => 1, 'nullable' => False) 130 ), 131 'pk' => array('log_id'), 132 'fk' => array(), 133 'ix' => array(), 134 'uc' => array() 135 ) 136 ); 137 138 $phpgw_setup->oProc->CreateTable( 139 'phpgw_log_msg', array( 140 'fd' => array( 141 'log_msg_log_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => False), 142 'log_msg_seq_no' => array('type' => 'int', 'precision' => 4, 'nullable' => False), 143 'log_msg_date' => array('type' => 'timestamp', 'nullable' => False), 144 'log_msg_tx_fid' => array('type' => 'varchar', 'precision' => 4, 'nullable' => True), 145 'log_msg_tx_id' => array('type' => 'varchar', 'precision' => 4, 'nullable' => True), 146 'log_msg_severity' => array('type' => 'char', 'precision' => 1, 'nullable' => False), 147 'log_msg_code' => array('type' => 'varchar', 'precision' => 30, 'nullable' => False), 148 'log_msg_msg' => array('type' => 'text', 'nullable' => False), 149 'log_msg_parms' => array('type' => 'text', 'nullable' => False) 150 ), 151 'pk' => array('log_msg_log_id', 'log_msg_seq_no'), 152 'fk' => array(), 153 'ix' => array(), 154 'uc' => array() 155 ) 156 ); 157 158 $setup_info['phpgwapi']['currentver'] = '0.9.13.007'; 159 return $setup_info['phpgwapi']['currentver']; 160 } 161 162 $test[] = '0.9.13.007'; 163 function phpgwapi_upgrade0_9_13_007() 164 { 165 global $setup_info, $phpgw_setup; 166 167 $phpgw_setup->oProc->AlterColumn('phpgw_log_msg','log_msg_log_id',array('type' => 'int', 'precision' => 4, 'nullable'=> False)); 168 169 $setup_info['phpgwapi']['currentver'] = '0.9.13.008'; 170 return $setup_info['phpgwapi']['currentver']; 171 } 172 173 $test[] = '0.9.13.008'; 174 function phpgwapi_upgrade0_9_13_008() 175 { 176 global $setup_info, $phpgw_setup; 177 178 $phpgw_setup->oProc->AddColumn('phpgw_log_msg','log_msg_file',array('type' => 'varchar', 'precision' => 255, 'nullable'=> False)); 179 $phpgw_setup->oProc->AddColumn('phpgw_log_msg','log_msg_line',array('type' => 'int', 'precision' => 4, 'nullable'=> False)); 180 181 $setup_info['phpgwapi']['currentver'] = '0.9.13.009'; 182 return $setup_info['phpgwapi']['currentver']; 183 } 184 185 $test[] = '0.9.13.009'; 186 function phpgwapi_upgrade0_9_13_009() 187 { 188 global $setup_info, $phpgw_setup; 189 190 $phpgw_setup->oProc->CreateTable( 191 'phpgw_interserv', array( 192 'fd' => array( 193 'server_id' => array('type' => 'auto', 'nullable' => False), 194 'server_name' => array('type' => 'varchar', 'precision' => 64, 'nullable' => True), 195 'server_host' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True), 196 'server_url' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True), 197 'trust_level' => array('type' => 'int', 'precision' => 4), 198 'trust_rel' => array('type' => 'int', 'precision' => 4), 199 'username' => array('type' => 'varchar', 'precision' => 64, 'nullable' => True), 200 'password' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True), 201 'admin_name' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True), 202 'admin_email' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True), 203 'server_mode' => array('type' => 'varchar', 'precision' => 16, 'nullable' => False, 'default' => 'xmlrpc'), 204 'server_security' => array('type' => 'varchar', 'precision' => 16,'nullable' => True) 205 ), 206 'pk' => array('server_id'), 207 'fk' => array(), 208 'ix' => array(), 209 'uc' => array() 210 ) 211 ); 212 213 $setup_info['phpgwapi']['currentver'] = '0.9.13.010'; 214 return $setup_info['phpgwapi']['currentver']; 215 } 216 217 $test[] = '0.9.13.010'; 218 function phpgwapi_upgrade0_9_13_010() 219 { 220 global $setup_info, $phpgw_setup; 221 222 $phpgw_setup->oProc->AlterColumn('phpgw_sessions','session_lid',array('type' => 'varchar', 'precision' => 255, 'nullable'=> False)); 223 224 $setup_info['phpgwapi']['currentver'] = '0.9.13.011'; 225 return $setup_info['phpgwapi']['currentver']; 226 } 227 228 $test[] = '0.9.13.011'; 229 function phpgwapi_upgrade0_9_13_011() 230 { 231 global $setup_info, $phpgw_setup; 232 233 $phpgw_setup->oProc->CreateTable( 234 'phpgw_vfs', array( 235 'fd' => array( 236 'file_id' => array('type' => 'auto','nullable' => False), 237 'owner_id' => array('type' => 'int', 'precision' => 4,'nullable' => False), 238 'createdby_id' => array('type' => 'int', 'precision' => 4,'nullable' => True), 239 'modifiedby_id' => array('type' => 'int', 'precision' => 4,'nullable' => True), 240 'created' => array('type' => 'date','nullable' => False,'default' => '1970-01-01'), 241 'modified' => array('type' => 'date','nullable' => True), 242 'size' => array('type' => 'int', 'precision' => 4,'nullable' => True), 243 'mime_type' => array('type' => 'varchar', 'precision' => 150,'nullable' => True), 244 'deleteable' => array('type' => 'char', 'precision' => 1,'nullable' => True,'default' => 'Y'), 245 'comment' => array('type' => 'text','nullable' => True), 246 'app' => array('type' => 'varchar', 'precision' => 25,'nullable' => True), 247 'directory' => array('type' => 'text','nullable' => True), 248 'name' => array('type' => 'text','nullable' => False), 249 'link_directory' => array('type' => 'text','nullable' => True), 250 'link_name' => array('type' => 'text','nullable' => True), 251 'version' => array('type' => 'varchar', 'precision' => 30,'nullable' => False,'default' => '0.0.0.0') 252 ), 253 'pk' => array('file_id'), 254 'fk' => array(), 255 'ix' => array(), 256 'uc' => array() 257 ) 258 ); 259 $setup_info['phpgwapi']['currentver'] = '0.9.13.012'; 260 return $setup_info['phpgwapi']['currentver']; 261 } 262 263 $test[] = '0.9.13.012'; 264 function phpgwapi_upgrade0_9_13_012() 265 { 266 global $setup_info, $phpgw_setup; 267 268 $phpgw_setup->oProc->AlterColumn('phpgw_applications', 'app_tables', array('type' => 'text')); 269 270 $setup_info['phpgwapi']['currentver'] = '0.9.13.013'; 271 return $setup_info['phpgwapi']['currentver']; 272 } 273 274 $test[] = '0.9.13.013'; 275 function phpgwapi_upgrade0_9_13_013() 276 { 277 $GLOBALS['phpgw_setup']->oProc->CreateTable( 278 'phpgw_history_log', array( 279 'fd' => array( 280 'history_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => False), 281 'history_record_id' => array('type' => 'int', 'precision' => 4, 'nullable' => False), 282 'history_appname' => array('type' => 'varchar', 'precision' => 64, 'nullable' => False), 283 'history_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => False), 284 'history_status' => array('type' => 'char', 'precision' => 2, 'nullable' => False), 285 'history_new_value' => array('type' => 'text', 'nullable' => False), 286 'history_timestamp' => array('type' => 'timestamp', 'nullable' => False, 'default' => 'current_timestamp') 287 288 ), 289 'pk' => array('history_id'), 290 'fk' => array(), 291 'ix' => array(), 292 'uc' => array() 293 ) 294 ); 295 296 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.014'; 297 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 298 } 299 300 $test[] = '0.9.13.014'; 301 function phpgwapi_upgrade0_9_13_014() 302 { 303 $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_applications SET app_order=100 WHERE app_order IS NULL"); 304 $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM phpgw_applications"); 305 while ($GLOBALS['phpgw_setup']->oProc->next_record()) 306 { 307 $app_name[] = $GLOBALS['phpgw_setup']->oProc->f('app_name'); 308 $app_title[] = $GLOBALS['phpgw_setup']->oProc->f('app_title'); 309 $app_enabled[] = $GLOBALS['phpgw_setup']->oProc->f('app_enabled'); 310 $app_order[] = $GLOBALS['phpgw_setup']->oProc->f('app_order'); 311 $app_tables[] = $GLOBALS['phpgw_setup']->oProc->f('app_tables'); 312 $app_version[] = $GLOBALS['phpgw_setup']->oProc->f('app_version'); 313 } 314 315 $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_applications'); 316 317 $GLOBALS['phpgw_setup']->oProc->CreateTable( 318 'phpgw_applications', array( 319 'fd' => array( 320 'app_id' => array('type' => 'auto', 'precision' => 4, 'nullable' => false), 321 'app_name' => array('type' => 'varchar', 'precision' => 25, 'nullable' => false), 322 'app_title' => array('type' => 'varchar', 'precision' => 50), 323 'app_enabled' => array('type' => 'int', 'precision' => 4), 324 'app_order' => array('type' => 'int', 'precision' => 4), 325 'app_tables' => array('type' => 'varchar', 'precision' => 255), 326 'app_version' => array('type' => 'varchar', 'precision' => 20, 'nullable' => false, 'default' => '0.0') 327 ), 328 'pk' => array('app_id'), 329 'fk' => array(), 330 'ix' => array(), 331 'uc' => array('app_name') 332 ) 333 ); 334 335 $rec_count = count($app_name); 336 for($rec_loop=0;$rec_loop<$rec_count;$rec_loop++) 337 { 338 $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO phpgw_applications(app_id,app_name,app_title,app_enabled,app_order,app_tables,app_version) ' 339 . 'VALUES('.($rec_loop + 1).",'".$app_name[$rec_loop]."','".$app_title[$rec_loop]."',".$app_enabled[$rec_loop].','.$app_order[$rec_loop].",'".$app_tables[$rec_loop]."','".$app_version[$rec_loop]."')"); 340 } 341 342 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.015'; 343 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 344 } 345 346 $test[] = '0.9.13.015'; 347 function phpgwapi_upgrade0_9_13_015() 348 { 349 /* Skip this for mysql 3.22.X in php4 at least */ 350 if(phpversion() >= '4.0.5' && @$GLOBALS['phpgw_setup']->db->Type == 'mysql') 351 { 352 $_ver_str = @mysql_get_server_info(); 353 $_ver_arr = explode(".",$_ver_str); 354 $_ver = $_ver_arr[1]; 355 if((int)$_ver < 23) 356 { 357 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.016'; 358 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 359 } 360 } 361 362 $GLOBALS['phpgw_setup']->oProc->AlterColumn( 363 'lang', 364 'message_id', 365 array( 366 'type' => 'varchar', 367 'precision' => 255, 368 'nullable' => false, 369 'default' => '' 370 ) 371 ); 372 373 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.016'; 374 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 375 } 376 377 $test[] = '0.9.13.016'; 378 function phpgwapi_upgrade0_9_13_016() 379 { 380 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','acl_manager','hook_acl_manager.inc.php')"); 381 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','add_def_pref','hook_add_def_pref.inc.php')"); 382 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','after_navbar','hook_after_navbar.inc.php')"); 383 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','deleteaccount','hook_deleteaccount.inc.php')"); 384 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','config','hook_config.inc.php')"); 385 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','manual','hook_manual.inc.php')"); 386 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('admin','view_user','hook_view_user.inc.php')"); 387 388 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','admin_deleteaccount','hook_admin_deleteaccount.inc.php')"); 389 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','config','hook_config.inc.php')"); 390 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','manual','hook_manual.inc.php')"); 391 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','preferences','hook_preferences.inc.php')"); 392 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('preferences','settings','hook_settings.inc.php')"); 393 394 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','about','hook_about.inc.php')"); 395 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','add_def_pref','hook_add_def_pref.inc.php')"); 396 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','config_validate','hook_config_validate.inc.php')"); 397 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','deleteaccount','hook_deleteaccount.inc.php')"); 398 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','home','hook_home.inc.php')"); 399 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','manual','hook_manual.inc.php')"); 400 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_hooks (hook_appname,hook_location,hook_filename) VALUES ('addressbook','notifywindow','hook_notifywindow.inc.php')"); 401 402 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.017'; 403 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 404 } 405 406 $test[] = '0.9.13.017'; 407 function phpgwapi_upgrade0_9_13_017() 408 { 409 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_history_log','history_old_value',array('type' => 'text','nullable' => False)); 410 411 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.13.018'; 412 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 413 } 414 415 $test[] = '0.9.13.018'; 416 function phpgwapi_upgrade0_9_13_018() 417 { 418 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.000'; 419 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 420 } 421 422 $test[] = '0.9.14.000'; 423 function phpgwapi_upgrade0_9_14_000() 424 { 425 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.001'; 426 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 427 } 428 429 $test[] = '0.9.14.001'; 430 function phpgwapi_upgrade0_9_14_001() 431 { 432 // Fix bug from update script in 0.9.11.004/5: 433 // column config_app was added to table phpgw_config (which places it as last column), 434 // but in the tables_current.inc.php it was added as first column. 435 // When setup / schemaproc wants to do the AlterColum it recreates the table for pgSql, 436 // as pgSql could not change the column-type. This recreation is can not be based on 437 // tables_current, but on running tables_baseline throught all update-scripts. 438 // Which gives at the end two different versions of the table on new or updated installs. 439 // I fix it now in the (wrong) order of the tables_current, as some apps might depend on! 440 441 $confs = array(); 442 $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM phpgw_config"); 443 while ($GLOBALS['phpgw_setup']->oProc->next_record()) 444 { 445 $confs[] = array( 446 'config_app' => $GLOBALS['phpgw_setup']->oProc->f('config_app'), 447 'config_name' => $GLOBALS['phpgw_setup']->oProc->f('config_name'), 448 'config_value' => $GLOBALS['phpgw_setup']->oProc->f('config_value') 449 ); 450 } 451 $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_config'); 452 453 $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_config',array( 454 'fd' => array( 455 'config_app' => array('type' => 'varchar', 'precision' => 50), 456 'config_name' => array('type' => 'varchar', 'precision' => 255, 'nullable' => false), 457 'config_value' => array('type' => 'text') 458 ), 459 'pk' => array(), 460 'fk' => array(), 461 'ix' => array(), 462 'uc' => array('config_name') 463 )); 464 465 foreach($confs as $conf) 466 { 467 $GLOBALS['phpgw_setup']->oProc->query( 468 "INSERT INTO phpgw_config (config_app,config_name,config_value) VALUES ('". 469 $conf['config_app']."','".$conf['config_name']."','".$conf['config_value']."')"); 470 } 471 472 $GLOBALS['phpgw_setup']->oProc->query("UPDATE languages SET available='Yes' WHERE lang_id='cs'"); 473 474 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.002'; 475 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 476 } 477 478 $test[] = '0.9.14.002'; 479 function phpgwapi_upgrade0_9_14_002() 480 { 481 // 0.9.14.5xx are the development-versions of the 0.9.16 release (based on the 0.9.14 api) 482 // as 0.9.15.xxx are already used in HEAD 483 484 // this is the 0.9.15.003 update, needed for the new filemanager and vfs-classes in the api 485 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_vfs','content', array ('type' => 'text', 'nullable' => True)); 486 487 // this is the 0.9.15.004 update, needed for the polish translations 488 $GLOBALS['phpgw_setup']->oProc->query("UPDATE languages set available='Yes' WHERE lang_id='pl'"); 489 490 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.500'; 491 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 492 } 493 494 $test[] = '0.9.14.003'; 495 function phpgwapi_upgrade0_9_14_003() 496 { 497 // goes direct to 0.9.14.500 498 return phpgwapi_upgrade0_9_14_002(); 499 } 500 501 $test[] = '0.9.14.004'; 502 function phpgwapi_upgrade0_9_14_004() 503 { 504 // goes direct to 0.9.14.500 505 return phpgwapi_upgrade0_9_14_002(); 506 } 507 508 $test[] = '0.9.14.005'; 509 function phpgwapi_upgrade0_9_14_005() 510 { 511 // goes direct to 0.9.14.500 512 return phpgwapi_upgrade0_9_14_002(); 513 } 514 515 $test[] = '0.9.14.006'; 516 function phpgwapi_upgrade0_9_14_006() 517 { 518 // goes direct to 0.9.14.500 519 return phpgwapi_upgrade0_9_14_002(); 520 } 521 522 $test[] = '0.9.14.007'; 523 function phpgwapi_upgrade0_9_14_007() 524 { 525 // goes direct to 0.9.14.500 526 return phpgwapi_upgrade0_9_14_002(); 527 } 528 529 $test[] = '0.9.14.500'; 530 function phpgwapi_upgrade0_9_14_500() 531 { 532 // this is the 0.9.15.001 update 533 $GLOBALS['phpgw_setup']->oProc->RenameTable('lang','phpgw_lang'); 534 $GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages'); 535 536 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.501'; 537 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 538 } 539 540 $test[] = '0.9.14.501'; 541 function phpgwapi_upgrade0_9_14_501() 542 { 543 $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_async',array( 544 'fd' => array( 545 'id' => array('type' => 'varchar','precision' => '255','nullable' => False), 546 'next' => array('type' => 'int','precision' => '4','nullable' => False), 547 'times' => array('type' => 'varchar','precision' => '255','nullable' => False), 548 'method' => array('type' => 'varchar','precision' => '80','nullable' => False), 549 'data' => array('type' => 'text','nullable' => False) 550 ), 551 'pk' => array('id'), 552 'fk' => array(), 553 'ix' => array(), 554 'uc' => array() 555 )); 556 557 $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_applications',array( 558 'fd' => array( 559 'app_id' => array('type' => 'auto','precision' => '4','nullable' => False), 560 'app_name' => array('type' => 'varchar','precision' => '25','nullable' => False), 561 'app_enabled' => array('type' => 'int','precision' => '4'), 562 'app_order' => array('type' => 'int','precision' => '4'), 563 'app_tables' => array('type' => 'text'), 564 'app_version' => array('type' => 'varchar','precision' => '20','nullable' => False,'default' => '0.0') 565 ), 566 'pk' => array('app_id'), 567 'fk' => array(), 568 'ix' => array(), 569 'uc' => array('app_name') 570 ),'app_title'); 571 572 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.502'; 573 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 574 } 575 576 $test[] = '0.9.14.502'; 577 function phpgwapi_upgrade0_9_14_502() 578 { 579 $GLOBALS['phpgw_setup']->oProc->RenameTable('phpgw_preferences','old_preferences'); 580 581 $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_preferences',array( 582 'fd' => array( 583 'preference_owner' => array('type' => 'int','precision' => '4','nullable' => False), 584 'preference_app' => array('type' => 'varchar','precision' => '25','nullable' => False), 585 'preference_value' => array('type' => 'text','nullable' => False) 586 ), 587 'pk' => array('preference_owner','preference_app'), 588 'fk' => array(), 589 'ix' => array(), 590 'uc' => array() 591 )); 592 $db2 = $GLOBALS['phpgw_setup']->db; // we need a 2. result-set 593 $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM old_preferences"); 594 while ($GLOBALS['phpgw_setup']->oProc->next_record()) 595 { 596 $owner = (int)$GLOBALS['phpgw_setup']->oProc->f('preference_owner'); 597 $prefs = unserialize($GLOBALS['phpgw_setup']->oProc->f('preference_value')); 598 599 if (is_array($prefs)) 600 { 601 foreach ($prefs as $app => $pref) 602 { 603 if (!empty($app) && count($pref)) 604 { 605 $app = addslashes($app); 606 $pref = serialize($pref); 607 $db2->query("INSERT INTO phpgw_preferences". 608 " (preference_owner,preference_app,preference_value)". 609 " VALUES ($owner,'$app','$pref')"); 610 } 611 } 612 } 613 } 614 $GLOBALS['phpgw_setup']->oProc->DropTable('old_preferences'); 615 616 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.503'; 617 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 618 } 619 620 $test[] = '0.9.14.503'; 621 function phpgwapi_upgrade0_9_14_503() 622 { 623 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_addressbook','last_mod',array( 624 'type' => 'int', 625 'precision' => '4', 626 'nullable' => False 627 )); 628 629 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.504'; 630 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 631 } 632 633 $test[] = '0.9.14.504'; 634 function phpgwapi_upgrade0_9_14_504() 635 { 636 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_categories','last_mod',array( 637 'type' => 'int', 638 'precision' => '4', 639 'nullable' => False 640 )); 641 642 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.505'; 643 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 644 } 645 646 $test[] = '0.9.14.505'; 647 function phpgwapi_upgrade0_9_14_505() 648 { 649 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_access_log','lo',array( 650 'type' => 'int', 651 'precision' => '4', 652 'nullable' => True, 653 'default' => '0' 654 )); 655 656 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.506'; 657 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 658 } 659 660 $test[] = '0.9.14.506'; 661 function phpgwapi_upgrade0_9_14_506() 662 { 663 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_vfs','content',array( 664 'type' => 'text', 665 'nullable' => True 666 )); 667 668 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.507'; 669 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 670 } 671 672 $test[] = '0.9.14.507'; 673 function phpgwapi_upgrade0_9_14_507() 674 { 675 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_async','account_id',array( 676 'type' => 'int', 677 'precision' => '4', 678 'nullable' => False, 679 'default' => '0' 680 )); 681 682 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.508'; 683 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 684 } 685 686 $test[] = '0.9.14.508'; 687 function phpgwapi_upgrade0_9_14_508() 688 { 689 // the following if detects if we come from a phpGW version after the fork 690 // (0.9.14.508 < currentversion < 0.9.99) and running only baseline-deltas 691 if ($GLOBALS['phpgw_setup']->oProc->m_bDeltaOnly) 692 { 693 $currentver = explode('.',$GLOBALS['phpgw_setup']->process->currentversion); 694 if ($currentver[0] == 0 && $currentver[1] == 9 && 695 ($currentver[2] == 14 && $currentver[3] > 508 || 696 ($currentver[2] > 14 && $currentver[2] < 99))) 697 { 698 // this is a phpGW update from a version after the fork 699 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.509'; 700 //echo "currentver=".print_r($currentver,true)." ==> following the phpGW update path ==> ".$GLOBALS['setup_info']['phpgwapi']['currentver']."<br>\n"; 701 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 702 } 703 } 704 // update to 0.9.10pre3 droped the columns account_permissions and account_groups 705 // unfortunally they are still in the tables_current of 0.9.14.508 706 // so it depends on having a new or an updated install, if one have them or not 707 // we now check if they are there and drop them if thats the case 708 709 $GLOBALS['phpgw_setup']->oProc->m_oTranslator->_GetColumns($GLOBALS['phpgw_setup']->oProc,'phpgw_accounts',$columns); 710 $columns = explode(',',$columns); 711 if (in_array('account_permissions',$columns)) 712 { 713 $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_accounts',array( 714 'fd' => array( 715 'account_id' => array('type' => 'auto','nullable' => False), 716 'account_lid' => array('type' => 'varchar','precision' => '25','nullable' => False), 717 'account_pwd' => array('type' => 'varchar','precision' => '32','nullable' => False), 718 'account_firstname' => array('type' => 'varchar','precision' => '50'), 719 'account_lastname' => array('type' => 'varchar','precision' => '50'), 720 'account_groups' => array('type' => 'varchar','precision' => '30'), 721 'account_lastlogin' => array('type' => 'int','precision' => '4'), 722 'account_lastloginfrom' => array('type' => 'varchar','precision' => '255'), 723 'account_lastpwd_change' => array('type' => 'int','precision' => '4'), 724 'account_status' => array('type' => 'char','precision' => '1','nullable' => False,'default' => 'A'), 725 'account_expires' => array('type' => 'int','precision' => '4'), 726 'account_type' => array('type' => 'char','precision' => '1','nullable' => True) 727 ), 728 'pk' => array('account_id'), 729 'fk' => array(), 730 'ix' => array(), 731 'uc' => array('account_lid') 732 ),'account_permissions'); 733 } 734 if (in_array('account_groups',$columns)) 735 { 736 $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_accounts',array( 737 'fd' => array( 738 'account_id' => array('type' => 'auto','nullable' => False), 739 'account_lid' => array('type' => 'varchar','precision' => '25','nullable' => False), 740 'account_pwd' => array('type' => 'varchar','precision' => '32','nullable' => False), 741 'account_firstname' => array('type' => 'varchar','precision' => '50'), 742 'account_lastname' => array('type' => 'varchar','precision' => '50'), 743 'account_lastlogin' => array('type' => 'int','precision' => '4'), 744 'account_lastloginfrom' => array('type' => 'varchar','precision' => '255'), 745 'account_lastpwd_change' => array('type' => 'int','precision' => '4'), 746 'account_status' => array('type' => 'char','precision' => '1','nullable' => False,'default' => 'A'), 747 'account_expires' => array('type' => 'int','precision' => '4'), 748 'account_type' => array('type' => 'char','precision' => '1','nullable' => True) 749 ), 750 'pk' => array('account_id'), 751 'fk' => array(), 752 'ix' => array(), 753 'uc' => array('account_lid') 754 ),'account_groups'); 755 } 756 757 // we add the person_id from the .16RC1, if its not already there 758 if (!in_array('person_id',$columns)) 759 { 760 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_accounts','person_id',array( 761 'type' => 'int', 762 'precision' => '4', 763 'nullable' => True 764 )); 765 } 766 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_accounts','account_primary_group',array( 767 'type' => 'int', 768 'precision' => '4', 769 'nullable' => False, 770 'default' => '0' 771 )); 772 773 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.002'; 774 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 775 } 776 777 $test[] = '0.9.99.002'; 778 function phpgwapi_upgrade0_9_99_002() 779 { 780 // needed for the chinese(simplified) translations 781 $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET lang_name='Chinese(simplified)',available='Yes' WHERE lang_id='zh'"); 782 783 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.003'; 784 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 785 } 786 787 /* 788 * Updates from phpGroupWare after the fork 789 */ 790 791 $test[] = '0.9.14.509'; 792 function phpgwapi_upgrade0_9_14_509() 793 { 794 return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.510'; 795 } 796 797 $test[] = '0.9.14.510'; 798 function phpgwapi_upgrade0_9_14_510() 799 { 800 $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_log_msg'); 801 $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_log'); 802 $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_log',array( 803 'fd' => array( 804 'log_id' => array('type' => 'auto','precision' => '4','nullable' => False), 805 'log_date' => array('type' => 'timestamp','nullable' => False), 806 'log_account_id' => array('type' => 'int','precision' => '4','nullable' => False), 807 'log_account_lid' => array('type' => 'varchar','precision' => '25','nullable' => False), 808 'log_app' => array('type' => 'varchar','precision' => '25','nullable' => False), 809 'log_severity' => array('type' => 'char','precision' => '1','nullable' => False), 810 'log_file' => array('type' => 'varchar','precision' => '255','nullable' => False, 'default' => ''), 811 'log_line' => array('type' => 'int','precision' => '4','nullable' => False, 'default' => '0'), 812 'log_msg' => array('type' => 'text','nullable' => False) 813 ), 814 'pk' => array('log_id'), 815 'fk' => array(), 816 'ix' => array(), 817 'uc' => array() 818 )); 819 return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.511'; 820 } 821 822 $test[] = '0.9.14.511'; 823 function phpgwapi_upgrade0_9_14_511() 824 { 825 return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.512'; 826 } 827 828 $test[] = '0.9.14.512'; 829 function phpgwapi_upgrade0_9_14_512() 830 { 831 return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.513'; 832 } 833 834 $test[] = '0.9.14.513'; 835 function phpgwapi_upgrade0_9_14_513() 836 { 837 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_accounts','account_quota',array('type' => 'int','precision' => '4','default' => -1,'nullable' => True)); 838 return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.514'; 839 } 840 841 $test[] = '0.9.14.514'; 842 function phpgwapi_upgrade0_9_14_514() 843 { 844 return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.16.000'; 845 } 846 847 $test[] = '0.9.16.000'; 848 function phpgwapi_upgrade0_9_16_000() 849 { 850 return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.16.001'; 851 } 852 853 $test[] = '0.9.16.001'; 854 function phpgwapi_upgrade0_9_16_001() 855 { 856 foreach($GLOBALS['phpgw_setup']->db->table_names() as $tableinfo) 857 { 858 $tablenames[] = $tableinfo['table_name']; 859 } 860 // we need to redo the 0.9.14.510 update with the new phpgw_log table 861 // we just drop and recreate the table, as it contains no important data 862 $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_log'); 863 $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_log',array( 864 'fd' => array( 865 'log_id' => array('type' => 'auto','precision' => '4','nullable' => False), 866 'log_date' => array('type' => 'timestamp','nullable' => False), 867 'log_user' => array('type' => 'int','precision' => '4','nullable' => False), 868 'log_app' => array('type' => 'varchar','precision' => '50','nullable' => False), 869 'log_severity' => array('type' => 'char','precision' => '1','nullable' => False) 870 ), 871 'pk' => array('log_id'), 872 'fk' => array(), 873 'ix' => array(), 874 'uc' => array() 875 )); 876 if (in_array('phpgw_log_msg',$tablenames)) 877 { 878 $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_log_msg'); 879 } 880 $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_log_msg',array( 881 'fd' => array( 882 'log_msg_log_id' => array('type' => 'int','precision' => '4','nullable' => False), 883 'log_msg_seq_no' => array('type' => 'int','precision' => '4','nullable' => False), 884 'log_msg_date' => array('type' => 'timestamp','nullable' => False), 885 'log_msg_tx_fid' => array('type' => 'varchar','precision' => '4','nullable' => True), 886 'log_msg_tx_id' => array('type' => 'varchar','precision' => '4','nullable' => True), 887 'log_msg_severity' => array('type' => 'char','precision' => '1','nullable' => False), 888 'log_msg_code' => array('type' => 'varchar','precision' => '30','nullable' => False), 889 'log_msg_msg' => array('type' => 'text','nullable' => False), 890 'log_msg_parms' => array('type' => 'text','nullable' => False), 891 'log_msg_file' => array('type' => 'varchar','precision' => '255','nullable' => False), 892 'log_msg_line' => array('type' => 'int','precision' => '4','nullable' => False) 893 ), 894 'pk' => array('log_msg_log_id','log_msg_seq_no'), 895 'fk' => array(), 896 'ix' => array(), 897 'uc' => array() 898 )); 899 900 // now we need to drop phpgw_accounts.accounts_quota from the 0.9.14.513 update 901 $GLOBALS['phpgw_setup']->oProc->m_oTranslator->_GetColumns($GLOBALS['phpgw_setup']->oProc,'phpgw_accounts',$columns); 902 $columns = explode(',',$columns); 903 if (in_array('account_quota',$columns)) 904 { 905 $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_accounts',array( 906 'fd' => array( 907 'account_id' => array('type' => 'auto','nullable' => False), 908 'account_lid' => array('type' => 'varchar','precision' => '25','nullable' => False), 909 'account_pwd' => array('type' => 'varchar','precision' => '32','nullable' => False), 910 'account_firstname' => array('type' => 'varchar','precision' => '50'), 911 'account_lastname' => array('type' => 'varchar','precision' => '50'), 912 'account_lastlogin' => array('type' => 'int','precision' => '4'), 913 'account_lastloginfrom' => array('type' => 'varchar','precision' => '255'), 914 'account_lastpwd_change' => array('type' => 'int','precision' => '4'), 915 'account_status' => array('type' => 'char','precision' => '1','nullable' => False,'default' => 'A'), 916 'account_expires' => array('type' => 'int','precision' => '4'), 917 'account_type' => array('type' => 'char','precision' => '1','nullable' => True) 918 ), 919 'pk' => array('account_id'), 920 'fk' => array(), 921 'ix' => array(), 922 'uc' => array('account_lid') 923 ),'account_quota'); 924 } 925 /* we dont drop phpGW's new contacts tables for now ;-) 926 foreach(array( 927 'phpgw_contact', 928 'phpgw_contact_person', 929 'phpgw_contact_org', 930 'phpgw_contact_org_person', 931 'phpgw_contact_addr', 932 'phpgw_contact_note', 933 'phpgw_contact_others', 934 'phpgw_contact_comm', 935 'phpgw_contact_comm_descr', 936 'phpgw_contact_comm_type', 937 'phpgw_contact_types', 938 'phpgw_contact_addr_type', 939 'phpgw_contact_note_type' 940 ) as $table) 941 { 942 $GLOBALS['phpgw_setup']->oProc->DropTable($table); 943 }*/ 944 945 // we need to check if we stil have the original addressbook-tables and create them again if not 946 if (!in_array('phpgw_addressbook',$tablenames)) 947 { 948 $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_addressbook',array( 949 'fd' => array( 950 'id' => array('type' => 'auto','nullable' => False), 951 'lid' => array('type' => 'varchar','precision' => '32'), 952 'tid' => array('type' => 'char','precision' => '1'), 953 'owner' => array('type' => 'int','precision' => '8'), 954 'access' => array('type' => 'varchar','precision' => '7'), 955 'cat_id' => array('type' => 'varchar','precision' => '32'), 956 'fn' => array('type' => 'varchar','precision' => '64'), 957 'n_family' => array('type' => 'varchar','precision' => '64'), 958 'n_given' => array('type' => 'varchar','precision' => '64'), 959 'n_middle' => array('type' => 'varchar','precision' => '64'), 960 'n_prefix' => array('type' => 'varchar','precision' => '64'), 961 'n_suffix' => array('type' => 'varchar','precision' => '64'), 962 'sound' => array('type' => 'varchar','precision' => '64'), 963 'bday' => array('type' => 'varchar','precision' => '32'), 964 'note' => array('type' => 'text'), 965 'tz' => array('type' => 'varchar','precision' => '8'), 966 'geo' => array('type' => 'varchar','precision' => '32'), 967 'url' => array('type' => 'varchar','precision' => '128'), 968 'pubkey' => array('type' => 'text'), 969 'org_name' => array('type' => 'varchar','precision' => '64'), 970 'org_unit' => array('type' => 'varchar','precision' => '64'), 971 'title' => array('type' => 'varchar','precision' => '64'), 972 'adr_one_street' => array('type' => 'varchar','precision' => '64'), 973 'adr_one_locality' => array('type' => 'varchar','precision' => '64'), 974 'adr_one_region' => array('type' => 'varchar','precision' => '64'), 975 'adr_one_postalcode' => array('type' => 'varchar','precision' => '64'), 976 'adr_one_countryname' => array('type' => 'varchar','precision' => '64'), 977 'adr_one_type' => array('type' => 'varchar','precision' => '32'), 978 'label' => array('type' => 'text'), 979 'adr_two_street' => array('type' => 'varchar','precision' => '64'), 980 'adr_two_locality' => array('type' => 'varchar','precision' => '64'), 981 'adr_two_region' => array('type' => 'varchar','precision' => '64'), 982 'adr_two_postalcode' => array('type' => 'varchar','precision' => '64'), 983 'adr_two_countryname' => array('type' => 'varchar','precision' => '64'), 984 'adr_two_type' => array('type' => 'varchar','precision' => '32'), 985 'tel_work' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 986 'tel_home' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 987 'tel_voice' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 988 'tel_fax' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 989 'tel_msg' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 990 'tel_cell' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 991 'tel_pager' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 992 'tel_bbs' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 993 'tel_modem' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 994 'tel_car' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 995 'tel_isdn' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 996 'tel_video' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 997 'tel_prefer' => array('type' => 'varchar','precision' => '32'), 998 'email' => array('type' => 'varchar','precision' => '64'), 999 'email_type' => array('type' => 'varchar','precision' => '32','default' => 'INTERNET'), 1000 'email_home' => array('type' => 'varchar','precision' => '64'), 1001 'email_home_type' => array('type' => 'varchar','precision' => '32','default' => 'INTERNET'), 1002 'last_mod' => array('type' => 'int','precision' => '8','nullable' => False) 1003 ), 1004 'pk' => array('id'), 1005 'fk' => array(), 1006 'ix' => array(array('tid','owner','access','n_family','n_given','email'),array('tid','cat_id','owner','access','n_family','n_given','email')), 1007 'uc' => array() 1008 )); 1009 $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_addressbook_extra',array( 1010 'fd' => array( 1011 'contact_id' => array('type' => 'int','precision' => '4','nullable' => False), 1012 'contact_owner' => array('type' => 'int','precision' => '8'), 1013 'contact_name' => array('type' => 'varchar','precision' => '255','nullable' => False), 1014 'contact_value' => array('type' => 'text') 1015 ), 1016 'pk' => array('contact_id','contact_name'), 1017 'fk' => array(), 1018 'ix' => array(), 1019 'uc' => array() 1020 )); 1021 } 1022 // now we return to the version of the fork 1023 return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.508'; 1024 } 1025 1026 /* 1027 * Updates / downgrades from phpGroupWare HEAD branch 1028 */ 1029 1030 $test[] = '0.9.15.013'; 1031 function phpgwapi_upgrade0_9_15_013() 1032 { 1033 // is db-compatible to 0.9.14.507 1034 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.507'; 1035 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1036 } 1037 1038 $test[] = '0.9.15.014'; 1039 function phpgwapi_upgrade0_9_15_014() 1040 { 1041 // is db-compatible to 0.9.14.508 1042 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.14.508'; 1043 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1044 } 1045 1046 /* 1047 * More eGroupWare 0.9.99 updates 1048 */ 1049 1050 $test[] = '0.9.99.003'; 1051 function phpgwapi_upgrade0_9_99_003() 1052 { 1053 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_id',array( 1054 'type' => 'auto' 1055 )); 1056 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lid',array( 1057 'type' => 'varchar', 1058 'precision' => '25' 1059 )); 1060 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_firstname',array( 1061 'type' => 'varchar', 1062 'precision' => '50' 1063 )); 1064 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lastname',array( 1065 'type' => 'varchar', 1066 'precision' => '50' 1067 )); 1068 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lastlogin',array( 1069 'type' => 'int', 1070 'precision' => '4' 1071 )); 1072 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lastloginfrom',array( 1073 'type' => 'varchar', 1074 'precision' => '255' 1075 )); 1076 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_lastpwd_change',array( 1077 'type' => 'int', 1078 'precision' => '4' 1079 )); 1080 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts','account_expires',array( 1081 'type' => 'int', 1082 'precision' => '4' 1083 )); 1084 1085 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.004'; 1086 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1087 } 1088 1089 $test[] = '0.9.99.004'; 1090 function phpgwapi_upgrade0_9_99_004() 1091 { 1092 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_app_sessions','content',array( 1093 'type' => 'longtext' 1094 )); 1095 1096 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.005'; 1097 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1098 } 1099 1100 $test[] = '0.9.99.005'; 1101 function phpgwapi_upgrade0_9_99_005() 1102 { 1103 $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='sl'"); 1104 1105 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.006'; 1106 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1107 } 1108 1109 $test[] = '0.9.99.006'; 1110 function phpgwapi_upgrade0_9_99_006() 1111 { 1112 $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='pt'"); 1113 1114 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.007'; 1115 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1116 } 1117 1118 $test[] = '0.9.99.007'; 1119 function phpgwapi_upgrade0_9_99_007() 1120 { 1121 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_languages', 'lang_id', array('type' => 'varchar','precision' => '5','nullable' => False)); 1122 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('pt-br','Brazil','Yes')"); 1123 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.008'; 1124 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1125 } 1126 1127 $test[] = '0.9.99.008'; 1128 function phpgwapi_upgrade0_9_99_008() 1129 { 1130 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('es-es','Spanish / Spain','Yes')"); 1131 $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('es-mx','Spanish / Mexico','Yes')"); 1132 $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM phpgw_languages where lang_id='es'"); 1133 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.009'; 1134 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1135 } 1136 1137 $test[] = '0.9.99.009'; 1138 function phpgwapi_upgrade0_9_99_009() 1139 { 1140 $GLOBALS['phpgw_setup']->oProc->AlterColumn( 1141 'phpgw_accounts', 1142 'account_pwd', 1143 array('type' => 'varchar','precision' => '100','nullable' => False) 1144 ); 1145 1146 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.010'; 1147 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1148 } 1149 1150 $test[] = '0.9.99.010'; 1151 function phpgwapi_upgrade0_9_99_010() 1152 { 1153 $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='uk'"); 1154 1155 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.011'; 1156 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1157 } 1158 1159 $test[] = '0.9.99.011'; 1160 function phpgwapi_upgrade0_9_99_011() 1161 { 1162 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_categories','last_mod',array( 1163 'type' => 'int', 1164 'precision' => '8', 1165 'nullable' => False 1166 )); 1167 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_addressbook','last_mod',array( 1168 'type' => 'int', 1169 'precision' => '8', 1170 'nullable' => False 1171 )); 1172 1173 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.012'; 1174 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1175 } 1176 1177 $test[] = '0.9.99.012'; 1178 function phpgwapi_upgrade0_9_99_012() 1179 { 1180 $GLOBALS['phpgw_setup']->oProc->AlterColumn( 1181 'phpgw_accounts', 1182 'account_lid', 1183 array('type' => 'varchar','precision' => '25','nullable' => False) 1184 ); 1185 1186 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.013'; 1187 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1188 } 1189 1190 $test[] = '0.9.99.013'; 1191 function phpgwapi_upgrade0_9_99_013() 1192 { 1193 // this update fixes the problem that some users cant change their password 1194 // it was caused be 0 acl_rights values in groups (inserted by setup::add_acl which is fixed too) 1195 $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM phpgw_acl WHERE acl_appname='preferences' AND acl_location='changepassword' AND acl_rights=0"); 1196 1197 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.014'; 1198 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1199 } 1200 1201 $test[] = '0.9.99.014'; 1202 function phpgwapi_upgrade0_9_99_014() 1203 { 1204 // enabeling russian language 1205 $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='ru'"); 1206 1207 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.015'; 1208 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1209 } 1210 1211 1212 // the following series of upgrades create indices for the api tables, RalfBecker 2004/04/03 1213 1214 $test[] = '0.9.99.015'; 1215 function phpgwapi_upgrade0_9_99_015() 1216 { 1217 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_acl',array( 1218 'fd' => array( 1219 'acl_appname' => array('type' => 'varchar','precision' => '50','nullable' => False), 1220 'acl_location' => array('type' => 'varchar','precision' => '255','nullable' => False), 1221 'acl_account' => array('type' => 'int','precision' => '4','nullable' => False), 1222 'acl_rights' => array('type' => 'int','precision' => '4') 1223 ), 1224 'pk' => array('acl_appname','acl_location','acl_account'), 1225 'fk' => array(), 1226 'ix' => array('acl_account',array('acl_location','acl_account'),array('acl_appname','acl_account')), 1227 'uc' => array() 1228 )); 1229 1230 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.016'; 1231 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1232 } 1233 1234 1235 $test[] = '0.9.99.016'; 1236 function phpgwapi_upgrade0_9_99_016() 1237 { 1238 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_categories',array( 1239 'fd' => array( 1240 'cat_id' => array('type' => 'auto','precision' => '4','nullable' => False), 1241 'cat_main' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), 1242 'cat_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), 1243 'cat_level' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '0'), 1244 'cat_owner' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), 1245 'cat_access' => array('type' => 'varchar','precision' => '7'), 1246 'cat_appname' => array('type' => 'varchar','precision' => '50','nullable' => False), 1247 'cat_name' => array('type' => 'varchar','precision' => '150','nullable' => False), 1248 'cat_description' => array('type' => 'varchar','precision' => '255','nullable' => False), 1249 'cat_data' => array('type' => 'text'), 1250 'last_mod' => array('type' => 'int','precision' => '8','nullable' => False) 1251 ), 1252 'pk' => array('cat_id'), 1253 'fk' => array(), 1254 'ix' => array(array('cat_appname','cat_owner','cat_parent','cat_level')), 1255 'uc' => array() 1256 )); 1257 1258 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.017'; 1259 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1260 } 1261 1262 1263 $test[] = '0.9.99.017'; 1264 function phpgwapi_upgrade0_9_99_017() 1265 { 1266 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_lang',array( 1267 'fd' => array( 1268 'lang' => array('type' => 'varchar','precision' => '5','nullable' => False,'default' => ''), 1269 'app_name' => array('type' => 'varchar','precision' => '100','nullable' => False,'default' => 'common'), 1270 'message_id' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => ''), 1271 'content' => array('type' => 'text') 1272 ), 1273 'pk' => array('lang','app_name','message_id'), 1274 'fk' => array(), 1275 'ix' => array(), 1276 'uc' => array() 1277 )); 1278 1279 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.018'; 1280 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1281 } 1282 1283 1284 $test[] = '0.9.99.018'; 1285 function phpgwapi_upgrade0_9_99_018() 1286 { 1287 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_config',array( 1288 'fd' => array( 1289 'config_app' => array('type' => 'varchar','precision' => '50','nullable' => False), 1290 'config_name' => array('type' => 'varchar','precision' => '255','nullable' => False), 1291 'config_value' => array('type' => 'text') 1292 ), 1293 'pk' => array('config_app','config_name'), 1294 'fk' => array(), 1295 'ix' => array(), 1296 'uc' => array() 1297 )); 1298 1299 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.019'; 1300 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1301 } 1302 1303 1304 $test[] = '0.9.99.019'; 1305 function phpgwapi_upgrade0_9_99_019() 1306 { 1307 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_applications',array( 1308 'fd' => array( 1309 'app_id' => array('type' => 'auto','precision' => '4','nullable' => False), 1310 'app_name' => array('type' => 'varchar','precision' => '25','nullable' => False), 1311 'app_enabled' => array('type' => 'int','precision' => '4','nullable' => False), 1312 'app_order' => array('type' => 'int','precision' => '4','nullable' => False), 1313 'app_tables' => array('type' => 'text','nullable' => False), 1314 'app_version' => array('type' => 'varchar','precision' => '20','nullable' => False,'default' => '0.0') 1315 ), 1316 'pk' => array('app_id'), 1317 'fk' => array(), 1318 'ix' => array(array('app_enabled','app_order')), 1319 'uc' => array('app_name') 1320 )); 1321 1322 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.020'; 1323 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1324 } 1325 1326 1327 $test[] = '0.9.99.020'; 1328 function phpgwapi_upgrade0_9_99_020() 1329 { 1330 // at least for postgres we need to change the colum-type, else we get an error in RefreshTable 1331 $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_app_sessions','loginid',array( 1332 'type' => 'int','precision' => '4','nullable' => False 1333 )); 1334 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_app_sessions',array( 1335 'fd' => array( 1336 'sessionid' => array('type' => 'varchar','precision' => '128','nullable' => False), 1337 'loginid' => array('type' => 'int','precision' => '4','nullable' => False), 1338 'app' => array('type' => 'varchar','precision' => '25','nullable' => False), 1339 'location' => array('type' => 'varchar','precision' => '128','nullable' => False), 1340 'content' => array('type' => 'longtext'), 1341 'session_dla' => array('type' => 'int','precision' => '4') 1342 ), 1343 'pk' => array('sessionid','loginid','location','app'), 1344 'fk' => array(), 1345 'ix' => array(), 1346 'uc' => array() 1347 )); 1348 1349 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.021'; 1350 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1351 } 1352 1353 1354 $test[] = '0.9.99.021'; 1355 function phpgwapi_upgrade0_9_99_021() 1356 { 1357 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_sessions',array( 1358 'fd' => array( 1359 'session_id' => array('type' => 'varchar','precision' => '128','nullable' => False), 1360 'session_lid' => array('type' => 'varchar','precision' => '128'), 1361 'session_ip' => array('type' => 'varchar','precision' => '32'), 1362 'session_logintime' => array('type' => 'int','precision' => '4'), 1363 'session_dla' => array('type' => 'int','precision' => '4'), 1364 'session_action' => array('type' => 'varchar','precision' => '255'), 1365 'session_flags' => array('type' => 'char','precision' => '2') 1366 ), 1367 'pk' => array(), 1368 'fk' => array(), 1369 'ix' => array(array('session_flags','session_dla')), 1370 'uc' => array('session_id') 1371 )); 1372 1373 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.022'; 1374 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1375 } 1376 1377 1378 $test[] = '0.9.99.022'; 1379 function phpgwapi_upgrade0_9_99_022() 1380 { 1381 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_history_log',array( 1382 'fd' => array( 1383 'history_id' => array('type' => 'auto','precision' => '4','nullable' => False), 1384 'history_record_id' => array('type' => 'int','precision' => '4','nullable' => False), 1385 'history_appname' => array('type' => 'varchar','precision' => '64','nullable' => False), 1386 'history_owner' => array('type' => 'int','precision' => '4','nullable' => False), 1387 'history_status' => array('type' => 'char','precision' => '2','nullable' => False), 1388 'history_new_value' => array('type' => 'text','nullable' => False), 1389 'history_timestamp' => array('type' => 'timestamp','nullable' => False,'default' => 'current_timestamp'), 1390 'history_old_value' => array('type' => 'text','nullable' => False) 1391 ), 1392 'pk' => array('history_id'), 1393 'fk' => array(), 1394 'ix' => array(array('history_appname','history_record_id','history_status','history_timestamp')), 1395 'uc' => array() 1396 )); 1397 1398 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.023'; 1399 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1400 } 1401 1402 1403 $test[] = '0.9.99.023'; 1404 function phpgwapi_upgrade0_9_99_023() 1405 { 1406 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_vfs',array( 1407 'fd' => array( 1408 'file_id' => array('type' => 'auto','nullable' => False), 1409 'owner_id' => array('type' => 'int','precision' => '4','nullable' => False), 1410 'createdby_id' => array('type' => 'int','precision' => '4'), 1411 'modifiedby_id' => array('type' => 'int','precision' => '4'), 1412 'created' => array('type' => 'date','nullable' => False,'default' => '1970-01-01'), 1413 'modified' => array('type' => 'date'), 1414 'size' => array('type' => 'int','precision' => '4'), 1415 'mime_type' => array('type' => 'varchar','precision' => '64'), 1416 'deleteable' => array('type' => 'char','precision' => '1','default' => 'Y'), 1417 'comment' => array('type' => 'varchar','precision' => '255'), 1418 'app' => array('type' => 'varchar','precision' => '25'), 1419 'directory' => array('type' => 'varchar','precision' => '255'), 1420 'name' => array('type' => 'varchar','precision' => '128','nullable' => False), 1421 'link_directory' => array('type' => 'varchar','precision' => '255'), 1422 'link_name' => array('type' => 'varchar','precision' => '128'), 1423 'version' => array('type' => 'varchar','precision' => '30','nullable' => False,'default' => '0.0.0.0'), 1424 'content' => array('type' => 'text') 1425 ), 1426 'pk' => array('file_id'), 1427 'fk' => array(), 1428 'ix' => array(array('directory','name','mime_type')), 1429 'uc' => array() 1430 )); 1431 1432 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.024'; 1433 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1434 } 1435 1436 1437 $test[] = '0.9.99.024'; 1438 function phpgwapi_upgrade0_9_99_024() 1439 { 1440 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_addressbook_extra',array( 1441 'fd' => array( 1442 'contact_id' => array('type' => 'int','precision' => '4','nullable' => False), 1443 'contact_owner' => array('type' => 'int','precision' => '8'), 1444 'contact_name' => array('type' => 'varchar','precision' => '255','nullable' => False), 1445 'contact_value' => array('type' => 'text') 1446 ), 1447 'pk' => array('contact_id','contact_name'), 1448 'fk' => array(), 1449 'ix' => array(), 1450 'uc' => array() 1451 )); 1452 1453 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.99.025'; 1454 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1455 } 1456 1457 1458 $test[] = '0.9.99.025'; 1459 function phpgwapi_upgrade0_9_99_025() 1460 { 1461 $GLOBALS['phpgw_setup']->oProc->RefreshTable('phpgw_addressbook',array( 1462 'fd' => array( 1463 'id' => array('type' => 'auto','nullable' => False), 1464 'lid' => array('type' => 'varchar','precision' => '32'), 1465 'tid' => array('type' => 'char','precision' => '1'), 1466 'owner' => array('type' => 'int','precision' => '8'), 1467 'access' => array('type' => 'varchar','precision' => '7'), 1468 'cat_id' => array('type' => 'varchar','precision' => '32'), 1469 'fn' => array('type' => 'varchar','precision' => '64'), 1470 'n_family' => array('type' => 'varchar','precision' => '64'), 1471 'n_given' => array('type' => 'varchar','precision' => '64'), 1472 'n_middle' => array('type' => 'varchar','precision' => '64'), 1473 'n_prefix' => array('type' => 'varchar','precision' => '64'), 1474 'n_suffix' => array('type' => 'varchar','precision' => '64'), 1475 'sound' => array('type' => 'varchar','precision' => '64'), 1476 'bday' => array('type' => 'varchar','precision' => '32'), 1477 'note' => array('type' => 'text'), 1478 'tz' => array('type' => 'varchar','precision' => '8'), 1479 'geo' => array('type' => 'varchar','precision' => '32'), 1480 'url' => array('type' => 'varchar','precision' => '128'), 1481 'pubkey' => array('type' => 'text'), 1482 'org_name' => array('type' => 'varchar','precision' => '64'), 1483 'org_unit' => array('type' => 'varchar','precision' => '64'), 1484 'title' => array('type' => 'varchar','precision' => '64'), 1485 'adr_one_street' => array('type' => 'varchar','precision' => '64'), 1486 'adr_one_locality' => array('type' => 'varchar','precision' => '64'), 1487 'adr_one_region' => array('type' => 'varchar','precision' => '64'), 1488 'adr_one_postalcode' => array('type' => 'varchar','precision' => '64'), 1489 'adr_one_countryname' => array('type' => 'varchar','precision' => '64'), 1490 'adr_one_type' => array('type' => 'varchar','precision' => '32'), 1491 'label' => array('type' => 'text'), 1492 'adr_two_street' => array('type' => 'varchar','precision' => '64'), 1493 'adr_two_locality' => array('type' => 'varchar','precision' => '64'), 1494 'adr_two_region' => array('type' => 'varchar','precision' => '64'), 1495 'adr_two_postalcode' => array('type' => 'varchar','precision' => '64'), 1496 'adr_two_countryname' => array('type' => 'varchar','precision' => '64'), 1497 'adr_two_type' => array('type' => 'varchar','precision' => '32'), 1498 'tel_work' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1499 'tel_home' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1500 'tel_voice' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1501 'tel_fax' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1502 'tel_msg' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1503 'tel_cell' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1504 'tel_pager' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1505 'tel_bbs' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1506 'tel_modem' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1507 'tel_car' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1508 'tel_isdn' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1509 'tel_video' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => '+1 (000) 000-0000'), 1510 'tel_prefer' => array('type' => 'varchar','precision' => '32'), 1511 'email' => array('type' => 'varchar','precision' => '64'), 1512 'email_type' => array('type' => 'varchar','precision' => '32','default' => 'INTERNET'), 1513 'email_home' => array('type' => 'varchar','precision' => '64'), 1514 'email_home_type' => array('type' => 'varchar','precision' => '32','default' => 'INTERNET'), 1515 'last_mod' => array('type' => 'int','precision' => '8','nullable' => False) 1516 ), 1517 'pk' => array('id'), 1518 'fk' => array(), 1519 'ix' => array(array('tid','owner','access','n_family','n_given','email'),array('tid','cat_id','owner','access','n_family','n_given','email')), 1520 'uc' => array() 1521 )); 1522 1523 // we dont need to do update 0.9.99.026, as UpdateSequenze is called now by RefreshTable 1524 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0'; 1525 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1526 } 1527 1528 1529 $test[] = '0.9.99.026'; 1530 function phpgwapi_upgrade0_9_99_026() 1531 { 1532 // update the sequenzes for refreshed tables (postgres only) 1533 $GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_categories','cat_id'); 1534 $GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_applications','app_id'); 1535 $GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_history_log','history_id'); 1536 $GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_vfs','file_id'); 1537 $GLOBALS['phpgw_setup']->oProc->UpdateSequence('phpgw_addressbook','id'); 1538 1539 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0'; 1540 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1541 } 1542 1543 1544 $test[] = '1.0.0'; 1545 function phpgwapi_upgrade1_0_0() 1546 { 1547 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_accounts','account_email',array( 1548 'type' => 'varchar', 1549 'precision' => '100' 1550 )); 1551 1552 $GLOBALS['phpgw_setup']->oProc->query("SELECT config_value FROM phpgw_config WHERE config_app='phpgwapi' AND config_name='mail_suffix'",__LINE__,__FILE__); 1553 $mail_domain = $GLOBALS['phpgw_setup']->oProc->next_record() ? $GLOBALS['phpgw_setup']->oProc->f(0) : ''; 1554 1555 // copy the email-addresses from the preferences of the mail-app (if set) to the new field 1556 $db2 = $GLOBALS['phpgw_setup']->oProc->m_odb; 1557 $sql = "SELECT account_id,account_lid,preference_value FROM phpgw_accounts LEFT JOIN phpgw_preferences ON account_id=preference_owner AND preference_app='email' WHERE account_type = 'u'"; 1558 $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__); 1559 while ($GLOBALS['phpgw_setup']->oProc->next_record()) 1560 { 1561 $email_prefs = unserialize($GLOBALS['phpgw_setup']->oProc->f('preference_value')); 1562 $account_lid = $GLOBALS['phpgw_setup']->oProc->f('account_lid'); 1563 $db2->update('phpgw_accounts',array( 1564 'account_email' => $email_prefs['address'] ? $email_prefs['address'] : $account_lid.(strstr($account_lid,'@')===False?'@'.$mail_domain:''), 1565 ),array( 1566 'account_id' => $GLOBALS['phpgw_setup']->oProc->f('account_id') 1567 ),__LINE__,__FILE__); 1568 } 1569 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.000'; 1570 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1571 } 1572 1573 1574 $test[] = '1.0.0.000'; 1575 function phpgwapi_upgrade1_0_0_000() 1576 { 1577 // removing the not longer needed 'availible' column, that information is in the file setup/lang/languages 1578 $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_languages',array( 1579 'fd' => array( 1580 'lang_id' => array('type' => 'varchar','precision' => '5','nullable' => False), 1581 'lang_name' => array('type' => 'varchar','precision' => '50','nullable' => False) 1582 ), 1583 'pk' => array('lang_id'), 1584 'ix' => array(), 1585 'fk' => array(), 1586 'uc' => array() 1587 ),'available'); 1588 1589 // correcting the id for Catalan 1590 $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET lang_id='es-ca' WHERE lang_id='ca'"); 1591 1592 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.001'; 1593 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1594 } 1595 1596 1597 $test[] = '1.0.0.001'; 1598 function phpgwapi_upgrade1_0_0_001() 1599 { 1600 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.002'; 1601 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1602 } 1603 1604 1605 $test[] = '1.0.0.002'; 1606 function phpgwapi_upgrade1_0_0_002() 1607 { 1608 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.003'; 1609 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1610 } 1611 1612 1613 $test[] = '1.0.0.003'; 1614 function phpgwapi_upgrade1_0_0_003() 1615 { 1616 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.004'; 1617 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1618 } 1619 1620 1621 $test[] = '1.0.0.004'; 1622 function phpgwapi_upgrade1_0_0_004() 1623 { 1624 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.005'; 1625 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1626 } 1627 1628 1629 $test[] = '1.0.0.005'; 1630 function phpgwapi_upgrade1_0_0_005() 1631 { 1632 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.006'; 1633 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1634 } 1635 1636 $test[] = '1.0.0.006'; 1637 function phpgwapi_upgrade1_0_0_006() 1638 { 1639 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.0.0.007'; 1640 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1641 } 1642 12 // Since Expresso 1.2 using API EgroupWare 1.0.0.007 1643 13 $test[] = '1.0.0.007'; 1644 14 function phpgwapi_upgrade1_0_0_007() … … 1678 48 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.002'; 1679 49 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1680 } 50 } 1681 51 $test[] = '2.0.002'; 1682 52 function phpgwapi_upgrade2_0_002() 1683 53 { 54 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.003'; 55 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 56 } 57 $test[] = '2.0.003'; 58 function phpgwapi_upgrade2_0_003() 59 { 60 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.004'; 61 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 62 } 63 $test[] = '2.0.004'; 64 function phpgwapi_upgrade2_0_004() 65 { 66 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.005'; 67 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 68 } 69 $test[] = '2.0.005'; 70 function phpgwapi_upgrade2_0_005() 71 { 72 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.006'; 73 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 74 } 75 $test[] = '2.0.006'; 76 function phpgwapi_upgrade2_0_006() 77 { 78 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.0.007'; 79 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 80 } 81 $test[] = '2.0.007'; 82 function phpgwapi_upgrade2_0_007() 83 { 1684 84 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.1.000'; 85 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 86 } 87 $test[] = '2.1.000'; 88 function phpgwapi_upgrade2_1_000() 89 { 90 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '2.2.000'; 1685 91 return $GLOBALS['setup_info']['phpgwapi']['currentver']; 1686 92 }
Note: See TracChangeset
for help on using the changeset viewer.