oProc->RenameTable('lang','phpgw_lang'); $GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages'); // 0.9.15.002 are already included in 0.9.14.002 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.003'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.003'; function phpgwapi_upgrade0_9_14_003() { // this is the 0.9.15.001 update $GLOBALS['phpgw_setup']->oProc->RenameTable('lang','phpgw_lang'); $GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages'); // 0.9.15.002 are already included in 0.9.14.002 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.003'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.004'; function phpgwapi_upgrade0_9_14_004() { // this is the 0.9.15.001 update $GLOBALS['phpgw_setup']->oProc->RenameTable('lang','phpgw_lang'); $GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages'); // 0.9.15.002 are already included in 0.9.14.002 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.003'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.005'; function phpgwapi_upgrade0_9_14_005() { // this is the 0.9.15.001 update $GLOBALS['phpgw_setup']->oProc->RenameTable('lang','phpgw_lang'); $GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages'); // 0.9.15.002 are already included in 0.9.14.002 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.003'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.006'; function phpgwapi_upgrade0_9_14_006() { // this is the 0.9.15.001 update $GLOBALS['phpgw_setup']->oProc->RenameTable('lang','phpgw_lang'); $GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages'); // 0.9.15.002 are already included in 0.9.14.002 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.003'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.500'; function phpgwapi_upgrade0_9_14_500() { // 0.9.14.5xx are the development-versions of the 0.9.16 release (based on the 0.9.14 api) // as 0.9.15.xxx are already used in HEAD // this is the 0.9.15.001 update $GLOBALS['phpgw_setup']->oProc->RenameTable('lang','phpgw_lang'); $GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages'); // 0.9.15.002/3/4 are already included in 0.9.14.500 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.005'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.501'; function phpgwapi_upgrade0_9_14_501() { // 0.9.14.5xx are the development-versions of the 0.9.16 release (based on the 0.9.14 api) // as 0.9.15.xxx are already used in HEAD // 0.9.15.001/2/3/4 are already included in 0.9.14.501 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.005'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.502'; function phpgwapi_upgrade0_9_14_502() { // 0.9.14.5xx are the development-versions of the 0.9.16 release (based on the 0.9.14 api) // as 0.9.15.xxx are already used in HEAD // 0.9.15.001-9 are already included in 0.9.14.502 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.010'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.503'; function phpgwapi_upgrade0_9_14_503() { // 0.9.14.5xx are the development-versions of the 0.9.16 release (based on the 0.9.14 api) // as 0.9.15.xxx are already used in HEAD // 0.9.15.001-11 are already included in 0.9.14.503 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.011'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.504'; function phpgwapi_upgrade0_9_14_504() { // 0.9.15.001-12 are already included in 0.9.14.504 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.012'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.505'; function phpgwapi_upgrade0_9_14_505() { // 0.9.15.001-12 are already included in 0.9.14.505 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.012'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.506'; function phpgwapi_upgrade0_9_14_506() { $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_vfs','content',array( 'type' => 'text', 'nullable' => True )); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.013'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.507'; function phpgwapi_upgrade0_9_14_507() { // 0.9.15.001-13 are already included in 0.9.14.507 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.013'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.14.508'; function phpgwapi_upgrade0_9_14_508() { // 0.9.15.001-14 are already included in 0.9.14.508 $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.014'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.001'; function phpgwapi_upgrade0_9_15_001() { $GLOBALS['phpgw_setup']->oProc->RenameTable('lang','phpgw_lang'); $GLOBALS['phpgw_setup']->oProc->RenameTable('languages','phpgw_languages'); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.002'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.002'; function phpgwapi_upgrade0_9_15_002() { $GLOBALS['phpgw_setup']->oProc->CreateTable( 'phpgw_newprefs', array( 'fd' => array( 'preference_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => False), 'preference_value' => array('type' => 'text') ), 'pk' => array('preference_owner'), 'fk' => array(), 'ix' => array(), 'uc' => array() ) ); $GLOBALS['phpgw_setup']->oProc->query('SELECT * FROM phpgw_preferences',__LINE__,__FILE__); $db2 = $GLOBALS['phpgw_setup']->db; while($GLOBALS['phpgw_setup']->oProc->next_record()) { $accountid = $GLOBALS['phpgw_setup']->oProc->f('preference_owner'); settype($accountid,'integer'); $db2->query('INSERT INTO phpgw_newprefs (preference_owner,preference_value) VALUES(' . $accountid . ",'" . $GLOBALS['phpgw_setup']->oProc->f('preference_value') . "')", __LINE__,__FILE__); } $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_preferences'); $GLOBALS['phpgw_setup']->oProc->RenameTable('phpgw_newprefs','phpgw_preferences'); $setup_info['phpgwapi']['currentver'] = '0.9.15.003'; return $setup_info['phpgwapi']['currentver']; } $test[] = '0.9.15.003'; function phpgwapi_upgrade0_9_15_003() { $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_vfs','content', array ('type' => 'text', 'nullable' => False)); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.004'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.004'; function phpgwapi_upgrade0_9_15_004() { $GLOBALS['phpgw_setup']->db->query("UPDATE phpgw_languages set available='Yes' WHERE lang_id='pl'"); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.005'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.005'; function phpgwapi_upgrade0_9_15_005() { $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_config (config_app, config_name, config_value) VALUES ('phpgwapi','sessions_timeout',7200)"); $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_config (config_app, config_name, config_value) VALUES ('phpgwapi','sessions_app_timeout',86400)"); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.007'; // as 0.9.15.006 is already included return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.006'; function phpgwapi_upgrade0_9_15_006() { // Fix bug from update script in 0.9.11.004/5: // column config_app was added to table phpgw_config (which places it as last column), // but in the tables_current.inc.php it was added as first column. // When setup / schemaproc wants to do the AlterColum it recreates the table for pgSql, // as pgSql could not change the column-type. This recreation is can not be based on // tables_current, but on running tables_baseline throught all update-scripts. // Which gives at the end two different versions of the table on new or updated installs. // I fix it now in the (wrong) order of the tables_current, as some apps might depend on! /* $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_config','config_value',array( 'type' => 'text', 'nullable' => False )); */ $confs = array(); $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM phpgw_config"); while ($GLOBALS['phpgw_setup']->oProc->next_record()) { $confs[] = array( 'config_app' => $GLOBALS['phpgw_setup']->oProc->f('config_app'), 'config_name' => $GLOBALS['phpgw_setup']->oProc->f('config_name'), 'config_value' => $GLOBALS['phpgw_setup']->oProc->f('config_value') ); } $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_config'); $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_config',array( 'fd' => array( 'config_app' => array('type' => 'varchar', 'precision' => 50), 'config_name' => array('type' => 'varchar', 'precision' => 255, 'nullable' => false), 'config_value' => array('type' => 'text') ), 'pk' => array(), 'fk' => array(), 'ix' => array(), 'uc' => array('config_name') )); foreach($confs as $conf) { $GLOBALS['phpgw_setup']->oProc->query( "INSERT INTO phpgw_config (config_app,config_name,config_value) VALUES ('". $conf['config_app']."','".$conf['config_name']."','".$conf['config_value']."')"); } $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.007'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.007'; function phpgwapi_upgrade0_9_15_007() { $GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_applications',array( 'fd' => array( 'app_id' => array('type' => 'auto','precision' => '4','nullable' => False), 'app_name' => array('type' => 'varchar','precision' => '25','nullable' => False), 'app_enabled' => array('type' => 'int','precision' => '4'), 'app_order' => array('type' => 'int','precision' => '4'), 'app_tables' => array('type' => 'text'), 'app_version' => array('type' => 'varchar','precision' => '20','nullable' => False,'default' => '0.0') ), 'pk' => array('app_id'), 'fk' => array(), 'ix' => array(), 'uc' => array('app_name') ),'app_title'); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.008'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.008'; function phpgwapi_upgrade0_9_15_008() { // this might already be done in 0.9.14.002, but it does not harm to set it again to YES $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='cs'"); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.009'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.009'; function phpgwapi_upgrade0_9_15_009() { $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_async',array( 'fd' => array( 'id' => array('type' => 'varchar','precision' => '255','nullable' => False), 'next' => array('type' => 'int','precision' => '4','nullable' => False), 'times' => array('type' => 'varchar','precision' => '255','nullable' => False), 'method' => array('type' => 'varchar','precision' => '80','nullable' => False), 'data' => array('type' => 'text','nullable' => False) ), 'pk' => array('id'), 'fk' => array(), 'ix' => array(), 'uc' => array() )); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.010'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.010'; function phpgwapi_upgrade0_9_15_010() { $GLOBALS['phpgw_setup']->oProc->RenameTable('phpgw_preferences','old_preferences'); $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_preferences',array( 'fd' => array( 'preference_owner' => array('type' => 'int','precision' => '4','nullable' => False), 'preference_app' => array('type' => 'varchar','precision' => '25','nullable' => False), 'preference_value' => array('type' => 'text','nullable' => False) ), 'pk' => array('preference_owner','preference_app'), 'fk' => array(), 'ix' => array(), 'uc' => array() )); $db2 = $GLOBALS['phpgw_setup']->db; // we need a 2. result-set $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM old_preferences"); while ($GLOBALS['phpgw_setup']->oProc->next_record()) { $owner = intval($GLOBALS['phpgw_setup']->oProc->f('preference_owner')); $prefs = unserialize($GLOBALS['phpgw_setup']->oProc->f('preference_value')); if (is_array($prefs)) { foreach ($prefs as $app => $pref) { if (!empty($app) && count($pref)) { $app = addslashes($app); $pref = serialize($pref); $db2->query("INSERT INTO phpgw_preferences". " (preference_owner,preference_app,preference_value)". " VALUES ($owner,'$app','$pref')"); } } } } $GLOBALS['phpgw_setup']->oProc->DropTable('old_preferences'); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.011'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.011'; function phpgwapi_upgrade0_9_15_011() { $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_addressbook','last_mod',array( 'type' => 'int', 'precision' => '4', 'nullable' => False )); $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_categories','last_mod',array( 'type' => 'int', 'precision' => '4', 'nullable' => False )); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.012'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.012'; function phpgwapi_upgrade0_9_15_012() { $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_access_log','lo',array( 'type' => 'int', 'precision' => '4', 'nullable' => True, 'default' => '0' )); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.013'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } $test[] = '0.9.15.013'; function phpgwapi_upgrade0_9_15_013() { $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_async','account_id',array( 'type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0' )); $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.014'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } ?>