Using new method of global phpgw_setup, then setting oProc. Most of these work now

This commit is contained in:
Miles Lott 2001-06-05 20:11:40 +00:00
parent 547ae0408c
commit 4b9c00c914
3 changed files with 173 additions and 74 deletions

View File

@ -14,8 +14,9 @@
$test[] = '0.9.1';
function addressbook_upgrade0_9_1()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AlterColumn('addressbook', 'ab_id', array('type' => 'auto', 'nullable' => false));
$oProc->AddColumn('addressbook', 'ab_company_id', array('type' => 'int', 'precision' => 4));
$oProc->AddColumn('addressbook', 'ab_title', array('type' => 'varchar', 'precision' => 60));
@ -27,8 +28,9 @@
function addressbook_v0_9_2to0_9_3update_owner($table, $field)
{
global $phpgw_setup, $oProc;
global $phpgw_setup, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->m_odb->query("select distinct($field) from $table");
if ($oProc->m_odb->num_rows())
{
@ -69,19 +71,29 @@
$test[] = '0.9.3pre6';
function addressbook_upgrade0_9_3pre6()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AddColumn('addressbook', 'ab_url', array('type' => 'varchar', 'precision' => 255));
$setup_info['addressbook']['currentver'] = '0.9.3pre7';
return True;
}
$test[] = "0.9.8pre5";
function addressbook_upgrade0_9_8pre5()
{
global $setup_info;
$setup_info['addressbook']['currentver'] = '0.9.10pre4';
return True;
}
$test[] = "0.9.10pre4";
function addressbook_upgrade0_9_10pre4()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$db2 = $oProc->m_odb;
$db3 = $oProc->m_odb;
@ -113,8 +125,7 @@
$test[] = "0.9.10pre5";
function addressbook_upgrade0_9_10pre5()
{
global $setup_info, $oProc;
global $setup_info;
$setup_info["addressbook"]["currentver"] = "0.9.10pre6";
return True;
}
@ -122,8 +133,7 @@
$test[] = "0.9.10pre6";
function addressbook_upgrade0_9_10pre6()
{
global $setup_info, $oProc;
global $setup_info;
$setup_info["addressbook"]["currentver"] = "0.9.10pre7";
return True;
}
@ -131,8 +141,7 @@
$test[] = "0.9.10pre7";
function addressbook_upgrade0_9_10pre7()
{
global $setup_info, $oProc;
global $setup_info;
$setup_info["addressbook"]["currentver"] = "0.9.10pre8";
return True;
}
@ -176,8 +185,10 @@
$test[] = '0.9.10pre12';
function addressbook_upgrade0_9_10pre12()
{
global $setup_info, $oProc;
$db1 = $phpgw_setup->db;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$db1 = $oProc->m_odb;
$oProc->CreateTable(
'phpgw_addressbook', array(
@ -239,7 +250,7 @@
'pk' => array('id'),
'fk' => array(),
'ix' => array(),
'uc' => array('uc')
'uc' => array('id')
)
);
@ -317,7 +328,9 @@
$test[] = '0.9.10pre13';
function addressbook_upgrade0_9_10pre13()
{
global $setup_info, $phpgw_setup,$oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$db1 = $phpgw_setup->db;
$oProc->AddColumn('phpgw_addressbook', 'url', array('type' => 'varchar', 'precision' => 128));
@ -376,10 +389,20 @@
return True;
}
$test[] = '0.9.10pre14';
function addressbook_upgrade0_9_10pre14()
{
global $setup_info;
$setup_info['addressbook']['currentver'] = '0.9.10pre15';
return True;
}
$test[] = '0.9.10pre15';
function addressbook_upgrade0_9_10pre15()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AlterColumn('phpgw_addressbook', 'adr_work', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
$oProc->AlterColumn('phpgw_addressbook', 'adr_home', 'char', array('precision' => 1, 'default' => 'n', 'nullable' => False));
@ -409,17 +432,18 @@
$setup_info['addressbook']['currentver'] = '0.9.10pre16';
return True;
}
$test[] = '0.9.10pre16';
function addressbook_upgrade0_9_10pre16()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$db = $db1 = $oProc->m_odb;
$oProc->RenameTable('phpgw_addressbook', 'phpgw_addressbook_old');
$oProc->CreateTable(
'phpgw_addressbook' => array(
'phpgw_addressbook', array(
'fd' => array(
'id' => array('type' => 'auto'),
'lid' => array('type' => 'varchar', 'precision' => 32),
@ -468,7 +492,7 @@
'tel_video' => array('type' => 'varchar', 'precision' => 40, 'default' => '+1 (000) 000-0000', 'nullable' => False),
'tel_prefer' => array('type' => 'varchar', 'precision' => 32),
'email' => array('type' => 'varchar', 'precision' => 64),
'email_type' => array('type' => 'varchar', 'precision' => 32, 'default' => 'INTERNET',
'email_type' => array('type' => 'varchar', 'precision' => 32, 'default' => 'INTERNET'),
'email_home' => array('type' => 'varchar', 'precision' => 64),
'email_home_type' => array('type' => 'varchar', 'precision' => 32, 'default' => 'INTERNET')
),
@ -553,7 +577,9 @@
$test[] = '0.9.10pre17';
function addressbook_upgrade0_9_10pre17()
{
global $phpgw_info, $oProc;
global $phpgw_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AddColumn('phpgw_addressbook', 'pubkey', array('type' => 'text'));
@ -605,7 +631,7 @@
$test[] = '0.9.10pre18';
function addressbook_upgrade0_9_10pre18()
{
global $setup_info, $oProc;
global $setup_info;
$setup_info['addressbook']['currentver'] = '0.9.10pre19';
return True;
}
@ -613,7 +639,7 @@
$test[] = '0.9.10pre19';
function addressbook_upgrade0_9_10pre19()
{
global $setup_info, $oProc;
global $setup_info;
$setup_info['addressbook']['currentver'] = '0.9.10pre20';
return True;
}
@ -621,7 +647,9 @@
$test[] = '0.9.10pre20';
function addressbook_upgrade0_9_10pre20()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AddColumn('phpgw_addressbook', 'access', array('type' => 'char', 'precision' => 7));
@ -632,7 +660,9 @@
$test[] = '0.9.10pre21';
function addressbook_upgrade0_9_10pre21()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AddColumn('phpgw_addressbook', 'cat_id', array('type' => 'varchar', 'precision' => 32));
@ -643,7 +673,7 @@
$test[] = '0.9.10pre22';
function addressbook_upgrade0_9_10pre22()
{
global $setup_info, $oProc;
global $setup_info;
$setup_info['addressbook']['currentver'] = '0.9.10pre23';
return True;
}
@ -651,7 +681,9 @@
$test[] = '0.9.10pre23';
function addressbook_upgrade0_9_10pre23()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->m_odb->query("UPDATE phpgw_addressbook SET tid='n' WHERE tid is null");

View File

@ -24,8 +24,10 @@
$test[] = '0.9.4pre2';
function calendar_upgrade0_9_4pre2()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->RenameColumn('webcal_entry', 'cal_create_by', 'cal_owner');
$oProc->AlterColumn('webcal_entry', 'cal_owner', array('type' => 'int', 'precision' => 4, 'nullable' => false));
$setup_info['calendar']['currentver'] = '0.9.4pre3';
@ -35,9 +37,11 @@
$test[] = '0.9.7pre1';
function calendar_upgrade0_9_7pre1()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$db2 = $oProc->m_odb;
$oProc->CreateTable('calendar_entry', array(
'fd' => array(
'cal_id' => array('type' => 'auto', 'nullable' => false),
@ -165,6 +169,8 @@
function calendar_upgrade0_9_7pre2()
{
global $oldversion, $setup_info, $phpgw_setup, $oProc, $oDelta;
$oProc = $phpgw_setup->oProc;
$db2 = $oProc->m_odb;
$oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime');
@ -188,11 +194,20 @@
return True;
}
$test[] = '0.9.11.001';
function upgrade0_9_11_001()
$test[] = '0.9.8pre5';
function calendar_upgrade0_9_8pre5()
{
global $setup_info, $oProc;
global $setup_info;
$setup_info['calendar']['currentver'] = '0.9.11.001';
return True;
}
$test[] = '0.9.11.001';
function calendar_upgrade0_9_11_001()
{
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$db2 = $oProc->m_odb;
if(extension_loaded('mcal') == False)
@ -214,7 +229,7 @@
}
// calendar_entry => phpgw_cal
$oProc->CreateTable('phpgw_cal' => array(
$oProc->CreateTable('phpgw_cal', array(
'fd' => array(
'cal_id' => array('type' => 'auto', 'nullable' => False),
'owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False),
@ -268,7 +283,7 @@
$oProc->DropTable('calendar_entry');
// calendar_entry_repeats => phpgw_cal_repeats
$oProc->CreateTable('phpgw_cal_repeats' => array(
$oProc->CreateTable('phpgw_cal_repeats', array(
'fd' => array(
'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False),
'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False),
@ -330,11 +345,12 @@
}
$test[] = '0.9.11.003';
function upgrade0_9_11_003()
function calendar_upgrade0_9_11_003()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc->CreateTable('phpgw_cal_holidays' => array(
$oProc = $phpgw_setup->oProc;
$oProc->CreateTable('phpgw_cal_holidays', array(
'fd' => array(
'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False),
'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False),
@ -351,12 +367,13 @@
}
$test[] = '0.9.11.006';
function upgrade0_9_11_006()
function calendar_upgrade0_9_11_006()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->DropTable('phpgw_cal_holidays');
$oProc->CreateTable('phpgw_cal_holidays' => array(
$oProc->CreateTable('phpgw_cal_holidays', array(
'fd' => array(
'hol_id' => array('type' => 'auto','nullable' => False),
'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False),
@ -374,10 +391,11 @@
}
$test[] = '0.9.11.007';
function upgrade0_9_11_007()
function calendar_upgrade0_9_11_007()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->query('DELETE FROM phpgw_cal_holidays');
$oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0'));
$oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0'));
@ -388,11 +406,20 @@
return True;
}
$test[] = '0.9.11.009';
function upgrade0_9_11_009()
$test[] = '0.9.11.008';
function calendar_upgrade0_9_11_008()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$setup_info['calendar']['currentver'] = '0.9.11.009';
return True;
}
$test[] = '0.9.11.009';
function calendar_upgrade0_9_11_009()
{
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->query('DELETE FROM phpgw_cal_holidays');
$oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0'));

View File

@ -10,12 +10,13 @@
\**************************************************************************/
/* $Id$ */
$test[] = "0.9.1";
function phpgwapi_upgrade0_9_1()
{
global $setup_info, $oProc;
global $phpgw_info, $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AlterColumn("access_log", "lo", array("type" => "varchar", "precision" => 255));
$oProc->m_odb->query("update lang set lang='da' where lang='dk'");
@ -603,6 +604,7 @@
{
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
// Since no applications are using it yet. I am gonna drop it and create a new one.
// This is becuase I never finished the classes
$oProc->DropTable('categories');
@ -622,6 +624,7 @@
'ix' => array(),
'fk' => array(),
'uc' => array()
)
);
$setup_info['phpgwapi']['currentver'] = '0.9.9pre1';
@ -687,7 +690,9 @@
$test[] = "0.9.10pre1";
function phpgwapi_upgrade0_9_10pre1()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->m_odb->query("alter table phpgw_categories add column cat_access varchar(25) after cat_owner");
$setup_info['phpgwapi']['currentver'] = '0.9.10pre2';
@ -697,9 +702,11 @@
$test[] = "0.9.10pre2";
function phpgwapi_upgrade0_9_10pre2()
{
global $phpgw_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$db2 = $oProc->m_odb;
$oProc->m_odb->query("SELECT account_groups,account_id FROM accounts",__LINE__,__FILE__);
if($oProc->m_odb->num_rows())
{
@ -724,8 +731,9 @@
$test[] = "0.9.10pre3";
function phpgwapi_upgrade0_9_10pre3()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->m_odb->query("alter table accounts rename phpgw_accounts",__LINE__,__FILE__);
$oProc->m_odb->query("alter table phpgw_accounts drop column account_permissions",__LINE__,__FILE__);
$oProc->m_odb->query("alter table phpgw_accounts drop column account_groups",__LINE__,__FILE__);
@ -768,8 +776,9 @@
$test[] = "0.9.10pre4";
function phpgwapi_upgrade0_9_10pre4()
{
global $phpgw_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$db2 = $oProc->m_odb;
$db3 = $oProc->m_odb;
@ -781,7 +790,7 @@
$oProc->CreateTable(
'phpgw_temp_groupmap', array(
'fd' => array(
'oldid' => array('type' => 'int', 'precision' => 4, 'nullable' => True),
'oldid' => array('type' => 'int', 'precision' => 4, 'nullable' => False),
'oldlid' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True),
'newid' => array('type' => 'int', 'precision' => 4, 'nullable' => True),
'newlid' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True)
@ -817,7 +826,7 @@
."VALUES ($new_group_id,'$group_name','x','','',$old_group_id,NULL,NULL,'A','g')");
// insert oldid/newid into temp table (for use by other apps in this version upgrade
$db2->query("INSERT INTO temp_groupmap (oldid,oldlid,newid,newlid) VALUES ($old_group_id,'$old_group_name',$new_group_id,'$group_name')",__LINE__,__FILE__;
$db2->query("INSERT INTO phpgw_temp_groupmap (oldid,oldlid,newid,newlid) VALUES ($old_group_id,'$old_group_name',$new_group_id,'$group_name')",__LINE__,__FILE__);
$db2->query("UPDATE phpgw_acl SET acl_location='$new_group_id' "
."WHERE acl_appname='phpgw_group' AND acl_account_type='u' "
@ -847,8 +856,9 @@
$test[] = "0.9.10pre5";
function phpgwapi_upgrade0_9_10pre5()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
// This is only temp data, so we can kill it.
$oProc->DropTable('phpgw_app_sessions');
$oProc->CreateTable(
@ -874,8 +884,9 @@
$test[] = "0.9.10pre6";
function phpgwapi_upgrade0_9_10pre6()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->RenameTable('config','phpgw_config');
$setup_info['phpgwapi']['currentver'] = '0.9.10pre7';
@ -885,8 +896,9 @@
$test[] = "0.9.10pre7";
function phpgwapi_upgrade0_9_10pre7()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->RenameTable('applications','phpgw_applications');
$setup_info['phpgwapi']['currentver'] = '0.9.10pre8';
@ -896,8 +908,9 @@
$test[] = "0.9.10pre8";
function phpgwapi_upgrade0_9_10pre8()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->RenameColumn('phpgw_sessions', 'session_info', 'session_action');
$oProc->AlterColumn('phpgw_sessions', 'session_action', array('type' => 'varchar', 'precision' => '255'));
@ -908,8 +921,9 @@
$test[] = '0.9.10pre9';
function phpgwapi_upgrade0_9_10pre9()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->RenameTable('preferences','phpgw_preferences');
$setup_info['phpgwapi']['currentver'] = '0.9.10pre10';
@ -919,8 +933,9 @@
$test[] = '0.9.10pre10';
function phpgwapi_upgrade0_9_10pre10()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$newtbldef = array(
"fd" => array(
'acl_appname' => array('type' => 'varchar', 'precision' => 50),
@ -967,8 +982,9 @@
$test[] = '0.9.10pre14';
function phpgwapi_upgrade0_9_10pre14()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AddColumn('phpgw_sessions','session_flags', array('type' => 'char', 'precision' => 2));
$setup_info['phpgwapi']['currentver'] = '0.9.10pre15';
@ -1002,8 +1018,9 @@
$test[] = '0.9.10pre18';
function phpgwapi_upgrade0_9_10pre18()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->CreateTable(
'phpgw_nextid', array(
'fd' => array(
@ -1024,8 +1041,9 @@
$test[] = '0.9.10pre19';
function phpgwapi_upgrade0_9_10pre19()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->DropTable('phpgw_nextid');
$oProc->CreateTable(
@ -1080,9 +1098,10 @@
$test[] = '0.9.10pre24';
function phpgwapi_upgrade0_9_10pre24()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc->AddColumn('phpgw_categories','cat_access', array('type' => 'char', 'precision' => 7));
$oProc = $phpgw_setup->oProc;
$oProc->AlterColumn('phpgw_categories','cat_access', array('type' => 'char', 'precision' => 7));
$setup_info['phpgwapi']['currentver'] = '0.9.10pre25';
return True;
@ -1091,8 +1110,9 @@
$test[] = '0.9.10pre25';
function phpgwapi_upgrade0_9_10pre25()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AddColumn('phpgw_app_sessions','session_dla', array('type' => 'int', 'precision' => 4));
$setup_info['phpgwapi']['currentver'] = '0.9.10pre26';
@ -1110,8 +1130,9 @@
$test[] = '0.9.10pre27';
function phpgwapi_upgrade0_9_10pre27()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AlterColumn('phpgw_app_sessions', 'content', array('type' => 'longtext'));
$setup_info['phpgwapi']['currentver'] = '0.9.10pre28';
@ -1161,8 +1182,9 @@
$test[] = '0.9.11.004';
function phpgwapi_upgrade0_9_11_004()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AddColumn('phpgw_config','config_app', array('type' => 'varchar', 'precision' => 50));
$oProc->m_odb->query("UPDATE phpgw_config SET config_app='phpgwapi'",__LINE__,__FILE__);
@ -1173,8 +1195,9 @@
$test[] = '0.9.11.005';
function phpgwapi_upgrade0_9_11_005()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->AddColumn('phpgw_accounts','account_expires', array('type' => 'int', 'precision' => 4));
$oProc->m_odb->query("UPDATE phpgw_accounts SET account_expires='-1'",__LINE__,__FILE__);
@ -1182,11 +1205,28 @@
return True;
}
$test[] = '0.9.11.006';
function phpgwapi_upgrade0_9_11_006()
{
global $setup_info;
$setup_info['phpgwapi']['currentver'] = '0.9.11.007';
return True;
}
$test[] = '0.9.11.007';
function phpgwapi_upgrade0_9_11_007()
{
global $setup_info;
$setup_info['phpgwapi']['currentver'] = '0.9.11.008';
return True;
}
$test[] = '0.9.11.008';
function phpgwapi_upgrade0_9_11_008()
{
global $setup_info, $oProc;
global $setup_info, $phpgw_setup;
$oProc = $phpgw_setup->oProc;
$oProc->DropTable('profiles');
$setup_info['phpgwapi']['currentver'] = '0.9.11.009';
@ -1196,7 +1236,7 @@
$test[] = '0.9.11.009';
function phpgwapi_upgrade0_9_11_009()
{
global $setup_info, $oProc;
global $setup_info;
$setup_info['phpgwapi']['currentver'] = '0.9.11.010';
return True;
}