diff --git a/addressbook/setup/setup.inc.php b/addressbook/setup/setup.inc.php new file mode 100755 index 0000000000..331af9d8c6 --- /dev/null +++ b/addressbook/setup/setup.inc.php @@ -0,0 +1,71 @@ + + Always have your address book available for updates or look ups from anywhere.
+ Share address book contact information with others.
+ Link contacts to calendar events or InfoLog entires like phonecalls.
+ Addressbook is the eGroupWare default contact application.
+ It stores contact information via SQL or LDAP and provides contact services via the eGroupWare API.'; + +$setup_info['addressbook']['maintainer'] = array( + 'name' => 'Ralf Becker', + 'email' => 'ralfbecker@outdoor-training.de' +); + +$setup_info['addressbook']['tables'] = array(); // addressbook tables are in the API! + +/* The hooks this app includes, needed for hooks registration */ +$setup_info['addressbook']['hooks']['admin'] = 'addressbook_hooks::all_hooks'; +$setup_info['addressbook']['hooks']['preferences'] = 'addressbook_hooks::all_hooks'; +$setup_info['addressbook']['hooks']['sidebox_menu'] = 'addressbook_hooks::all_hooks'; +$setup_info['addressbook']['hooks']['settings'] = 'addressbook_hooks::settings'; +$setup_info['addressbook']['hooks'][] = 'home'; +$setup_info['addressbook']['hooks']['deleteaccount'] = 'addressbook.addressbook_bo.deleteaccount'; +$setup_info['addressbook']['hooks']['search_link'] = 'addressbook_hooks::search_link'; +$setup_info['addressbook']['hooks']['calendar_resources'] = 'addressbook_hooks::calendar_resources'; +$setup_info['addressbook']['hooks']['edit_user'] = 'addressbook_hooks::edit_user'; +$setup_info['addressbook']['hooks'][] = 'config'; +$setup_info['addressbook']['hooks']['group_acl'] = 'addressbook_hooks::group_acl'; + +/* Dependencies for this app to work */ +$setup_info['addressbook']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info['addressbook']['depends'][] = array( + 'appname' => 'etemplate', + 'versions' => Array('1.7','1.8','1.9') +); + +// installation checks for addresbook +$setup_info['projectmanager']['check_install'] = array( + 'gd' => array( + 'func' => 'extension_check', + ), + 'imagecreatefromjpeg' => array( + 'func' => 'function_check', + 'warning' => "The imagecreatefromjpeg function is supplied by the gd extension (complied with jpeg support!). It's needed to upload photos for contacts.", + ), + 'zip' => array( + 'func' => 'extension_check', + 'warning' => lang('The zip extension is needed, to insert contact data in OpenOffice or MSOffice documents.'), + ), +); + diff --git a/admin/setup/setup.inc.php b/admin/setup/setup.inc.php new file mode 100755 index 0000000000..50eb9cce36 --- /dev/null +++ b/admin/setup/setup.inc.php @@ -0,0 +1,56 @@ + 'eGroupWare coreteam', + 'email' => 'egroupware-developers@lists.sourceforge.net' +); + +$setup_info['admin']['maintainer'][] = array( + 'name' => 'eGroupWare coreteam', + 'email' => 'egroupware-developers@lists.sourceforge.net', + 'url' => 'www.egroupware.org' +); + +$setup_info['admin']['license'] = 'GPL'; +$setup_info['admin']['description'] = 'EGroupware administration application'; + +/* The hooks this app includes, needed for hooks registration */ +$setup_info['admin']['hooks'] = array( + 'acl_manager', + 'add_def_pref', + 'after_navbar', + 'config', + 'deleteaccount', + 'view_user' => 'admin.uiaccounts.edit_view_user_hook', + 'edit_user' => 'admin.uiaccounts.edit_view_user_hook', + 'group_manager' => 'admin.uiaccounts.edit_group_hook', + 'topmenu_info' +); +$setup_info['admin']['hooks']['preferences'] =$setup_info['admin']['name'].'.admin_prefs_sidebox_hooks.all_hooks'; +$setup_info['admin']['hooks']['admin'] =$setup_info['admin']['name'].'.admin_prefs_sidebox_hooks.all_hooks'; +$setup_info['admin']['hooks']['sidebox_menu'] =$setup_info['admin']['name'].'.admin_prefs_sidebox_hooks.all_hooks'; + +/* Dependencies for this app to work */ +$setup_info['admin']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info['admin']['depends'][] = array( + 'appname' => 'etemplate', + 'versions' => Array('1.7','1.8','1.9') +); diff --git a/admin/setup/tables_update.inc.php b/admin/setup/tables_update.inc.php new file mode 100644 index 0000000000..b81ebfbb8c --- /dev/null +++ b/admin/setup/tables_update.inc.php @@ -0,0 +1,92 @@ + + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package admin + * @subpackage setup + * @version $Id$ + */ + +function admin_upgrade1_2() +{ + return $GLOBALS['setup_info']['admin']['currentver'] = '1.4'; +} + + +function admin_upgrade1_4() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_queue',array( + 'fd' => array( + 'cmd_id' => array('type' => 'auto'), + 'cmd_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), + 'cmd_creator' => array('type' => 'int','precision' => '4','nullable' => False), + 'cmd_creator_email' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'cmd_created' => array('type' => 'int','precision' => '8','nullable' => False), + 'cmd_type' => array('type' => 'varchar','precision' => '32','nullable' => False,'default' => 'admin_cmd'), + 'cmd_status' => array('type' => 'int','precision' => '1'), + 'cmd_scheduled' => array('type' => 'int','precision' => '8'), + 'cmd_modified' => array('type' => 'int','precision' => '8'), + 'cmd_modifier' => array('type' => 'int','precision' => '4'), + 'cmd_modifier_email' => array('type' => 'varchar','precision' => '128'), + 'cmd_error' => array('type' => 'varchar','precision' => '255'), + 'cmd_errno' => array('type' => 'int','precision' => '4'), + 'cmd_requested' => array('type' => 'int','precision' => '4'), + 'cmd_requested_email' => array('type' => 'varchar','precision' => '128'), + 'cmd_comment' => array('type' => 'varchar','precision' => '255'), + 'cmd_data' => array('type' => 'blob') + ), + 'pk' => array('cmd_id'), + 'fk' => array(), + 'ix' => array('cmd_status','cmd_scheduled'), + 'uc' => array('cmd_uid') + )); + return $GLOBALS['setup_info']['admin']['currentver'] = '1.5.001'; +} + + +function admin_upgrade1_5_001() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_remote',array( + 'fd' => array( + 'remote_id' => array('type' => 'auto'), + 'remote_name' => array('type' => 'varchar','precision' => '64','nullable' => False), + 'remote_hash' => array('type' => 'varchar','precision' => '32','nullable' => False), + 'remote_url' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'remote_domain' => array('type' => 'varchar','precision' => '64','nullable' => False) + ), + 'pk' => array('remote_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array('remote_name') + )); + + return $GLOBALS['setup_info']['admin']['currentver'] = '1.5.002'; +} + + +function admin_upgrade1_5_002() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_admin_queue','remote_id',array( + 'type' => 'int', + 'precision' => '4' + )); + + return $GLOBALS['setup_info']['admin']['currentver'] = '1.5.003'; +} + + +function admin_upgrade1_5_003() +{ + return $GLOBALS['setup_info']['admin']['currentver'] = '1.6'; +} + + +function admin_upgrade1_6() +{ + return $GLOBALS['setup_info']['admin']['currentver'] = '1.8'; +} diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php new file mode 100755 index 0000000000..f6d4d641bf --- /dev/null +++ b/calendar/setup/setup.inc.php @@ -0,0 +1,67 @@ + + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +$setup_info['calendar']['name'] = 'calendar'; +$setup_info['calendar']['version'] = '1.8'; +$setup_info['calendar']['app_order'] = 3; +$setup_info['calendar']['enable'] = 1; +$setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index'; + +$setup_info['calendar']['license'] = 'GPL'; +$setup_info['calendar']['description'] = + 'Powerful group calendar with meeting request system and ACL security.'; +$setup_info['calendar']['note'] = + 'The calendar has been completly rewritten for eGroupWare 1.2.'; +$setup_info['calendar']['author'] = $setup_info['calendar']['maintainer'] = array( + 'name' => 'Ralf Becker', + 'email' => 'RalfBecker@outdoor-training.de' +); + +$setup_info['calendar']['tables'][] = 'egw_cal'; +$setup_info['calendar']['tables'][] = 'egw_cal_holidays'; +$setup_info['calendar']['tables'][] = 'egw_cal_repeats'; +$setup_info['calendar']['tables'][] = 'egw_cal_user'; +$setup_info['calendar']['tables'][] = 'egw_cal_extra'; +$setup_info['calendar']['tables'][] = 'egw_cal_dates'; +$setup_info['calendar']['tables'][] = 'egw_cal_timezones'; + +/* The hooks this app includes, needed for hooks registration */ +$setup_info['calendar']['hooks']['admin'] = 'calendar_hooks::admin'; +$setup_info['calendar']['hooks']['deleteaccount'] = 'calendar.calendar_so.deleteaccount'; +$setup_info['calendar']['hooks']['home'] = 'calendar_hooks::home'; +$setup_info['calendar']['hooks']['preferences'] = 'calendar_hooks::preferences'; +$setup_info['calendar']['hooks']['settings'] = 'calendar_hooks::settings'; +$setup_info['calendar']['hooks']['sidebox_menu'] = 'calendar.calendar_ui.sidebox_menu'; +$setup_info['calendar']['hooks']['search_link'] = 'calendar_hooks::search_link'; + +/* Dependencies for this app to work */ +$setup_info['calendar']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info['calendar']['depends'][] = array( + 'appname' => 'etemplate', + 'versions' => Array('1.7','1.8','1.9') +); + +// installation checks for calendar +$setup_info['calendar']['check_install'] = array( + // check if PEAR is availible + '' => array( + 'func' => 'pear_check', + 'from' => 'Calendar (iCal import+export)', + ), + // check if PDO SQLite support is available + 'pdo_sqlite' => array( + 'func' => 'extension_check', + 'from' => 'Calendar', + ), +); diff --git a/calendar/setup/tables_update.inc.php b/calendar/setup/tables_update.inc.php new file mode 100644 index 0000000000..9a6569b628 --- /dev/null +++ b/calendar/setup/tables_update.inc.php @@ -0,0 +1,2083 @@ + + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +function calendar_v0_9_2to0_9_3update_owner($table, $field) +{ + $GLOBALS['egw_setup']->oProc->query("select distinct($field) from $table"); + if ($GLOBALS['egw_setup']->oProc->num_rows()) + { + while ($GLOBALS['egw_setup']->oProc->next_record()) + { + $owner[count($owner)] = $GLOBALS['egw_setup']->oProc->f($field); + } + if($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre4')) + { + $acctstbl = 'accounts'; + } + else + { + $acctstbl = 'phpgw_accounts'; + } + for($i=0;$ioProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); + $GLOBALS['egw_setup']->oProc->next_record(); + $GLOBALS['egw_setup']->oProc->query("UPDATE $table SET $field=".$GLOBALS['egw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'"); + } + } + $GLOBALS['egw_setup']->oProc->AlterColumn($table, $field, array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0)); +} + + +function calendar_upgrade0_9_3pre1() +{ + calendar_v0_9_2to0_9_3update_owner('webcal_entry','cal_create_by'); + calendar_v0_9_2to0_9_3update_owner('webcal_entry_user','cal_login'); + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3pre2() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3pre3() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre4'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3pre4() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre5'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3pre5() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre6'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3pre6() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre7'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3pre7() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre8'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3pre8() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre9'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3pre9() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre10'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3pre10() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_3() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_4pre1() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_4pre2() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('webcal_entry', 'cal_create_by', 'cal_owner'); + $GLOBALS['egw_setup']->oProc->AlterColumn('webcal_entry', 'cal_owner', array('type' => 'int', 'precision' => 4, 'nullable' => false)); + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_4pre3() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre4'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_4pre4() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4pre5'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_4pre5() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.4'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_4() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.5pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_5pre1() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.5pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_5pre2() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.5pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_5() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.6'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_6() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_7pre1() +{ + $db2 = clone($GLOBALS['egw_setup']->db); + + $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry', + Array( + 'fd' => array( + 'cal_id' => array('type' => 'auto', 'nullable' => false), + 'cal_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), + 'cal_group' => array('type' => 'varchar', 'precision' => 255), + 'cal_datetime' => array('type' => 'int', 'precision' => 4), + 'cal_mdatetime' => array('type' => 'int', 'precision' => 4), + 'cal_duration' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), + 'cal_priority' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '2'), + 'cal_type' => array('type' => 'varchar', 'precision' => 10), + 'cal_access' => array('type' => 'varchar', 'precision' => 10), + 'cal_name' => array('type' => 'varchar', 'precision' => 80, 'nullable' => false), + 'cal_description' => array('type' => 'text') + ), + 'pk' => array("cal_id"), + 'ix' => array(), + 'fk' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->next_record(); + if($GLOBALS['egw_setup']->oProc->f(0)) + { + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id',__LINE__,__FILE__); + while($GLOBALS['egw_setup']->oProc->next_record()) + { + $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); + $cal_owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); + $cal_duration = $GLOBALS['egw_setup']->oProc->f('cal_duration'); + $cal_priority = $GLOBALS['egw_setup']->oProc->f('cal_priority'); + $cal_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); + $cal_access = $GLOBALS['egw_setup']->oProc->f('cal_access'); + $cal_name = $GLOBALS['egw_setup']->oProc->f('cal_name'); + $cal_description = $GLOBALS['egw_setup']->oProc->f('cal_description'); + $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),0,4))); + $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),0,4))); + $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id,__LINE__,__FILE__); + $db2->next_record(); + $cal_group = $db2->f('groups'); + $db2->query('INSERT INTO calendar_entry(cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description) ' + .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__); + } + } + + $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_groups'); + $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry'); + + $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_user', + Array( + 'fd' => array( + 'cal_id' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), + 'cal_login' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), + 'cal_status' => array('type' => 'char', 'precision' => 1, 'default' => 'A') + ), + 'pk' => array('cal_id', 'cal_login'), + 'ix' => array(), + 'fk' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->next_record(); + if($GLOBALS['egw_setup']->oProc->f(0)) + { + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__); + while($GLOBALS['egw_setup']->oProc->next_record()) + { + $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); + $cal_login = $GLOBALS['egw_setup']->oProc->f('cal_login'); + $cal_status = $GLOBALS['egw_setup']->oProc->f('cal_status'); + $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')",__LINE__,__FILE__); + } + } + + $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_user'); + + $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_repeats', + Array( + 'fd' => array( + 'cal_id' => array('type' => 'int', 'precision' => 4, 'default' => '0', 'nullable' => false), + 'cal_type' => array('type' => 'varchar', 'precision' => 20, 'default' => 'daily', 'nullable' => false), + 'cal_use_end' => array('type' => 'int', 'precision' => 4, 'default' => '0'), + 'cal_end' => array('type' => 'int', 'precision' => 4), + 'cal_frequency' => array('type' => 'int', 'precision' => 4, 'default' => '1'), + 'cal_days' => array('type' => 'char', 'precision' => 7) + ), + 'pk' => array(), + 'ix' => array(), + 'fk' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->next_record(); + if($GLOBALS['egw_setup']->oProc->f(0)) + { + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id',__LINE__,__FILE__); + while($GLOBALS['egw_setup']->oProc->next_record()) + { + $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); + $cal_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); + if(isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) + { + $enddate = mktime(0,0,0,intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),0,4))); + $useend = 1; + } + else + { + $enddate = 0; + $useend = 0; + } + $cal_frequency = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); + $cal_days = $GLOBALS['egw_setup']->oProc->f('cal_days'); + $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')",__LINE__,__FILE__); + } + } + + $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats'); + $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_7pre2() +{ + $db2 = $GLOBALS['egw_setup']->db; + + $GLOBALS['egw_setup']->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime'); + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id',__LINE__,__FILE__); + if($GLOBALS['egw_setup']->oProc->num_rows()) + { + while($GLOBALS['egw_setup']->oProc->next_record()) + { + $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'),__LINE__,__FILE__); + $db2->next_record(); + $tz = $db2->f('preference_value'); + $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); + $datetime = $GLOBALS['egw_setup']->oProc->f('cal_datetime') - ((60 * 60) * $tz); + $mdatetime = $GLOBALS['egw_setup']->oProc->f('cal_mdatetime') - ((60 * 60) * $tz); + $edatetime = $datetime + (60 * $GLOBALS['egw_setup']->oProc->f('cal_edatetime')); + $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id,__LINE__,__FILE__); + } + } + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_7pre3() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_7() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_8pre1() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_8pre2() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_8pre3() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre4'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_8pre4() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.8pre5'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_8pre5() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.9pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_9pre1() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.9'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_9() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre1'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre1() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre2'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre2() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre3'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre3() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre4'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre4() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre5'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre5() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre6'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre6() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre7'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre7() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre8'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre8() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre9'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre9() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre10'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre10() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre11'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre11() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre12'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre12() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre13'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre13() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre14'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre14() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre15'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre15() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre16'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre16() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre17'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre17() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre18'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre18() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre19'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre19() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre20'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre20() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre21'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre21() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre22'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre22() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre23'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre23() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre24'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre24() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre25'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre25() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre26'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre26() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre27'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre27() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10pre28'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10pre28() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.10'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_10() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.001'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_11() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.001'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_001() +{ + $db2 = $GLOBALS['egw_setup']->db; + + if(extension_loaded('mcal') == False) + { + define(RECUR_NONE,0); + define(RECUR_DAILY,1); + define(RECUR_WEEKLY,2); + define(RECUR_MONTHLY_MDAY,3); + define(RECUR_MONTHLY_WDAY,4); + define(RECUR_YEARLY,5); + + define(M_SUNDAY,1); + define(M_MONDAY,2); + define(M_TUESDAY,4); + define(M_WEDNESDAY,8); + define(M_THURSDAY,16); + define(M_FRIDAY,32); + define(M_SATURDAY,64); + } + +// calendar_entry => phpgw_cal + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal', + Array( + 'fd' => array( + 'cal_id' => array('type' => 'auto', 'nullable' => False), + 'owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), + 'category' => array('type' => 'int', 'precision' => 8, 'default' => '0', 'nullable' => True), + 'groups' => array('type' => 'varchar', 'precision' => 255, 'nullable' => True), + 'datetime' => array('type' => 'int', 'precision' => 8, 'nullable' => True), + 'mdatetime' => array('type' => 'int', 'precision' => 8, 'nullable' => True), + 'edatetime' => array('type' => 'int', 'precision' => 8, 'nullable' => True), + 'priority' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '2'), + 'cal_type' => array('type' => 'varchar', 'precision' => 10, 'nullable' => True), + 'is_public' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '1'), + 'title' => array('type' => 'varchar', 'precision' => 80, 'nullable' => False, 'default' => '1'), + 'description' => array('type' => 'text', 'nullable' => True) + ), + 'pk' => array('cal_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__); + while($GLOBALS['egw_setup']->oProc->next_record()) + { + $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); + $owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); + $access = $GLOBALS['egw_setup']->oProc->f('cal_access'); + switch($access) + { + case 'private': + $is_public = 0; + break; + case 'public': + $is_public = 1; + break; + case 'group': + $is_public = 2; + break; + } + $groups = $GLOBALS['egw_setup']->oProc->f('cal_group'); + $datetime = $GLOBALS['egw_setup']->oProc->f('cal_datetime'); + $mdatetime = $GLOBALS['egw_setup']->oProc->f('cal_mdatetime'); + $edatetime = $GLOBALS['egw_setup']->oProc->f('cal_edatetime'); + $priority = $GLOBALS['egw_setup']->oProc->f('cal_priority'); + $type = $GLOBALS['egw_setup']->oProc->f('cal_type'); + $title = $GLOBALS['egw_setup']->oProc->f('cal_name'); + $description = $GLOBALS['egw_setup']->oProc->f('cal_description'); + + $db2->query("INSERT INTO phpgw_cal(cal_id,owner,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) " + . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')",__LINE__,__FILE__); + } + $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry'); + +// calendar_entry_repeats => phpgw_cal_repeats + $GLOBALS['egw_setup']->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), + 'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True), + 'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True), + 'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'), + 'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1') + ), + 'pk' => array(), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__); + while($GLOBALS['egw_setup']->oProc->next_record()) + { + $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); + $recur_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); + switch($recur_type) + { + case 'daily': + $recur_type_num = RECUR_DAILY; + break; + case 'weekly': + $recur_type_num = RECUR_WEEKLY; + break; + case 'monthlybydate': + $recur_type_num = RECUR_MONTHLY_MDAY; + break; + case 'monthlybyday': + $recur_type_num = RECUR_MONTHLY_WDAY; + break; + case 'yearly': + $recur_type_num = RECUR_YEARLY; + break; + } + $recur_end_use = $GLOBALS['egw_setup']->oProc->f('cal_use_end'); + $recur_end = $GLOBALS['egw_setup']->oProc->f('cal_end'); + $recur_interval = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); + $days = strtoupper($GLOBALS['egw_setup']->oProc->f('cal_days')); + $recur_data = 0; + $recur_data += (substr($days,0,1)=='Y'?M_SUNDAY:0); + $recur_data += (substr($days,1,1)=='Y'?M_MONDAY:0); + $recur_data += (substr($days,2,1)=='Y'?M_TUESDAY:0); + $recur_data += (substr($days,3,1)=='Y'?M_WEDNESDAY:0); + $recur_data += (substr($days,4,1)=='Y'?M_THURSDAY:0); + $recur_data += (substr($days,5,1)=='Y'?M_FRIDAY:0); + $recur_data += (substr($days,6,1)=='Y'?M_SATURDAY:0); + $db2->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) " + . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__); + } + $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry_repeats'); + +// calendar_entry_user => phpgw_cal_user + $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user','phpgw_cal_user'); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.002'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_002() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.003'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_003() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', + Array( + 'fd' => array( + 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), + 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), + 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') + ), + 'pk' => array('locale','name'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.004'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_004() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.005'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_005() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.006'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_006() +{ + $GLOBALS['egw_setup']->oProc->DropTable('phpgw_cal_holidays'); + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', + Array( + 'fd' => array( + 'hol_id' => array('type' => 'auto','nullable' => False), + 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), + 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), + 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') + ), + 'pk' => array('hol_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.007'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_007() +{ + $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.008'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_008() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.009'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_009() +{ + $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.010'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_010() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.011'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_11_011() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.001'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_12() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.001'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + +function calendar_upgrade0_9_13_001() +{ + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.002'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_13_002() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.003'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_13_003() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', + Array( + 'fd' => array( + 'alarm_id' => array('type' => 'auto','nullable' => False), + 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), + 'cal_owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), + 'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False), + 'cal_text' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False) + ), + 'pk' => array('alarm_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','uid',array('type' => 'varchar', 'precision' => 255,'nullable' => False)); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','location',array('type' => 'varchar', 'precision' => 255,'nullable' => True)); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_13_004() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm','alarm_enabled',array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => '1')); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.005'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_13_005() +{ + $calendar_data = Array(); + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); + while($GLOBALS['egw_setup']->oProc->next_record()) + { + $calendar_data[$GLOBALS['egw_setup']->oProc->f('cal_id')] = $GLOBALS['egw_setup']->oProc->f('category'); + } + + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','category',array('type' => 'varchar', 'precision' => 30,'nullable' => True)); + + @reset($calendar_data); + while($calendar_data && list($cal_id,$category) = each($calendar_data)) + { + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id,__LINE__,__FILE__); + } + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.006'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +function calendar_upgrade0_9_13_006() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats','recur_exception',array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.007'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade0_9_13_007() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user','cal_type',array( + 'type' => 'varchar', + 'precision' => '1', + 'nullable' => False, + 'default' => 'u' + )); + + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra',array( + 'fd' => array( + 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), + 'cal_extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False), + 'cal_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') + ), + 'pk' => array('cal_id','cal_extra_name'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + $GLOBALS['egw_setup']->oProc->DropTable('phpgw_cal_alarm'); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.002'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade0_9_16_001() +{ + // this is to set the default as schema_proc was not setting an empty default + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user','cal_type',array( + 'type' => 'varchar', + 'precision' => '1', + 'nullable' => False, + 'default' => 'u' + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.002'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + +// the following series of updates add some indices, to speedup the selects + + +function calendar_upgrade0_9_16_002() +{ + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( + 'fd' => array( + 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), + 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), + 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), + 'recur_enddate' => array('type' => 'int','precision' => '8'), + 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') + ), + 'pk' => array(), + 'fk' => array(), + 'ix' => array('cal_id'), + 'uc' => array() + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.003'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade0_9_16_003() +{ + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user',array( + 'fd' => array( + 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'), + 'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u') + ), + 'pk' => array('cal_id','cal_login','cal_type'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.004'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade0_9_16_004() +{ + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays',array( + 'fd' => array( + 'hol_id' => array('type' => 'auto','nullable' => False), + 'locale' => array('type' => 'char','precision' => '2','nullable' => False), + 'name' => array('type' => 'varchar','precision' => '50','nullable' => False), + 'mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') + ), + 'pk' => array('hol_id'), + 'fk' => array(), + 'ix' => array('locale'), + 'uc' => array() + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.16.005'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade0_9_16_005() +{ + // creates uid's for all entries which do not have unique ones, they are '-@domain.com' + // very old entries even have an empty uid, see 0.9.16.006 update + $GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'",__LINE__,__FILE__); + while ($GLOBALS['egw_setup']->oProc->next_record()) + { + $config[$GLOBALS['egw_setup']->oProc->f(0)] = $GLOBALS['egw_setup']->oProc->f(1); + } + $GLOBALS['egw_setup']->oProc->query('UPDATE phpgw_cal SET uid='. + $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'),'cal_id', + $GLOBALS['egw_setup']->db->quote('-'.$config['install_id'].'@'. + ($config['mail_suffix'] ? $config['mail_suffix'] : 'local'))). + " WHERE uid LIKE '-@%' OR uid=''"); + + // we dont need to do update 0.9.16.007, as UpdateSequenze is called now by RefreshTable + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade0_9_16_006() +{ + // re-run the update as very old entries only have an empty uid + return calendar_upgrade0_9_16_005(); +} + + + +function calendar_upgrade0_9_16_007() +{ + // update the sequenzes for refreshed tables (postgres only) + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays','hol_id'); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_0() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','uid','cal_uid'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','owner','cal_owner'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','category','cal_category'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','groups','cal_groups'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','datetime','cal_starttime'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','mdatetime','cal_modified'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','edatetime','cal_endtime'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','priority','cal_priority'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','is_public','cal_public'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','title','cal_title'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','description','cal_description'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','location','cal_location'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','reference','cal_reference'); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.001'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_0_001() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','locale','hol_locale'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','name','hol_name'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','mday','hol_mday'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','month_num','hol_month_num'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','occurence','hol_occurence'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','dow','hol_dow'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','observance_rule','hol_observance_rule'); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.002'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_0_002() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_login','cal_user_id'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_type','cal_user_type'); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.003'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_0_003() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','cal_title',array( + 'type' => 'varchar', + 'precision' => '255', + 'nullable' => False, + 'default' => '1' + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.004'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_0_004() +{ + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( + 'fd' => array( + 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), + 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), + 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), + 'recur_enddate' => array('type' => 'int','precision' => '8'), + 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') + ), + 'pk' => array('cal_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.005'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_0_005() +{ + // change prefix of all calendar tables to egw_ + foreach(array('cal_user','cal_repeats','cal_extra','cal_holidays','cal') as $name) + { + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name,'egw_'.$name); + } + + // create new dates table, with content from the egw_cal table + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates',array( + 'fd' => array( + 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), + 'cal_start' => array('type' => 'int','precision' => '8','nullable' => False), + 'cal_end' => array('type' => 'int','precision' => '8','nullable' => False) + ), + 'pk' => array('cal_id','cal_start'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + $GLOBALS['egw_setup']->oProc->query("INSERT INTO egw_cal_dates SELECT cal_id,cal_starttime,cal_endtime FROM egw_cal"); + + // drop the fields transfered to the dates table + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( + 'fd' => array( + 'cal_id' => array('type' => 'auto','nullable' => False), + 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), + 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), + 'cal_category' => array('type' => 'varchar','precision' => '30'), + 'cal_groups' => array('type' => 'varchar','precision' => '255'), + 'cal_modified' => array('type' => 'int','precision' => '8'), + 'cal_endtime' => array('type' => 'int','precision' => '8'), + 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), + 'cal_type' => array('type' => 'varchar','precision' => '10'), + 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), + 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), + 'cal_description' => array('type' => 'text'), + 'cal_location' => array('type' => 'varchar','precision' => '255'), + 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') + ), + 'pk' => array('cal_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'cal_starttime'); + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( + 'fd' => array( + 'cal_id' => array('type' => 'auto','nullable' => False), + 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), + 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), + 'cal_category' => array('type' => 'varchar','precision' => '30'), + 'cal_groups' => array('type' => 'varchar','precision' => '255'), + 'cal_modified' => array('type' => 'int','precision' => '8'), + 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), + 'cal_type' => array('type' => 'varchar','precision' => '10'), + 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), + 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), + 'cal_description' => array('type' => 'text'), + 'cal_location' => array('type' => 'varchar','precision' => '255'), + 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') + ), + 'pk' => array('cal_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'cal_endtime'); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.001'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_1_001() +{ + /* done by RefreshTable() anyway + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_recur_date',array( + 'type' => 'int', + 'precision' => '8', + 'default' => '0' + ));*/ + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( + 'fd' => array( + 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'cal_recur_date' => array('type' => 'int','precision' => '8','default' => '0'), + 'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u'), + 'cal_user_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A') + ), + 'pk' => array('cal_id','cal_recur_date','cal_user_type','cal_user_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.002'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_1_002() +{ + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( + 'fd' => array( + 'cal_id' => array('type' => 'auto','nullable' => False), + 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), + 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), + 'cal_category' => array('type' => 'varchar','precision' => '30'), + 'cal_groups' => array('type' => 'varchar','precision' => '255'), + 'cal_modified' => array('type' => 'int','precision' => '8'), + 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), + 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), + 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), + 'cal_description' => array('type' => 'text'), + 'cal_location' => array('type' => 'varchar','precision' => '255'), + 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') + ), + 'pk' => array('cal_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'cal_type'); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_owner',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_priority',array( + 'type' => 'int', + 'precision' => '2', + 'nullable' => False, + 'default' => '2' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_public',array( + 'type' => 'int', + 'precision' => '2', + 'nullable' => False, + 'default' => '1' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_reference',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False, + 'default' => '0' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_modifier',array( + 'type' => 'int', + 'precision' => '4' + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.003'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_1_003() +{ + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( + 'fd' => array( + 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), + 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), + 'recur_enddate' => array('type' => 'int','precision' => '8'), + 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), + 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') + ), + 'pk' => array('cal_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'recur_use_end'); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','cal_id',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_type',array( + 'type' => 'int', + 'precision' => '2', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_interval',array( + 'type' => 'int', + 'precision' => '2', + 'default' => '1' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_data',array( + 'type' => 'int', + 'precision' => '2', + 'default' => '1' + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.004'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_1_004() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False, + 'default' => '0' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False, + 'default' => '0' + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.005'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_1_005() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_quantity',array( + 'type' => 'int', + 'precision' => '4', + 'default' => '1' + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.006'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_1_006() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_non_blocking',array( + 'type' => 'int', + 'precision' => '2', + 'default' => '0' + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.007'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_1_007() +{ + $GLOBALS['egw_setup']->db->update('egw_cal_repeats',array('recur_exception' => null),array('recur_exception' => ''),__LINE__,__FILE__,'calendar'); + + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_exception',array( + 'type' => 'text' + )); + + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.008'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_1_008() +{ + $config =& CreateObject('phpgwapi.config','calendar'); + $config_data = $config->read_repository(); + if (isset($config_data['fields'])) // old custom fields + { + $customfields = array(); + $order = 0; + foreach($config_data['fields'] as $name => $data) + { + if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field + { + $customfields[substr($name,1)] = array( + 'type' => 'text', + 'len' => $data['length'].($data['shown'] ? ','.$data['shown'] : ''), + 'label' => $data['name'], + 'order' => ($order += 10), + ); + } + } + if (count($customfields)) + { + $config->save_value('customfields',$customfields); + } + $config->delete_value('fields'); + $config->save_repository(); // delete_value does not save + } + $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.009'; + return $GLOBALS['setup_info']['calendar']['currentver']; +} + + + +function calendar_upgrade1_0_1_009() +{ + $db2 = clone($GLOBALS['egw_setup']->db); + $add_groups = array(); + $GLOBALS['egw_setup']->db->select('egw_cal','DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date',"cal_groups != ''",__LINE__,__FILE__, + False,'','calendar',0,',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); + while(($row = $GLOBALS['egw_setup']->db->row(true))) + { + $row['cal_user_type'] = 'u'; + foreach(explode(',',$row['cal_groups']) as $group) + { + $row['cal_user_id'] = $group; + $db2->insert('egw_cal_user',array('cal_status' => 'U'),$row,__LINE__,__FILE__,'calendar'); + } + } + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( + 'fd' => array( + 'cal_id' => array('type' => 'auto','nullable' => False), + 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), + 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'cal_category' => array('type' => 'varchar','precision' => '30'), + 'cal_modified' => array('type' => 'int','precision' => '8'), + 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), + 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), + 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), + 'cal_description' => array('type' => 'text'), + 'cal_location' => array('type' => 'varchar','precision' => '255'), + 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'cal_modifier' => array('type' => 'int','precision' => '4'), + 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0') + ), + 'pk' => array('cal_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'cal_groups'); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2'; +} + + + +function calendar_upgrade1_2() +{ + // get old alarms (saved before 1.2) working again + $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'",__LINE__,__FILE__); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2.001'; +} + + +function calendar_upgrade1_2_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_special',array( + 'type' => 'int', + 'precision' => '2', + 'default' => '0' + )); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.3.001'; +} + + +function calendar_upgrade1_3_001() +{ + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.4'; +} + + +function calendar_upgrade1_4() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_etag',array( + 'type' => 'int', + 'precision' => '4', + 'default' => '0' + )); + // as we no longer create cal_edit_time|user and already set default 0 for cal_etag, we skip the 1.5 update + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.001'; +} + + +function calendar_upgrade1_5() +{ + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( + 'fd' => array( + 'cal_id' => array('type' => 'auto','nullable' => False), + 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), + 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'cal_category' => array('type' => 'varchar','precision' => '30'), + 'cal_modified' => array('type' => 'int','precision' => '8'), + 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), + 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), + 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), + 'cal_description' => array('type' => 'text'), + 'cal_location' => array('type' => 'varchar','precision' => '255'), + 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'cal_modifier' => array('type' => 'int','precision' => '4'), + 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), + 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), + 'cal_etag' => array('type' => 'int','precision' => '4'), + 'cal_edit_time' => array('type' => 'int','precision' => '8') + ), + 'pk' => array('cal_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'cal_edit_user'); + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( + 'fd' => array( + 'cal_id' => array('type' => 'auto','nullable' => False), + 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), + 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'cal_category' => array('type' => 'varchar','precision' => '30'), + 'cal_modified' => array('type' => 'int','precision' => '8'), + 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), + 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), + 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), + 'cal_description' => array('type' => 'text'), + 'cal_location' => array('type' => 'varchar','precision' => '255'), + 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'cal_modifier' => array('type' => 'int','precision' => '4'), + 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), + 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), + 'cal_etag' => array('type' => 'int','precision' => '4') + ), + 'pk' => array('cal_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'cal_edit_time'); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_etag',array( + 'type' => 'int', + 'precision' => '4', + 'default' => '0' + )); + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL',__LINE__,__FILE__); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.001'; +} + + +function calendar_upgrade1_5_001() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( + 'type' => 'varchar', + 'precision' => '128', + 'nullable' => False + )); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.002'; +} + + +function calendar_upgrade1_5_002() +{ + // update the alarm methods + $async = new asyncservice(); + foreach((array)$async->read('cal:%') as $id => $job) + { + if ($job['method'] == 'calendar.bocalupdate.send_alarm') + { + $job['method'] = 'calendar.calendar_boupdate.send_alarm'; + $async->write($job,true); + } + } + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.6'; +} + +/** + * Adjust UIDs of series exceptions to RFC standard + * Propagate cal_reference field to temporarily contain RECURRENCE-ID + * + * @return string + */ +function calendar_upgrade1_6() +{ + // Set UID of series exception to UID of series master + // update cal_etag, cal_modified and cal_modifier to distribute changes on GroupDAV devices + foreach($GLOBALS['egw_setup']->db->query(' + SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master + FROM egw_cal cal_ex + JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id + WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) + { + if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) + { + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. + '\',cal_etag=cal_etag+1,cal_modified='.time(). + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); + } + } + + // Search series exception for nearest exception in series master and add that RECURRENCE-ID + // as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001) + foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal + JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id + JOIN egw_cal_repeats ON cal_reference=egw_cal_repeats.cal_id + WHERE cal_reference != 0',__LINE__,__FILE__) as $row) + { + $recurrence = null; + foreach(explode(',',$row['recur_exception']) as $ts) + { + if (is_null($recurrence) || abs($ts-$row['cal_start']) < $diff) + { + $recurrence = $ts; + $diff = abs($ts-$row['cal_start']); + } + } + if ($recurrence) + { + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$recurrence. + ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); + } + else + { + // if we cannot determine the RECURRENCE-ID use cal_start + // because RECURRENCE-ID must be present + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$row['cal_start']. + ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); + } + } + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.6.003'; +} + + +/** + * Adding column for RECURRENCE-ID of master event to improve iCal handling of exceptions + * + * @return string + */ +function calendar_upgrade1_6_003() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_creator',array( + 'type' => 'int', + 'precision' => '4', + 'comment' => 'creating user' + )); + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner',__LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_creator',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False, + 'comment' => 'creating user' + )); + + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_created',array( + 'type' => 'int', + 'precision' => '8', + 'comment' => 'creation time of event' + )); + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified',__LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_created',array( + 'type' => 'int', + 'precision' => '8', + 'nullable' => False, + 'comment' => 'creation time of event' + )); + + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_recurrence',array( + 'type' => 'int', + 'precision' => '8', + 'nullable' => False, + 'default' => '0', + 'comment' => 'cal_start of original recurrence for exception' + )); + + // move RECURRENCE-ID from temporarily (1.6.003) + // used field cal_reference to new field cal_recurrence + // and restore cal_reference field of series exceptions with id of the series master + foreach($GLOBALS['egw_setup']->db->query(' + SELECT cal_ex.cal_id AS cal_id_ex,cal_master.cal_id AS cal_id_master, + cal_ex.cal_reference AS cal_reference_ex,cal_ex.cal_uid AS cal_uid_ex, + cal_master.cal_uid AS cal_uid_master + FROM egw_cal cal_ex + JOIN egw_cal cal_master + ON cal_ex.cal_uid=cal_master.cal_uid AND cal_master.cal_reference = 0 AND cal_ex.cal_owner = cal_master.cal_owner + WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__,__FILE__) as $row) + { + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_recurrence='.(int)$row['cal_reference_ex']. + ', cal_reference='.(int)$row['cal_id_master']. + ' WHERE cal_id='.(int)$row['cal_id_ex']); + } + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.001'; +} + +/** + * Adding participant roles table to improve iCal support + * + * @return string + */ +function calendar_upgrade1_7_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_role',array( + 'type' => 'varchar', + 'precision' => '64', + 'default' => 'REQ-PARTICIPANT' + )); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.002'; +} + +/** + * Adding timezones table egw_cal_timezones + * + * @return string + */ +function calendar_upgrade1_7_002() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones',array( + 'fd' => array( + 'tz_id' => array('type' => 'auto','nullable' => False), + 'tz_tzid' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'tz_alias' => array('type' => 'int','precision' => '4','comment' => 'tz_id for data'), + 'tz_latitude' => array('type' => 'int','precision' => '4'), + 'tz_longitude' => array('type' => 'int','precision' => '4'), + 'tz_component' => array('type' => 'text','comment' => 'iCal VTIMEZONE component') + ), + 'pk' => array('tz_id'), + 'fk' => array(), + 'ix' => array('tz_alias'), + 'uc' => array('tz_tzid') + )); + // import timezone data, throw exception if no PDO sqlite support + calendar_timezones::import_sqlite(); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.003'; +} + +/** + * Adding automatic timestamp for participant table, maximum can be used as part of a ctag for CalDAV + * + * @return string + */ +function calendar_upgrade1_7_003() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_type',array( + 'type' => 'varchar', + 'precision' => '1', + 'nullable' => False, + 'default' => 'u', + 'comment' => 'u=user, g=group, c=contact, r=resource, e=email' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( + 'type' => 'varchar', + 'precision' => '128', + 'nullable' => False, + 'comment' => 'id or email-address for type=e' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_status',array( + 'type' => 'char', + 'precision' => '1', + 'default' => 'A', + 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_quantity',array( + 'type' => 'int', + 'precision' => '4', + 'default' => '1', + 'comment' => 'only for certain types (eg. resources)' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_role',array( + 'type' => 'varchar', + 'precision' => '64', + 'default' => 'REQ-PARTICIPANT', + 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_modified',array( + 'type' => 'timestamp', + 'default' => 'current_timestamp', + 'comment' => 'automatic timestamp of last update' + )); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.004'; +} + +/** + * Adding timezone id column, to fully support timezones in calendar + * + * @return string + */ +function calendar_upgrade1_7_004() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_start',array( + 'type' => 'int', + 'precision' => '8', + 'nullable' => False, + 'comment' => 'starttime in server time' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_end',array( + 'type' => 'int', + 'precision' => '8', + 'nullable' => False, + 'comment' => 'endtime in server time' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','tz_id',array( + 'type' => 'int', + 'precision' => '4', + 'comment' => 'key into egw_cal_timezones' + )); + + // set id of server timezone for existing events, as that's the timezone their recurrences are using + if (($tzid = date_default_timezone_get()) && ($tz_id = calendar_timezones::tz2id($tzid))) + { + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id,__LINE__,__FILE__); + } + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.005'; +} + +/** + * Adding Windows timezones as alias to standard TZID's + * + * @link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/windows_tzid.html + * + * @return string + */ +function calendar_upgrade1_7_005() +{ + foreach(array( + 'AUS Central Standard Time' => 'Australia/Darwin', + 'AUS Eastern Standard Time' => 'Australia/Sydney', + 'Afghanistan Standard Time' => 'Asia/Kabul', + 'Alaskan Standard Time' => 'America/Anchorage', + 'Arab Standard Time' => 'Asia/Riyadh', + 'Arabian Standard Time' => 'Asia/Dubai', + 'Arabic Standard Time' => 'Asia/Baghdad', + 'Argentina Standard Time' => 'America/Argentina/Buenos_Aires', // was 'America/Buenos_Aires', + 'Armenian Standard Time' => 'Asia/Yerevan', + 'Atlantic Standard Time' => 'America/Halifax', + 'Azerbaijan Standard Time' => 'Asia/Baku', + 'Azores Standard Time' => 'Atlantic/Azores', + 'Canada Central Standard Time' => 'America/Regina', + 'Cape Verde Standard Time' => 'Atlantic/Cape_Verde', + 'Caucasus Standard Time' => 'Asia/Yerevan', + 'Cen. Australia Standard Time' => 'Australia/Adelaide', + 'Central America Standard Time' => 'America/Guatemala', + 'Central Asia Standard Time' => 'Asia/Dhaka', + 'Central Brazilian Standard Time' => 'America/Manaus', + 'Central Europe Standard Time' => 'Europe/Budapest', + 'Central European Standard Time' => 'Europe/Warsaw', + 'Central Pacific Standard Time' => 'Pacific/Guadalcanal', + 'Central Standard Time' => 'America/Chicago', + 'Central Standard Time (Mexico)' => 'America/Mexico_City', + 'China Standard Time' => 'Asia/Shanghai', + 'Dateline Standard Time' => 'Etc/GMT+12', + 'E. Africa Standard Time' => 'Africa/Nairobi', + 'E. Australia Standard Time' => 'Australia/Brisbane', + 'E. Europe Standard Time' => 'Europe/Minsk', + 'E. South America Standard Time' => 'America/Sao_Paulo', + 'Eastern Standard Time' => 'America/New_York', + 'Egypt Standard Time' => 'Africa/Cairo', + 'Ekaterinburg Standard Time' => 'Asia/Yekaterinburg', + 'FLE Standard Time' => 'Europe/Kiev', + 'Fiji Standard Time' => 'Pacific/Fiji', + 'GMT Standard Time' => 'Europe/London', + 'GTB Standard Time' => 'Europe/Istanbul', + 'Georgian Standard Time' => 'Etc/GMT-3', + 'Greenland Standard Time' => 'America/Godthab', + 'Greenwich Standard Time' => 'Atlantic/Reykjavik', // was 'Africa/Reykjavik', + 'Hawaiian Standard Time' => 'Pacific/Honolulu', + 'India Standard Time' => 'Asia/Calcutta', + 'Iran Standard Time' => 'Asia/Tehran', + 'Israel Standard Time' => 'Asia/Jerusalem', + 'Jordan Standard Time' => 'Asia/Amman', + 'Korea Standard Time' => 'Asia/Seoul', + 'Mauritius Standard Time' => 'Indian/Mauritius', + 'Mexico Standard Time' => 'America/Mexico_City', + 'Mexico Standard Time 2' => 'America/Chihuahua', + 'Mid-Atlantic Standard Time' => 'Atlantic/South_Georgia', + 'Middle East Standard Time' => 'Asia/Beirut', + 'Montevideo Standard Time' => 'America/Montevideo', + 'Morocco Standard Time' => 'Africa/Casablanca', + 'Mountain Standard Time' => 'America/Denver', + 'Mountain Standard Time (Mexico)' => 'America/Chihuahua', + 'Myanmar Standard Time' => 'Asia/Rangoon', + 'N. Central Asia Standard Time' => 'Asia/Novosibirsk', + 'Namibia Standard Time' => 'Africa/Windhoek', + 'Nepal Standard Time' => 'Asia/Katmandu', + 'New Zealand Standard Time' => 'Pacific/Auckland', + 'Newfoundland Standard Time' => 'America/St_Johns', + 'North Asia East Standard Time' => 'Asia/Irkutsk', + 'North Asia Standard Time' => 'Asia/Krasnoyarsk', + 'Pacific SA Standard Time' => 'America/Santiago', + 'Pacific Standard Time' => 'America/Los_Angeles', + 'Pacific Standard Time (Mexico)' => 'America/Tijuana', + 'Pakistan Standard Time' => 'Asia/Karachi', + 'Romance Standard Time' => 'Europe/Paris', + 'Russian Standard Time' => 'Europe/Moscow', + 'SA Eastern Standard Time' => 'Etc/GMT+3', + 'SA Pacific Standard Time' => 'America/Bogota', + 'SA Western Standard Time' => 'America/La_Paz', + 'SE Asia Standard Time' => 'Asia/Bangkok', + 'Samoa Standard Time' => 'Pacific/Apia', + 'Singapore Standard Time' => 'Asia/Singapore', + 'South Africa Standard Time' => 'Africa/Johannesburg', + 'Sri Lanka Standard Time' => 'Asia/Colombo', + 'Taipei Standard Time' => 'Asia/Taipei', + 'Tasmania Standard Time' => 'Australia/Hobart', + 'Tokyo Standard Time' => 'Asia/Tokyo', + 'Tonga Standard Time' => 'Pacific/Tongatapu', + 'US Eastern Standard Time' => 'Etc/GMT+5', + 'US Mountain Standard Time' => 'America/Phoenix', + 'Venezuela Standard Time' => 'America/Caracas', + 'Vladivostok Standard Time' => 'Asia/Vladivostok', + 'W. Australia Standard Time' => 'Australia/Perth', + 'W. Central Africa Standard Time' => 'Africa/Lagos', + 'W. Europe Standard Time' => 'Europe/Berlin', + 'West Asia Standard Time' => 'Asia/Tashkent', + 'West Pacific Standard Time' => 'Pacific/Port_Moresby', + 'Yakutsk Standard Time' => 'Asia/Yakutsk', + ) as $win_tz => $tzid) + { + if (!(calendar_timezones::tz2id($win_tz))) // not already defined + { + if (!($id = calendar_timezones::tz2id($tzid))) + { + error_log(__METHOD__."() Windows timezone: '$win_tz': TZID='$tzid' is NOT defined!"); + } + else + { + $GLOBALS['egw']->db->insert('egw_cal_timezones',array( + 'tz_alias' => $id, + 'tz_latitude' => null, + 'tz_longitude' => null, + 'tz_component' => null, + ),array( + 'tz_tzid' => $win_tz, + ),__LINE__,__FILE__,'calendar'); + } + } + } + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.006'; +} + +/** + * // Fix whole day event cal_end times which are set to 23:59:00 or 00:00 instead of 23:59:59 + * // Fix recur_interval from 0 to 1 for event series + * + * @return string + */ +function calendar_upgrade1_7_006() +{ + foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates + WHERE (cal_end-cal_start)%86400=86340',__LINE__,__FILE__) as $row) + { + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59 + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); + } + + foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates + WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row) + { + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1 + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); + } + + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 + WHERE recur_interval=0',__LINE__,__FILE__); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; +} + +/** + * Adjust UIDs of series exceptions to RFC standard + * this was already done in upgrade to 1.6.003 but we repeat it here in a non-destructive + * way to catch installations which already used versions > 1.6.003 before we added this to setup + * + * @return string + */ +function calendar_upgrade1_7_007() +{ + // Set UID of series exception to UID of series master + // update cal_etag,cal_modified and cal_modifier to distribute changes on GroupDAV devices + foreach($GLOBALS['egw_setup']->db->query(' + SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master + FROM egw_cal cal_ex + JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id + WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) + { + if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) + { + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. + '\',cal_etag=cal_etag+1,cal_modified='.time(). + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); + } + } + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008'; +} + +/** + * Create an index over egw_cal_user.cal_user_type and cal_user_id, to speed up calendar queries + * + * @return string + */ +function calendar_upgrade1_7_008() +{ + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user',array('cal_user_type','cal_user_id')); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.009'; +} + +/** + * Create an index over egw_cal.cal_uid and cal_owner, to speed up calendar queries specially sync + * + * @return string + */ +function calendar_upgrade1_7_009() +{ + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_uid'); + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_owner'); + + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010'; +} + +function calendar_upgrade1_7_010() +{ + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.8'; +} diff --git a/egw-pear/setup/setup.inc.php b/egw-pear/setup/setup.inc.php new file mode 100644 index 0000000000..9d3703a0f0 --- /dev/null +++ b/egw-pear/setup/setup.inc.php @@ -0,0 +1,49 @@ + 'PEAR - PHP Extension and Application Repository', + 'url' => 'http://pear.php.net', +); +$setup_info['egw-pear']['license'] = 'PHP'; +$setup_info['egw-pear']['description'] = + 'A place for PEAR modules modified for eGroupWare.'; + +$setup_info['egw-pear']['note'] = + 'This application is a place for PEAR modules used by eGroupWare, which are NOT YET available from pear, + because we patched them somehow and the PEAR modules are not released upstream. + This application is under the LGPL license because the GPL is not compatible with the PHP license. + If the modules are available from PEAR they do NOT belong here anymore.'; + +$setup_info['egw-pear']['maintainer'] = array( + 'name' => 'eGroupWare coreteam', + 'email' => 'egroupware-developers@lists.sourceforge.net', +); + +// installation checks for egw-pear +$setup_info['egw-pear']['check_install'] = array( + // we need pear itself to be installed + '' => array( + 'func' => 'pear_check', + 'from' => 'FMail', + ), + // Net_Socket is required from Net_IMAP & Net_Sieve + 'Net_Socket' => array( + 'func' => 'pear_check', + 'from' => 'FMail', + ), +); diff --git a/emailadmin/setup/setup.inc.php b/emailadmin/setup/setup.inc.php new file mode 100644 index 0000000000..90f2fdaf12 --- /dev/null +++ b/emailadmin/setup/setup.inc.php @@ -0,0 +1,70 @@ + + * @package emailadmin + * @subpackage setup + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +$setup_info['emailadmin']['name'] = 'emailadmin'; +$setup_info['emailadmin']['title'] = 'EMailAdmin'; +$setup_info['emailadmin']['version'] = '1.8'; +$setup_info['emailadmin']['app_order'] = 10; +$setup_info['emailadmin']['enable'] = 2; +$setup_info['emailadmin']['index'] = 'emailadmin.emailadmin_ui.listProfiles'; + +$setup_info['emailadmin']['author'] = 'Lars Kneschke'; +$setup_info['emailadmin']['license'] = 'GPL'; +$setup_info['emailadmin']['description'] = + 'A central Mailserver management application for EGroupWare.'; +$setup_info['emailadmin']['note'] = + ''; +$setup_info['emailadmin']['maintainer'] = array( + 'name' => 'Leithoff, Klaus', + 'email' => 'kl@stylite.de' +); + +$setup_info['emailadmin']['tables'][] = 'egw_emailadmin'; + +/* The hooks this app includes, needed for hooks registration */ +#$setup_info['emailadmin']['hooks'][] = 'preferences'; +$setup_info['emailadmin']['hooks']['admin'] = 'emailadmin_hooks::admin'; +$setup_info['emailadmin']['hooks']['edit_user'] = 'emailadmin_hooks::edit_user'; +$setup_info['emailadmin']['hooks']['view_user'] = 'emailadmin_hooks::edit_user'; +$setup_info['emailadmin']['hooks']['edit_group'] = 'emailadmin_hooks::edit_group'; +$setup_info['emailadmin']['hooks']['group_manager'] = 'emailadmin_hooks::edit_group'; +$setup_info['emailadmin']['hooks']['deleteaccount'] = 'emailadmin_hooks::deleteaccount'; +$setup_info['emailadmin']['hooks']['deletegroup'] = 'emailadmin_hooks::deletegroup'; +/* Dependencies for this app to work */ +$setup_info['emailadmin']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info['emailadmin']['depends'][] = array( + 'appname' => 'egw-pear', + 'versions' => Array('1.8','1.9') +); +// installation checks for felamimail +$setup_info['emailadmin']['check_install'] = array( + '' => array( + 'func' => 'pear_check', + 'from' => 'EMailAdmin', + ), + 'Auth_SASL' => array( + 'func' => 'pear_check', + 'from' => 'EMailAdmin', + ), + 'Net_IMAP' => array( + 'func' => 'pear_check', + 'from' => 'EMailAdmin', + ), + 'imap' => array( + 'func' => 'extension_check', + 'from' => 'EMailAdmin', + ), +); diff --git a/emailadmin/setup/tables_update.inc.php b/emailadmin/setup/tables_update.inc.php new file mode 100644 index 0000000000..182d2e74c7 --- /dev/null +++ b/emailadmin/setup/tables_update.inc.php @@ -0,0 +1,287 @@ + + * @package emailadmin + * @subpackage setup + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +function emailadmin_upgrade0_0_3() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','smtpType', array('type' => 'int', 'precision' => 4)); + + return $setup_info['emailadmin']['currentver'] = '0.0.4'; +} + + +function emailadmin_upgrade0_0_4() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','defaultDomain', array('type' => 'varchar', 'precision' => 100)); + + return $setup_info['emailadmin']['currentver'] = '0.0.5'; +} + + +function emailadmin_upgrade0_0_5() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','organisationName', array('type' => 'varchar', 'precision' => 100)); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','userDefinedAccounts', array('type' => 'varchar', 'precision' => 3)); + + return $setup_info['emailadmin']['currentver'] = '0.0.6'; +} + + +function emailadmin_upgrade0_0_6() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','oldimapcclient',array( + 'type' => 'varchar', + 'precision' => '3' + )); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '0.0.007'; +} + + +function emailadmin_upgrade0_0_007() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_emailadmin','oldimapcclient','imapoldcclient'); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '0.0.008'; +} + + +function emailadmin_upgrade0_0_008() +{ + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.0.0'; +} + + +function emailadmin_upgrade1_0_0() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','editforwardingaddress',array( + 'type' => 'varchar', + 'precision' => '3' + )); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.0.1'; +} + + +function emailadmin_upgrade1_0_1() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','ea_order', array('type' => 'int', 'precision' => 4)); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.0.2'; +} + + +function emailadmin_upgrade1_0_2() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','ea_appname', array('type' => 'varchar','precision' => '80')); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_emailadmin','ea_group', array('type' => 'varchar','precision' => '80')); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.0.3'; +} + + +function emailadmin_upgrade1_0_3() +{ + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_emailadmin','egw_emailadmin'); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.2'; +} + + +function emailadmin_upgrade1_2() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','profileID','ea_profile_id'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpServer','ea_smtp_server'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpType','ea_smtp_type'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpPort','ea_smtp_port'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpAuth','ea_smtp_auth'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','editforwardingaddress','ea_editforwardingaddress'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPServer','ea_smtp_ldap_server'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPBaseDN','ea_smtp_ldap_basedn'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPAdminDN','ea_smtp_ldap_admindn'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPAdminPW','ea_smtp_ldap_adminpw'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','smtpLDAPUseDefault','ea_smtp_ldap_use_default'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapServer','ea_imap_server'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapType','ea_imap_type'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapPort','ea_imap_port'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapLoginType','ea_imap_login_type'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapTLSAuthentication','ea_imap_tsl_auth'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapTLSEncryption','ea_imap_tsl_encryption'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapEnableCyrusAdmin','ea_imap_enable_cyrus'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapAdminUsername','ea_imap_admin_user'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapAdminPW','ea_imap_admin_pw'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapEnableSieve','ea_imap_enable_sieve'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapSieveServer','ea_imap_sieve_server'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapSievePort','ea_imap_sieve_port'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','description','ea_description'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','defaultDomain','ea_default_domain'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','organisationName','ea_organisation_name'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','userDefinedAccounts','ea_user_defined_accounts'); + $GLOBALS['egw_setup']->oProc->RenameColumn('egw_emailadmin','imapoldcclient','ea_imapoldcclient'); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.2.001'; +} + + +function emailadmin_upgrade1_2_001() +{ + /* done by RefreshTable() anyway + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_smtp_auth_username',array( + 'type' => 'varchar', + 'precision' => '80' + ));*/ + /* done by RefreshTable() anyway + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_smtp_auth_password',array( + 'type' => 'varchar', + 'precision' => '80' + ));*/ + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_emailadmin',array( + 'fd' => array( + 'ea_profile_id' => array('type' => 'auto','nullable' => False), + 'ea_smtp_server' => array('type' => 'varchar','precision' => '80'), + 'ea_smtp_type' => array('type' => 'int','precision' => '4'), + 'ea_smtp_port' => array('type' => 'int','precision' => '4'), + 'ea_smtp_auth' => array('type' => 'varchar','precision' => '3'), + 'ea_editforwardingaddress' => array('type' => 'varchar','precision' => '3'), + 'ea_smtp_ldap_server' => array('type' => 'varchar','precision' => '80'), + 'ea_smtp_ldap_basedn' => array('type' => 'varchar','precision' => '200'), + 'ea_smtp_ldap_admindn' => array('type' => 'varchar','precision' => '200'), + 'ea_smtp_ldap_adminpw' => array('type' => 'varchar','precision' => '30'), + 'ea_smtp_ldap_use_default' => array('type' => 'varchar','precision' => '3'), + 'ea_imap_server' => array('type' => 'varchar','precision' => '80'), + 'ea_imap_type' => array('type' => 'int','precision' => '4'), + 'ea_imap_port' => array('type' => 'int','precision' => '4'), + 'ea_imap_login_type' => array('type' => 'varchar','precision' => '20'), + 'ea_imap_tsl_auth' => array('type' => 'varchar','precision' => '3'), + 'ea_imap_tsl_encryption' => array('type' => 'varchar','precision' => '3'), + 'ea_imap_enable_cyrus' => array('type' => 'varchar','precision' => '3'), + 'ea_imap_admin_user' => array('type' => 'varchar','precision' => '40'), + 'ea_imap_admin_pw' => array('type' => 'varchar','precision' => '40'), + 'ea_imap_enable_sieve' => array('type' => 'varchar','precision' => '3'), + 'ea_imap_sieve_server' => array('type' => 'varchar','precision' => '80'), + 'ea_imap_sieve_port' => array('type' => 'int','precision' => '4'), + 'ea_description' => array('type' => 'varchar','precision' => '200'), + 'ea_default_domain' => array('type' => 'varchar','precision' => '100'), + 'ea_organisation_name' => array('type' => 'varchar','precision' => '100'), + 'ea_user_defined_accounts' => array('type' => 'varchar','precision' => '3'), + 'ea_imapoldcclient' => array('type' => 'varchar','precision' => '3'), + 'ea_order' => array('type' => 'int','precision' => '4'), + 'ea_appname' => array('type' => 'varchar','precision' => '80'), + 'ea_group' => array('type' => 'varchar','precision' => '80'), + 'ea_smtp_auth_username' => array('type' => 'varchar','precision' => '80'), + 'ea_smtp_auth_password' => array('type' => 'varchar','precision' => '80') + ), + 'pk' => array('ea_profile_id'), + 'fk' => array(), + 'ix' => array('ea_appname','ea_group'), + 'uc' => array() + )); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.2.002'; +} + + +function emailadmin_upgrade1_2_002() +{ + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.4'; +} + + +function emailadmin_upgrade1_4() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_user_defined_signatures',array( + 'type' => 'varchar', + 'precision' => '3' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_default_signature',array( + 'type' => 'varchar', + 'precision' => '255' + )); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.4.001'; +} + + +function emailadmin_upgrade1_4_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_user_defined_identities',array( + 'type' => 'varchar', + 'precision' => '3' + )); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.5.001'; +} + + +function emailadmin_upgrade1_5_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_user',array( + 'type' => 'varchar', + 'precision' => '80' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_active',array( + 'type' => 'int', + 'precision' => '4' + )); + $GLOBALS['phpgw_setup']->oProc->query("UPDATE egw_emailadmin set ea_user='0', ea_active=1",__LINE__,__FILE__); + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.5.002'; +} + + +function emailadmin_upgrade1_5_002() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_imap_auth_username',array( + 'type' => 'varchar', + 'precision' => '80' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_imap_auth_password',array( + 'type' => 'varchar', + 'precision' => '80' + )); + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.5.003'; +} + + +function emailadmin_upgrade1_5_003() +{ + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.5.004'; +} + + +function emailadmin_upgrade1_5_004() +{ + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.6'; +} + + +function emailadmin_upgrade1_6() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_emailadmin','ea_default_signature',array( + 'type' => 'text' + )); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.6.001'; +} + +function emailadmin_upgrade1_6_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_emailadmin','ea_stationery_active_templates',array( + 'type' => 'text' + )); + + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.7.003'; +} + +function emailadmin_upgrade1_7_003() +{ + return $GLOBALS['setup_info']['emailadmin']['currentver'] = '1.8'; +} diff --git a/etemplate/setup/setup.inc.php b/etemplate/setup/setup.inc.php new file mode 100644 index 0000000000..1085341c25 --- /dev/null +++ b/etemplate/setup/setup.inc.php @@ -0,0 +1,43 @@ + + * @copyright 2002-8 by RalfBecker@outdoor-training.de + * @package etemplate + * @subpackage setup + * @version $Id$ + */ + +$setup_info['etemplate']['name'] = 'etemplate'; +$setup_info['etemplate']['version'] = '1.8'; +$setup_info['etemplate']['app_order'] = 60; // just behind the developers-tools +$setup_info['etemplate']['tables'] = array('egw_etemplate'); +$setup_info['etemplate']['enable'] = 1; +$setup_info['etemplate']['index'] = 'etemplate.editor.edit'; + +$setup_info['etemplate']['author'] = + $setup_info['etemplate']['maintainer'] = array( + 'name' => 'Ralf Becker', + 'email' => 'ralfbecker@outdoor-training.de' +); +$setup_info['etemplate']['license'] = 'GPL'; +$setup_info['etemplate']['description'] = + 'eTemplates are a new widget-based template system for eGroupWare with an + interactive editor and a database table-editor (creates tables_current.inc.php and + updates automaticaly tables_update.inc.php).'; +$setup_info['etemplate']['note'] = + 'For more information check out the Tutorial, + the Referenz Documentation + or the eTemplate page in our Wiki.'; + +/* The hooks this app includes, needed for hooks registration */ +$setup_info['etemplate']['hooks'][] = 'sidebox_menu'; + +/* Dependencies for this app to work */ +$setup_info['etemplate']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); diff --git a/etemplate/setup/tables_update.inc.php b/etemplate/setup/tables_update.inc.php new file mode 100644 index 0000000000..c5ab8e1ae8 --- /dev/null +++ b/etemplate/setup/tables_update.inc.php @@ -0,0 +1,126 @@ + + * @package etemplate + * @subpackage setup + * @copyright (c) 200s-8 by Ralf Becker + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +function etemplate_upgrade0_9_13_001() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_data',array( + 'type' => 'text', + 'nullable' => True + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_size',array( + 'type' => 'char', + 'precision' => '128', + 'nullable' => True + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_style',array( + 'type' => 'text', + 'nullable' => True + )); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_etemplate','et_modified',array( + 'type' => 'int', + 'precision' => '4', + 'default' => '0', + 'nullable' => False + )); + + $GLOBALS['setup_info']['etemplate']['currentver'] = '0.9.15.001'; + return $GLOBALS['setup_info']['etemplate']['currentver']; +} + + +function etemplate_upgrade0_9_15_001() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_name',array( + 'type' => 'varchar', + 'precision' => '80', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_template',array( + 'type' => 'varchar', + 'precision' => '20', + 'nullable' => False, + 'default' => '' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_lang',array( + 'type' => 'varchar', + 'precision' => '5', + 'nullable' => False, + 'default' => '' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_version',array( + 'type' => 'varchar', + 'precision' => '20', + 'nullable' => False, + 'default' => '' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_etemplate','et_size',array( + 'type' => 'varchar', + 'precision' => '128', + 'nullable' => True + )); + + $GLOBALS['setup_info']['etemplate']['currentver'] = '0.9.15.002'; + return $GLOBALS['setup_info']['etemplate']['currentver']; +} + + +function etemplate_upgrade0_9_15_002() +{ + $GLOBALS['setup_info']['etemplate']['currentver'] = '1.0.0'; + return $GLOBALS['setup_info']['etemplate']['currentver']; +} + + +function etemplate_upgrade1_0_0() +{ + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_etemplate','egw_etemplate'); + + $GLOBALS['setup_info']['etemplate']['currentver'] = '1.2'; + return $GLOBALS['setup_info']['etemplate']['currentver']; +} + + +function etemplate_upgrade1_2() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_etemplate','et_modified',array( + 'type' => 'int', + 'precision' => '8', + 'nullable' => False, + 'default' => '0' + )); + + return $GLOBALS['setup_info']['etemplate']['currentver'] = '1.4'; +} + + +function etemplate_upgrade1_4() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_etemplate','et_data',array( + 'type' => 'longtext', + 'nullable' => True, + )); + + return $GLOBALS['setup_info']['etemplate']['currentver'] = '1.5.001'; +} + + +function etemplate_upgrade1_5_001() +{ + return $GLOBALS['setup_info']['etemplate']['currentver'] = '1.6'; +} + + +function etemplate_upgrade1_6() +{ + return $GLOBALS['setup_info']['etemplate']['currentver'] = '1.8'; +} diff --git a/felamimail/setup/setup.inc.php b/felamimail/setup/setup.inc.php new file mode 100644 index 0000000000..58f7b74b99 --- /dev/null +++ b/felamimail/setup/setup.inc.php @@ -0,0 +1,75 @@ + 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info['felamimail']['depends'][] = array( + 'appname' => 'emailadmin', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info['felamimail']['depends'][] = array( + 'appname' => 'egw-pear', + 'versions' => Array('1.8','1.9') +); +// installation checks for felamimail +$setup_info['felamimail']['check_install'] = array( + '' => array( + 'func' => 'pear_check', + ), +# get's provided by egw-pear temporarly + 'Net_Sieve' => array( + 'func' => 'pear_check', + ), + 'Net_IMAP' => array( + 'func' => 'pear_check', + ), + 'Auth_SASL' => array( + 'func' => 'pear_check', + ), + 'imap' => array( + 'func' => 'extension_check', + ), + 'magic_quotes_gpc' => array( + 'func' => 'php_ini_check', + 'value' => 0, + 'verbose_value' => 'Off', + ), +); diff --git a/felamimail/setup/tables_update.inc.php b/felamimail/setup/tables_update.inc.php new file mode 100644 index 0000000000..e1a04c5bab --- /dev/null +++ b/felamimail/setup/tables_update.inc.php @@ -0,0 +1,519 @@ +oProc->AddColumn('phpgw_felamimail_cache','to_name',array('type' => 'varchar', 'precision' => 120)); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_felamimail_cache','to_address',array('type' => 'varchar', 'precision' => 120)); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '0.8.3'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + +function felamimail_upgrade0_8_3() +{ + + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_felamimail_cache','attachments',array('type' => 'varchar', 'precision' => 120)); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '0.8.4'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + +function felamimail_upgrade0_8_4() +{ + $GLOBALS['setup_info']['felamimail']['currentver'] = '0.9.0'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + +function felamimail_upgrade0_9_0() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_felamimail_folderstatus', 'accountname', array('type' => 'varchar', 'precision' => 200, 'nullable' => false)); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_felamimail_cache', 'accountname', array('type' => 'varchar', 'precision' => 200, 'nullable' => false)); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '0.9.1'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + +function felamimail_upgrade0_9_1() +{ + $GLOBALS['setup_info']['felamimail']['currentver'] = '0.9.2'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + +function felamimail_upgrade0_9_2() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_felamimail_displayfilter', + Array( + 'fd' => array( + 'accountid' => array('type' => 'int', 'precision' => 4, 'nullable' => false), + 'filter' => array('type' => 'text') + ), + 'pk' => array('accountid'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + + ); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '0.9.3'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + +function felamimail_upgrade0_9_3() +{ + $GLOBALS['egw_setup']->oProc->DropTable('phpgw_felamimail_cache'); + $GLOBALS['egw_setup']->oProc->query('delete from phpgw_felamimail_folderstatus',__LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_felamimail_cache', + Array( + 'fd' => array( + 'accountid' => array('type' => 'int', 'precision' => 4, 'nullable' => false), + 'hostname' => array('type' => 'varchar', 'precision' => 60, 'nullable' => false), + 'accountname' => array('type' => 'varchar', 'precision' => 200, 'nullable' => false), + 'foldername' => array('type' => 'varchar', 'precision' => 200, 'nullable' => false), + 'uid' => array('type' => 'int', 'precision' => 4, 'nullable' => false), + 'subject' => array('type' => 'text'), + 'striped_subject'=> array('type' => 'text'), + 'sender_name' => array('type' => 'varchar', 'precision' => 120), + 'sender_address'=> array('type' => 'varchar', 'precision' => 120), + 'to_name' => array('type' => 'varchar', 'precision' => 120), + 'to_address' => array('type' => 'varchar', 'precision' => 120), + 'date' => array('type' => 'varchar', 'precision' => 120), + 'size' => array('type' => 'int', 'precision' => 4), + 'attachments' => array('type' => 'varchar', 'precision' =>120) + ), + 'pk' => array('accountid','hostname','accountname','foldername','uid'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '0.9.4'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + + +function felamimail_upgrade0_9_4() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_felamimail_cache','accountname',array( + 'type' => 'varchar', + 'precision' => '25', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_felamimail_cache','date',array( + 'type' => 'int', + 'precision' => '8' + )); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '0.9.5'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + + +function felamimail_upgrade0_9_5() +{ + $GLOBALS['setup_info']['felamimail']['currentver'] = '1.0.0'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + + +function felamimail_upgrade1_0_0() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','accountid','fmail_accountid'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','hostname','fmail_hostname'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','accountname','fmail_accountname'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','foldername','fmail_foldername'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','uid','fmail_uid'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','subject','fmail_subject'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','striped_subject','fmail_striped_subject'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','sender_name','fmail_sender_name'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','sender_address','fmail_sender_address'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','to_name','fmail_to_name'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','to_address','fmail_to_address'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','date','fmail_date'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','size','fmail_size'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_cache','attachments','fmail_attachments'); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '1.0.0.001'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + + +function felamimail_upgrade1_0_0_001() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_folderstatus','accountid','fmail_accountid'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_folderstatus','hostname','fmail_hostname'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_folderstatus','accountname','fmail_accountname'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_folderstatus','foldername','fmail_foldername'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_folderstatus','messages','fmail_messages'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_folderstatus','recent','fmail_recent'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_folderstatus','unseen','fmail_unseen'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_folderstatus','uidnext','fmail_uidnext'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_folderstatus','uidvalidity','fmail_uidvalidity'); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '1.0.0.002'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + + +function felamimail_upgrade1_0_0_002() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_displayfilter','accountid','fmail_filter_accountid'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_felamimail_displayfilter','filter','fmail_filter_data'); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '1.0.0.003'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + + +function felamimail_upgrade1_0_0_003() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_felamimail_cache', 'fmail_accountname', array('type' => 'varchar','precision' => '200','nullable' => False)); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '1.0.0.004'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + + +function felamimail_upgrade1_0_0_004() +{ + // index was to big for mysql with charset utf8 (max 1000byte = 333 utf8 chars) + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_felamimail_cache','fmail_accountname',array( + 'type' => 'varchar', + 'precision' => '128', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_felamimail_cache','fmail_foldername',array( + 'type' => 'varchar', + 'precision' => '128', + 'nullable' => False + )); + + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_felamimail_cache','egw_felamimail_cache'); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '1.0.0.005'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + + +function felamimail_upgrade1_0_0_005() +{ + // index was to big for mysql with charset utf8 (max 1000byte = 333 utf8 chars) + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_felamimail_folderstatus','fmail_accountname',array( + 'type' => 'varchar', + 'precision' => '128', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_felamimail_folderstatus','fmail_foldername',array( + 'type' => 'varchar', + 'precision' => '128', + 'nullable' => False + )); + + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_felamimail_folderstatus','egw_felamimail_folderstatus'); + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_felamimail_displayfilter','egw_felamimail_displayfilter'); + + $GLOBALS['setup_info']['felamimail']['currentver'] = '1.0.0.006'; + return $GLOBALS['setup_info']['felamimail']['currentver']; +} + + +function felamimail_upgrade1_0_0_006() +{ + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.2'; +} + + +function felamimail_upgrade1_2() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('fm_accounts',array( + 'fd' => array( + 'fm_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'fm_id' => array('type' => 'auto'), + 'fm_realname' => array('type' => 'varchar','precision' => '128'), + 'fm_organization' => array('type' => 'varchar','precision' => '128'), + 'fm_emailaddress' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'fm_ic_hostname' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'fm_ic_port' => array('type' => 'int','precision' => '4','nullable' => False), + 'fm_ic_username' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'fm_ic_password' => array('type' => 'varchar','precision' => '128'), + 'fm_ic_encryption' => array('type' => 'bool','nullable' => False), + 'fm_og_hostname' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'fm_og_port' => array('type' => 'int','precision' => '4','nullable' => False), + 'fm_og_smtpauth' => array('type' => 'bool','nullable' => False), + 'fm_og_username' => array('type' => 'varchar','precision' => '128'), + 'fm_og_password' => array('type' => 'varchar','precision' => '128') + ), + 'pk' => array('fm_id'), + 'fk' => array(), + 'ix' => array('fm_owner'), + 'uc' => array() + )); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.2.001'; +} + + +function felamimail_upgrade1_2_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('fm_accounts','fm_active',array( + 'type' => 'bool', + 'nullable' => False + )); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.2.002'; +} + + +function felamimail_upgrade1_2_002() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('fm_accounts','fm_validatecertificate',array( + 'type' => 'bool', + 'nullable' => False + )); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.2.003'; +} + + +function felamimail_upgrade1_2_003() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('fm_accounts','fm_validatecertificate','fm_ic_validatecertificate'); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.2.004'; +} + + +function felamimail_upgrade1_2_004() +{ + $GLOBALS['egw_setup']->oProc->query('delete from egw_felamimail_folderstatus',__LINE__,__FILE__); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.3.000'; +} + + +function felamimail_upgrade1_3_000() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_cache','fmail_sender_name',array( + 'type' => 'varchar', + 'precision' => '256' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_cache','fmail_sender_address',array( + 'type' => 'varchar', + 'precision' => '256' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_cache','fmail_to_name',array( + 'type' => 'varchar', + 'precision' => '256' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_cache','fmail_to_address',array( + 'type' => 'varchar', + 'precision' => '256' + )); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.3.001'; +} + + +function felamimail_upgrade1_3_001() +{ + $GLOBALS['egw_setup']->oProc->RenameTable('fm_accounts','egw_felamimail_accounts'); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.3.002'; +} + + +function felamimail_upgrade1_3_002() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('egw_felamimail_signatures',array( + 'fd' => array( + 'fm_signatureid' => array('type' => 'auto'), + 'fm_accountid' => array('type' => 'int','precision' => '11'), + 'fm_signature' => array('type' => 'text'), + 'fm_description' => array('type' => 'varchar','precision' => '255') + ), + 'pk' => array('fm_signatureid'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array(array('fm_signatureid','fm_accountid')) + )); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.3.003'; +} + + +function felamimail_upgrade1_3_003() +{ + #$GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_accounts','fm_ic_encryption',array( + # 'type' => 'int', + # 'precision' => '4', + # 'nullable' => False + #)); + + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_felamimail_accounts',array( + 'fd' => array( + 'fm_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'fm_id' => array('type' => 'auto'), + 'fm_realname' => array('type' => 'varchar','precision' => '128'), + 'fm_organization' => array('type' => 'varchar','precision' => '128'), + 'fm_emailaddress' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'fm_ic_hostname' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'fm_ic_port' => array('type' => 'int','precision' => '4','nullable' => False), + 'fm_ic_username' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'fm_ic_password' => array('type' => 'varchar','precision' => '128'), + 'fm_ic_encryption' => array('type' => 'int','precision' => '4'), + 'fm_og_hostname' => array('type' => 'varchar','precision' => '128','nullable' => False), + 'fm_og_port' => array('type' => 'int','precision' => '4','nullable' => False), + 'fm_og_smtpauth' => array('type' => 'bool','nullable' => False), + 'fm_og_username' => array('type' => 'varchar','precision' => '128'), + 'fm_og_password' => array('type' => 'varchar','precision' => '128'), + 'fm_active' => array('type' => 'bool','nullable' => False), + 'fm_ic_validatecertificate' => array('type' => 'bool','nullable' => False), + ), + 'pk' => array('fm_id'), + 'fk' => array(), + 'ix' => array('fm_owner'), + 'uc' => array() + ), array( + 'fm_ic_encryption' => "CASE WHEN fm_ic_encryption THEN 1 ELSE 0 END", + ) + ); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.3.004'; +} + + +function felamimail_upgrade1_3_004() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_signatures','fm_defaultsignature',array( + 'type' => 'bool' + )); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.3.005'; +} + + +function felamimail_upgrade1_3_005() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_accounts','fm_ic_enable_sieve',array( + 'type' => 'bool', + 'precision' => '255' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_accounts','fm_ic_sieve_server',array( + 'type' => 'varchar', + 'precision' => '128' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_accounts','fm_ic_sieve_port',array( + 'type' => 'int', + 'precision' => '4' + )); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.3.006'; +} + + +function felamimail_upgrade1_3_006() +{ + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.4'; +} + + +function felamimail_upgrade1_4() +{ + $GLOBALS['egw_setup']->oProc->DropTable('egw_felamimail_cache'); + $GLOBALS['egw_setup']->oProc->DropTable('egw_felamimail_displayfilter'); + $GLOBALS['egw_setup']->oProc->DropTable('egw_felamimail_folderstatus'); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_accounts','fm_signatureid',array( + 'type' => 'int', + 'precision' => '4' + )); + + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.5.001'; +} + + +function felamimail_upgrade1_5_001() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('egw_felamimail_displayfilter', + Array( + 'fd' => array( + 'fmail_filter_accountid' => array('type' => 'int', 'precision' => 4, 'nullable' => false), + 'fmail_filter_data' => array('type' => 'text') + ), + 'pk' => array('fmail_filter_accountid'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ) + ); + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.5.002'; +} + + +function felamimail_upgrade1_5_002() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_accounts','fm_ic_encryption',array( + 'type' => 'int', + 'precision' => '4', + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_accounts','fm_ic_hostname',array( + 'type' => 'varchar', + 'precision' => '128', + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_accounts','fm_ic_port',array( + 'type' => 'int', + 'precision' => '4', + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_accounts','fm_ic_username',array( + 'type' => 'varchar', + 'precision' => '128', + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_accounts','fm_ic_validatecertificate',array( + 'type' => 'bool', + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_accounts','fm_og_hostname',array( + 'type' => 'varchar', + 'precision' => '128', + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_accounts','fm_og_port',array( + 'type' => 'int', + 'precision' => '4', + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_felamimail_accounts','fm_og_smtpauth',array( + 'type' => 'bool', + )); + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.5.003'; +} + + +function felamimail_upgrade1_5_003() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_accounts','fm_ic_folderstoshowinhome', array('type' => 'text')); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_accounts','fm_ic_sentfolder', array('type' => 'varchar','precision' => '128')); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_accounts','fm_ic_trashfolder', array('type' => 'varchar','precision' => '128')); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_accounts','fm_ic_draftfolder', array('type' => 'varchar','precision' => '128')); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_felamimail_accounts','fm_ic_templatefolder', array('type' => 'varchar','precision' => '128')); + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.6.001'; +} + + +function felamimail_upgrade1_6_001() +{ + // no real changes here + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.7.001'; +} + + +function felamimail_upgrade1_7_001() +{ + return $GLOBALS['setup_info']['felamimail']['currentver'] = '1.8'; +} diff --git a/filemanager/setup/setup.inc.php b/filemanager/setup/setup.inc.php new file mode 100755 index 0000000000..22ec04704b --- /dev/null +++ b/filemanager/setup/setup.inc.php @@ -0,0 +1,37 @@ + 'Ralf Becker', + 'email' => 'ralfbecker@outdoor-training.de' +); +$setup_info['filemanager']['license'] = 'GPL'; + +/* The hooks this app includes, needed for hooks registration */ +$setup_info['filemanager']['hooks']['preferences'] = 'filemanager_hooks::preferences'; +$setup_info['filemanager']['hooks']['settings'] = 'filemanager_hooks::settings'; +$setup_info['filemanager']['hooks']['sidebox_menu'] = 'filemanager_hooks::sidebox_menu'; +#$setup_info['filemanager']['hooks']['verify_settings'] = 'filemanager.filemanager_hooks.verify_settings'; +$setup_info['filemanager']['hooks']['admin'] = 'filemanager_hooks::admin'; + + +/* Dependencies for this app to work */ +$setup_info['filemanager']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => array('1.7','1.8','1.9') +); diff --git a/home/setup/setup.inc.php b/home/setup/setup.inc.php new file mode 100755 index 0000000000..7b503f9a34 --- /dev/null +++ b/home/setup/setup.inc.php @@ -0,0 +1,34 @@ + 'eGroupWare Developers', + 'email' => 'egroupware-developers@lists.sourceforge.net' +); + +/* The hooks this app includes, needed for hooks registration */ +$setup_info['home']['hooks']['hasUpdates'] = 'home.updates.hasUpdates'; +$setup_info['home']['hooks']['showUpdates'] = 'home.updates.showUpdates'; + +/* Dependencies for this app to work */ +$setup_info['home']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); diff --git a/infolog/setup/setup.inc.php b/infolog/setup/setup.inc.php new file mode 100755 index 0000000000..bc5fa4f04d --- /dev/null +++ b/infolog/setup/setup.inc.php @@ -0,0 +1,72 @@ + + * @package infolog + * @subpackage setup + * @copyright (c) 2003-10 by Ralf Becker + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +$setup_info['infolog']['name'] = 'infolog'; +$setup_info['infolog']['version'] = '1.8'; +$setup_info['infolog']['app_order'] = 5; +$setup_info['infolog']['tables'] = array('egw_infolog','egw_infolog_extra'); +$setup_info['infolog']['enable'] = 1; + +$setup_info['infolog']['author'] = +$setup_info['infolog']['maintainer'] = array( + 'name' => 'Ralf Becker', + 'email' => 'ralfbecker@outdoor-training.de' +); +$setup_info['infolog']['license'] = 'GPL'; +$setup_info['infolog']['description'] = + '

CRM (customer-relation-management) type app using Addressbook providing + Todo List, Notes and Phonelog. InfoLog is orininaly based on eGroupWare\'s + old ToDo-List and has the features of all 3 mentioned applications plus fully working ACL + (including Add+Private attributes, add for to addreplys/subtasks).

+

Responsibility for a task (ToDo) or a phonecall can be delegated to an other + user. All entries can be linked to addressbook entries, projects and/or calendar events. + This allows you to log all activity of a contact/address or project. + The entries may be viewed or added from InfoLog direct or from within + the contact/address, project or calendar view.

+

Other documents / files can be linked to InfoLog entries and are store in the VFS + (eGroupWare\'s virtual file system).

'; +$setup_info['infolog']['note'] = + '

There is a CSV import filter (in the admin-section) to import existing data. + It allows to interactivly assign fields, customize the values with regular + expressions and direct calls to php-functions (e.g. to link the phone calls + (again) to the addressbook entrys).

+

More information about InfoLog and the current development-status can be found on the + InfoLog page on our Website.

'; + +/* The hooks this app includes, needed for hooks registration */ +$setup_info['infolog']['hooks']['preferences'] = 'infolog_hooks::all_hooks'; +$setup_info['infolog']['hooks']['settings'] = 'infolog_hooks::settings'; +$setup_info['infolog']['hooks']['verify_settings'] = 'infolog_hooks::verify_settings'; +$setup_info['infolog']['hooks']['admin'] = 'infolog_hooks::all_hooks'; +$setup_info['infolog']['hooks']['not_enum_group_acls'] = 'infolog_hooks::not_enum_group_acls'; +$setup_info['infolog']['hooks']['deleteaccount'] = 'infolog.infolog_so.change_delete_owner'; +$setup_info['infolog']['hooks'][] = 'home'; +$setup_info['infolog']['hooks']['addressbook_view'] = 'infolog.infolog_ui.hook_view'; +$setup_info['infolog']['hooks']['projects_view'] = 'infolog.infolog_ui.hook_view'; +$setup_info['infolog']['hooks']['calendar_view'] = 'infolog.infolog_ui.hook_view'; +$setup_info['infolog']['hooks']['infolog'] = 'infolog.infolog_ui.hook_view'; +$setup_info['infolog']['hooks']['calendar_include_events'] = 'infolog.infolog_bo.cal_to_include'; +$setup_info['infolog']['hooks']['calendar_include_todos'] = 'infolog.infolog_bo.cal_to_include'; +$setup_info['infolog']['hooks']['sidebox_menu'] = 'infolog_hooks::all_hooks'; +$setup_info['infolog']['hooks']['search_link'] = 'infolog_hooks::search_link'; +$setup_info['infolog']['hooks']['pm_custom_app_icons'] = 'infolog.infolog_bo.pm_icons'; + +/* Dependencies for this app to work */ +$setup_info['infolog']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info['infolog']['depends'][] = array( + 'appname' => 'etemplate', + 'versions' => Array('1.7','1.8','1.9') +); diff --git a/infolog/setup/tables_update.inc.php b/infolog/setup/tables_update.inc.php new file mode 100644 index 0000000000..9ae0ac29c6 --- /dev/null +++ b/infolog/setup/tables_update.inc.php @@ -0,0 +1,636 @@ + + * @package infolog + * @subpackage setup + * @copyright (c) 2003-10 by Ralf Becker + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +function infolog_upgrade0_9_11() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_datecreated','info_datemodified'); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_event_id',array( + 'type' => 'int', + 'precision' => '4', + 'default' => '0', + 'nullable' => False + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.001'; +} + + +function infolog_upgrade0_9_15_001() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_links',array( + 'fd' => array( + 'link_id' => array('type' => 'auto','nullable' => False), + 'link_app1' => array('type' => 'varchar','precision' => '25','nullable' => False), + 'link_id1' => array('type' => 'varchar','precision' => '50','nullable' => False), + 'link_app2' => array('type' => 'varchar','precision' => '25','nullable' => False), + 'link_id2' => array('type' => 'varchar','precision' => '50','nullable' => False), + 'link_remark' => array('type' => 'varchar','precision' => '50','nullable' => True), + 'link_lastmod' => array('type' => 'int','precision' => '4','nullable' => False), + 'link_owner' => array('type' => 'int','precision' => '4','nullable' => False) + ), + 'pk' => array('link_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.002'; +} + + +function infolog_upgrade0_9_15_002() +{ + //echo "

infolog_upgrade0_9_15_002

\n"; + $insert = 'INSERT INTO phpgw_links (link_app1,link_id1,link_app2,link_id2,link_remark,link_lastmod,link_owner) '; + $select = "SELECT 'infolog',info_id,'addressbook',info_addr_id,info_from,info_datemodified,info_owner FROM phpgw_infolog WHERE info_addr_id != 0"; + //echo "

copying address-links: $insert.$select

\n"; + $GLOBALS['egw_setup']->oProc->query($insert.$select); + $select = "SELECT 'infolog',info_id,'projects',info_proj_id,'',info_datemodified,info_owner FROM phpgw_infolog WHERE info_proj_id != 0"; + //echo "

copying projects-links: $insert.$select

\n"; + $GLOBALS['egw_setup']->oProc->query($insert.$select); + $select = "SELECT 'infolog',info_id,'calendar',info_event_id,'',info_datemodified,info_owner FROM phpgw_infolog WHERE info_event_id != 0"; + //echo "

copying calendar-links: $insert.$select

\n"; + $GLOBALS['egw_setup']->oProc->query($insert.$select); + + $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array( + 'fd' => array( + 'info_id' => array('type' => 'auto','nullable' => False), + 'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False), + 'info_proj_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True), + 'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True), + 'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True), + 'info_des' => array('type' => 'text','nullable' => True), + 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'), + 'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'), + 'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'), + 'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not'), + 'info_event_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False) + ), + 'pk' => array('info_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'info_addr_id'); + $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array( + 'fd' => array( + 'info_id' => array('type' => 'auto','nullable' => False), + 'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False), + 'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True), + 'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True), + 'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True), + 'info_des' => array('type' => 'text','nullable' => True), + 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'), + 'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'), + 'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'), + 'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not'), + 'info_event_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False) + ), + 'pk' => array('info_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'info_proj_id'); + $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array( + 'fd' => array( + 'info_id' => array('type' => 'auto','nullable' => False), + 'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False), + 'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True), + 'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True), + 'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True), + 'info_des' => array('type' => 'text','nullable' => True), + 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'), + 'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'), + 'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False), + 'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'), + 'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not') + ), + 'pk' => array('info_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'info_event_id'); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.003'; +} + + +function infolog_upgrade0_9_15_003() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_type',array( + 'type' => 'varchar', + 'precision' => '10', + 'nullable' => False, + 'default' => 'task' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_pri',array( + 'type' => 'varchar', + 'precision' => '10', + 'nullable' => True, + 'default' => 'normal' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_status',array( + 'type' => 'varchar', + 'precision' => '10', + 'nullable' => True, + 'default' => 'done' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_confirm',array( + 'type' => 'varchar', + 'precision' => '10', + 'nullable' => True, + 'default' => 'not' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_modifier',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False, + 'default' => '0' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_link_id',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False, + 'default' => '0' + )); + + // ORDER BY link_app2 DESC gives addressbook the highes precedens, use ASC for projects + $GLOBALS['egw_setup']->oProc->query("SELECT link_id,link_id1 FROM phpgw_links WHERE link_app1='infolog' ORDER BY link_app2 DESC"); + $links = array(); + while ($GLOBALS['egw_setup']->oProc->next_record()) + { + $links[$GLOBALS['egw_setup']->oProc->f(1)] = $GLOBALS['egw_setup']->oProc->f(0); + } + reset($links); + while (list($info_id,$link_id) = each($links)) + { + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_link_id=$link_id WHERE info_id=$info_id"); + } + + return $GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.004'; +} + + +function infolog_upgrade0_9_15_004() +{ + // this update correctes wrong escapes of ' and " in the past + // + $db2 = $GLOBALS['egw_setup']->db; // we need a 2. result-set + + $to_correct = array('info_from','info_subject','info_des'); + foreach ($to_correct as $col) + { + $GLOBALS['egw_setup']->oProc->query("SELECT info_id,$col FROM phpgw_infolog WHERE $col LIKE '%\\'%' OR $col LIKE '%\"%'"); + while ($GLOBALS['egw_setup']->oProc->next_record()) + { + $db2->query("UPDATE phpgw_infolog SET $col='".$db2->db_addslashes(stripslashes($GLOBALS['egw_setup']->oProc->f($col))). + "' WHERE info_id=".$GLOBALS['egw_setup']->oProc->f('info_id')); + } + } + + return $GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.005'; +} + + +function infolog_upgrade0_9_15_005() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_infolog_extra',array( + 'fd' => array( + 'info_id' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_extra_name' => array('type' => 'varchar','precision' => '32','nullable' => False), + 'info_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') + ), + 'pk' => array('info_id','info_extra_name'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.006'; +} + + +// the following series of updates add some indices, to speedup the selects +function infolog_upgrade0_9_15_006() +{ + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_links',array( + 'fd' => array( + 'link_id' => array('type' => 'auto','nullable' => False), + 'link_app1' => array('type' => 'varchar','precision' => '25','nullable' => False), + 'link_id1' => array('type' => 'varchar','precision' => '50','nullable' => False), + 'link_app2' => array('type' => 'varchar','precision' => '25','nullable' => False), + 'link_id2' => array('type' => 'varchar','precision' => '50','nullable' => False), + 'link_remark' => array('type' => 'varchar','precision' => '50'), + 'link_lastmod' => array('type' => 'int','precision' => '4','nullable' => False), + 'link_owner' => array('type' => 'int','precision' => '4','nullable' => False) + ), + 'pk' => array('link_id'), + 'fk' => array(), + 'ix' => array(array('link_app1','link_id1','link_lastmod'),array('link_app2','link_id2','link_lastmod')), + 'uc' => array() + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.007'; +} + + +function infolog_upgrade0_9_15_007() +{ + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_infolog',array( + 'fd' => array( + 'info_id' => array('type' => 'auto','nullable' => False), + 'info_type' => array('type' => 'varchar','precision' => '10','nullable' => False,'default' => 'task'), + 'info_from' => array('type' => 'varchar','precision' => '64'), + 'info_addr' => array('type' => 'varchar','precision' => '64'), + 'info_subject' => array('type' => 'varchar','precision' => '64'), + 'info_des' => array('type' => 'text'), + 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_responsible' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_access' => array('type' => 'varchar','precision' => '10','default' => 'public'), + 'info_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_startdate' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_enddate' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_pri' => array('type' => 'varchar','precision' => '10','default' => 'normal'), + 'info_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_bill_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_status' => array('type' => 'varchar','precision' => '10','default' => 'done'), + 'info_confirm' => array('type' => 'varchar','precision' => '10','default' => 'not'), + 'info_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0') + ), + 'pk' => array('info_id'), + 'fk' => array(), + 'ix' => array(array('info_owner','info_responsible','info_status','info_startdate'),array('info_id_parent','info_owner','info_responsible','info_status','info_startdate')), + 'uc' => array() + )); + + // we dont need to do update 0.9.15.008, as UpdateSequenze is called now by RefreshTable + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.0.0'; +} + + +function infolog_upgrade0_9_15_008() +{ + // update the sequenzes for refreshed tables (postgres only) + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_infolog','info_id'); + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_links','link_id'); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.0.0'; +} + + +function infolog_upgrade1_0_0() +{ + // longer columns to cope with multibyte charsets + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_type',array( + 'type' => 'varchar', + 'precision' => '40', + 'nullable' => False, + 'default' => 'task' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_from',array( + 'type' => 'varchar', + 'precision' => '255' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_addr',array( + 'type' => 'varchar', + 'precision' => '255' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_subject',array( + 'type' => 'varchar', + 'precision' => '255' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_status',array( + 'type' => 'varchar', + 'precision' => '40', + 'default' => 'done' + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.0.0.001'; +} + + +function infolog_upgrade1_0_0_001() +{ + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_time','info_planned_time'); + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_infolog','info_bill_cat','info_used_time'); + // timestamps have to be 8byte ints + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_datemodified',array( + 'type' => 'int', + 'precision' => '8', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_startdate',array( + 'type' => 'int', + 'precision' => '8', + 'nullable' => False, + 'default' => '0' + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_infolog','info_enddate',array( + 'type' => 'int', + 'precision' => '8', + 'nullable' => False, + 'default' => '0' + )); + + // setting numerical priority 3=urgent, 2=high, 1=normal, 0= + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_infolog','info_priority',array( + 'type' => 'int', + 'precision' => '2', + 'default' => '1' + )); + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_infolog SET info_priority=(CASE WHEN info_pri='urgent' THEN 3 WHEN info_pri='high' THEN 2 WHEN info_pri='low' THEN 0 ELSE 1 END)",__LINE__,__FILE__); + + $GLOBALS['egw_setup']->oProc->DropColumn('phpgw_infolog',array( + 'fd' => array( + 'info_id' => array('type' => 'auto','nullable' => False), + 'info_type' => array('type' => 'varchar','precision' => '40','nullable' => False,'default' => 'task'), + 'info_from' => array('type' => 'varchar','precision' => '255'), + 'info_addr' => array('type' => 'varchar','precision' => '255'), + 'info_subject' => array('type' => 'varchar','precision' => '255'), + 'info_des' => array('type' => 'text'), + 'info_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'info_responsible' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_access' => array('type' => 'varchar','precision' => '10','default' => 'public'), + 'info_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_datemodified' => array('type' => 'int','precision' => '8','nullable' => False), + 'info_startdate' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'info_enddate' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), + 'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_planned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_used_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_status' => array('type' => 'varchar','precision' => '40','default' => 'done'), + 'info_confirm' => array('type' => 'varchar','precision' => '10','default' => 'not'), + 'info_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), + 'info_priority' => array('type' => 'int','precision' => '2','default' => '1') + ), + 'pk' => array('info_id'), + 'fk' => array(), + 'ix' => array(array('info_owner','info_responsible','info_status','info_startdate'),array('info_id_parent','info_owner','info_responsible','info_status','info_startdate')), + 'uc' => array() + ),'info_pri'); + + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog','egw_infolog'); + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_infolog_extra','egw_infolog_extra'); + // only rename links table, if it has not been moved into the API and therefor been already renamed by the API update + if ($GLOBALS['egw_setup']->oProc->GetTableDefinition('phpgw_links')) + { + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_links','egw_links'); + } + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.0.1.001'; +} + + +function infolog_upgrade1_0_1_001() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog','info_responsible',array( + 'type' => 'varchar', + 'precision' => '255', + 'nullable' => False, + 'default' => '0' + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.0.1.002'; +} + + +function infolog_upgrade1_0_1_002() +{ + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2'; +} + + +function infolog_upgrade1_2() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','pl_id',array( + 'type' => 'int', + 'precision' => '4' + )); + + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_price',array( + 'type' => 'float', + 'precision' => '8' + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.001'; +} + + +function infolog_upgrade1_2_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_percent',array( + 'type' => 'int', + 'precision' => '2', + 'default' => '0' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_datecompleted',array( + 'type' => 'int', + 'precision' => '8' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_location',array( + 'type' => 'varchar', + 'precision' => '255' + )); + + // all not explicit named stati have the default percent 0 + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=10 WHERE info_status='ongoing'",__LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=50 WHERE info_status='will-call'",__LINE__,__FILE__); + + for($p = 0; $p <= 90; $p += 10) + { + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_percent=$p,info_status='".(!$p ? 'not-started' : 'ongoing'). + "' WHERE info_status = '$p%'",__LINE__,__FILE__); + } + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_datecompleted=info_datemodified,info_percent=100 WHERE info_status IN ('done','billed','100%')",__LINE__,__FILE__); + + // remove the percentages from the custom stati, if they exist + $config =& CreateObject('phpgwapi.config','infolog'); + $config->read_repository(); + if (is_array($config->config_data['status']['task'])) + { + $config->config_data['status']['task'] = array_diff($config->config_data['status']['task'], + array('0%','10%','20%','30%','40%','50%','60%','70%','80%','90%','100%')); + $config->save_repository(); + } + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.002'; +} + + +function infolog_upgrade1_2_002() +{ + // change the phone-status: call --> not-started, will-call --> ongoing to be able to sync them + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='not-started' WHERE info_status='call'",__LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_status='ongoing' WHERE info_status='will-call'",__LINE__,__FILE__); + + // remove the call and will-call from the custom stati, if they exist + $config =& CreateObject('phpgwapi.config','infolog'); + $config->read_repository(); + if (is_array($config->config_data['status']['phone'])) + { + unset($config->config_data['status']['phone']['call']); + unset($config->config_data['status']['phone']['will-call']); + + $config->save_repository(); + } + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.003'; +} + + +function infolog_upgrade1_2_003() +{ + // fix wrong info_responsible='' --> '0' + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_infolog SET info_responsible='0' WHERE info_responsible=''",__LINE__,__FILE__); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.004'; +} + + +function infolog_upgrade1_2_004() +{ + // column to save if from contains a custom text + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_custom_from',array( + 'type' => 'int', + 'precision' => '1', + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.3.001'; +} + + +function infolog_upgrade1_3_001() +{ + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.4'; +} + + +function infolog_upgrade1_4() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_uid',array( + 'type' => 'varchar', + 'precision' => '255' + )); + $GLOBALS['egw_setup']->db->query("SELECT config_value FROM egw_config WHERE config_app='phpgwapi' AND config_name='install_id'",__LINE__,__FILE__); + $install_id = $GLOBALS['egw_setup']->db->next_record() ? $GLOBALS['egw_setup']->db->f(0) : md5(time()); + $GLOBALS['egw_setup']->db->query('UPDATE egw_infolog SET info_uid='.$GLOBALS['egw_setup']->db->concat("'infolog-'",'info_id',"'-$install_id'"),__LINE__,__FILE__); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.5.001'; +} + + +/** + * Fix missing info_from values, caused by a (fixed) bug + * + * @return string version + */ +function infolog_upgrade1_5_001() +{ + foreach($GLOBALS['egw_setup']->db->select('egw_infolog','info_id,info_link_id,org_name,adr_one_locality,n_family,n_given',array( + 'info_from' => '', + 'info_link_id > 0', + ),__LINE__,__FILE__,false,'','infolog',0, + " JOIN egw_links ON info_link_id=link_id AND link_app2='addressbook'". + " JOIN egw_addressbook ON contact_id=link_id2") as $row) + { + $from = ($row['org_name'] ? $row['org_name'].', '.$row['adr_one_locality'].': ' : ''). + $row['n_family'].($row['n_given'] ? ', '.$row['n_given'] : ''); + $GLOBALS['egw_setup']->db->update('egw_infolog',array('info_from' => $from), + array('info_id' => $row['info_id']),__LINE__,__FILE__,'infolog'); + } + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.5.002'; +} + + +/** + * make customfield names varchar(64) and values text + * + * @return string version + */ +function infolog_upgrade1_5_002() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra','info_extra_name',array( + 'type' => 'varchar', + 'precision' => '64', + 'nullable' => False + )); + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_infolog_extra','info_extra_value',array( + 'type' => 'text', + 'nullable' => False + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.5.003'; +} + + +/** + * Add re-planned time column + * + * @return string version + */ +function infolog_upgrade1_5_003() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_replanned_time',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False, + 'default' => '0' + )); + + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.5.004'; +} + + +/** + * 1.6 release + * + * @return string + */ +function infolog_upgrade1_5_004() +{ + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.6'; +} + + +function infolog_upgrade1_6() +{ + return $GLOBALS['setup_info']['infolog']['currentver'] = '1.8'; +} diff --git a/notifications/setup/setup.inc.php b/notifications/setup/setup.inc.php new file mode 100644 index 0000000000..225e7c480b --- /dev/null +++ b/notifications/setup/setup.inc.php @@ -0,0 +1,51 @@ + + * @version $Id$ + */ + +if (!defined('NOTIFICATION_APP')) +{ + define('NOTIFICATION_APP','notifications'); +} + +$setup_info[NOTIFICATION_APP]['name'] = NOTIFICATION_APP; +$setup_info[NOTIFICATION_APP]['version'] = '1.8'; +$setup_info[NOTIFICATION_APP]['app_order'] = 1; +$setup_info[NOTIFICATION_APP]['tables'] = array('egw_notificationpopup'); +$setup_info[NOTIFICATION_APP]['enable'] = 2; + +$setup_info[NOTIFICATION_APP]['author'] = 'Cornelius Weiss'; +$setup_info[NOTIFICATION_APP]['maintainer'] = array( + 'name' => 'eGroupware coreteam', + 'email' => 'egroupware-developers@lists.sf.net' +); +$setup_info[NOTIFICATION_APP]['license'] = 'GPL'; +$setup_info[NOTIFICATION_APP]['description'] = +'Instant notification of users via various channels.'; + +/* The hooks this app includes, needed for hooks registration */ +$setup_info[NOTIFICATION_APP]['hooks'][] = 'after_navbar'; +$setup_info[NOTIFICATION_APP]['hooks'][] = 'preferences'; +$setup_info[NOTIFICATION_APP]['hooks'][] = 'settings'; +$setup_info[NOTIFICATION_APP]['hooks'][] = 'admin'; +//$setup_info[NOTIFICATION_APP]['hooks']['settings'] = NOTIFICATION_APP.'.ts_admin_prefs_sidebox_hooks.settings'; +//$setup_info[NOTIFICATION_APP]['hooks']['admin'] = NOTIFICATION_APP.'.ts_admin_prefs_sidebox_hooks.all_hooks'; +//$setup_info[NOTIFICATION_APP]['hooks']['sidebox_menu'] = NOTIFICATION_APP.'.ts_admin_prefs_sidebox_hooks.all_hooks'; +//$setup_info[NOTIFICATION_APP]['hooks']['search_link'] = NOTIFICATION_APP.'.bonotification.search_link'; + +/* Dependencies for this app to work */ +$setup_info[NOTIFICATION_APP]['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info[NOTIFICATION_APP]['depends'][] = array( + 'appname' => 'etemplate', + 'versions' => Array('1.7','1.8','1.9') +); + diff --git a/notifications/setup/tables_update.inc.php b/notifications/setup/tables_update.inc.php new file mode 100644 index 0000000000..b7671597d8 --- /dev/null +++ b/notifications/setup/tables_update.inc.php @@ -0,0 +1,40 @@ +oProc->AlterColumn('egw_notificationpopup','account_id',array( + 'type' => 'int', + 'precision' => '20', + 'nullable' => False + )); + + return $GLOBALS['setup_info']['notifications']['currentver'] = '0.6'; +} + + +function notifications_upgrade0_6() +{ + return $GLOBALS['setup_info']['notifications']['currentver'] = '1.4'; +} + + +function notifications_upgrade1_4() +{ + return $GLOBALS['setup_info']['notifications']['currentver'] = '1.6'; +} + + +function notifications_upgrade1_6() +{ + return $GLOBALS['setup_info']['notifications']['currentver'] = '1.8'; +} diff --git a/phpgwapi/setup/setup.inc.php b/phpgwapi/setup/setup.inc.php new file mode 100755 index 0000000000..802560ce2a --- /dev/null +++ b/phpgwapi/setup/setup.inc.php @@ -0,0 +1,79 @@ + 'eGroupWare coreteam', + 'email' => 'egroupware-developers@lists.sourceforge.net', +); + +/* The tables this app creates */ +$setup_info['phpgwapi']['tables'][] = 'egw_config'; +$setup_info['phpgwapi']['tables'][] = 'egw_applications'; +$setup_info['phpgwapi']['tables'][] = 'egw_acl'; +$setup_info['phpgwapi']['tables'][] = 'egw_accounts'; +$setup_info['phpgwapi']['tables'][] = 'egw_preferences'; +$setup_info['phpgwapi']['tables'][] = 'egw_sessions'; +$setup_info['phpgwapi']['tables'][] = 'egw_app_sessions'; +$setup_info['phpgwapi']['tables'][] = 'egw_access_log'; +$setup_info['phpgwapi']['tables'][] = 'egw_hooks'; +$setup_info['phpgwapi']['tables'][] = 'egw_languages'; +$setup_info['phpgwapi']['tables'][] = 'egw_lang'; +$setup_info['phpgwapi']['tables'][] = 'egw_nextid'; +$setup_info['phpgwapi']['tables'][] = 'egw_categories'; +$setup_info['phpgwapi']['tables'][] = 'egw_log'; +$setup_info['phpgwapi']['tables'][] = 'egw_log_msg'; +$setup_info['phpgwapi']['tables'][] = 'egw_interserv'; +$setup_info['phpgwapi']['tables'][] = 'egw_vfs'; +$setup_info['phpgwapi']['tables'][] = 'egw_history_log'; +$setup_info['phpgwapi']['tables'][] = 'egw_async'; +$setup_info['phpgwapi']['tables'][] = 'egw_api_content_history'; +$setup_info['phpgwapi']['tables'][] = 'egw_links'; +$setup_info['phpgwapi']['tables'][] = 'egw_addressbook'; +$setup_info['phpgwapi']['tables'][] = 'egw_addressbook_extra'; +$setup_info['phpgwapi']['tables'][] = 'egw_addressbook_lists'; +$setup_info['phpgwapi']['tables'][] = 'egw_addressbook2list'; +$setup_info['phpgwapi']['tables'][] = 'egw_sqlfs'; +$setup_info['phpgwapi']['tables'][] = 'egw_index_keywords'; +$setup_info['phpgwapi']['tables'][] = 'egw_index'; +$setup_info['phpgwapi']['tables'][] = 'egw_cat2entry'; +$setup_info['phpgwapi']['tables'][] = 'egw_locks'; +$setup_info['phpgwapi']['tables'][] = 'egw_sqlfs_props'; + +// hooks used by vfs_home_hooks to manage user- and group-directories for the new stream based VFS +$setup_info['phpgwapi']['hooks']['addaccount'] = 'phpgwapi.vfs_home_hooks.addAccount'; +$setup_info['phpgwapi']['hooks']['deleteaccount'] = 'phpgwapi.vfs_home_hooks.deleteAccount'; +$setup_info['phpgwapi']['hooks']['editaccount'] = 'phpgwapi.vfs_home_hooks.editAccount'; +$setup_info['phpgwapi']['hooks']['addgroup'] = 'phpgwapi.vfs_home_hooks.addGroup'; +$setup_info['phpgwapi']['hooks']['deletegroup'] = 'phpgwapi.vfs_home_hooks.deleteGroup'; +$setup_info['phpgwapi']['hooks']['editgroup'] = 'phpgwapi.vfs_home_hooks.editGroup'; + +/* CalDAV/CardDAV/GroupDAV app */ +$setup_info['groupdav']['name'] = 'groupdav'; +$setup_info['groupdav']['version'] = '1.8'; +$setup_info['groupdav']['enable'] = 2; +$setup_info['groupdav']['app_order'] = 1; +$setup_info['groupdav']['icon'] = 'groupdav'; +$setup_info['groupdav']['icon_app'] = 'phpgwapi'; +$setup_info['groupdav']['author'] = $setup_info['groupdav']['maintainer'] = array( + 'name' => 'Ralf Becker', + 'email' => 'RalfBecker@outdoor-training.de' +); +$setup_info['groupdav']['license'] = 'GPL'; + + diff --git a/phpgwapi/setup/tables_update.inc.php b/phpgwapi/setup/tables_update.inc.php new file mode 100644 index 0000000000..b61397c823 --- /dev/null +++ b/phpgwapi/setup/tables_update.inc.php @@ -0,0 +1,69 @@ + 1.8 + * + * @link http://www.egroupware.org + * @package api + * @subpackage setup + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +/* Include older eGroupWare update support */ +include('tables_update_0_9_9.inc.php'); +include('tables_update_0_9_10.inc.php'); +include('tables_update_0_9_12.inc.php'); +include('tables_update_0_9_14.inc.php'); +include('tables_update_1_0.inc.php'); +include('tables_update_1_2.inc.php'); +include('tables_update_1_4.inc.php'); + +/** + * Update from the stable 1.6 branch to the new devel branch 1.7.xxx + */ +function phpgwapi_upgrade1_6_001() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.7.001'; +} + +function phpgwapi_upgrade1_6_002() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.7.001'; +} + +function phpgwapi_upgrade1_6_003() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.7.001'; +} + +function phpgwapi_upgrade1_7_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_sqlfs','fs_link',array( + 'type' => 'varchar', + 'precision' => '255' + )); + // moving symlinks from fs_content to fs_link + $GLOBALS['egw_setup']->oProc->query("UPDATE egw_sqlfs SET fs_link=fs_content,fs_content=NULL WHERE fs_mime='application/x-symlink'",__LINE__,__FILE__); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.7.002'; +} + + +function phpgwapi_upgrade1_7_002() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_sqlfs','fs_mime',array( + 'type' => 'varchar', + 'precision' => '96', + 'nullable' => False + )); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.7.003'; +} + + +function phpgwapi_upgrade1_7_003() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.8.001'; +} diff --git a/phpgwapi/templates/default/images/logo.png b/phpgwapi/templates/default/images/logo.png new file mode 100644 index 0000000000..57646bd137 Binary files /dev/null and b/phpgwapi/templates/default/images/logo.png differ diff --git a/preferences/setup/setup.inc.php b/preferences/setup/setup.inc.php new file mode 100755 index 0000000000..499335a051 --- /dev/null +++ b/preferences/setup/setup.inc.php @@ -0,0 +1,30 @@ + 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); diff --git a/resources/setup/setup.inc.php b/resources/setup/setup.inc.php new file mode 100755 index 0000000000..c37c018071 --- /dev/null +++ b/resources/setup/setup.inc.php @@ -0,0 +1,46 @@ + + * @author Lukas Weiss + * @version $Id$ + */ + +$setup_info['resources']['name'] = 'resources'; +$setup_info['resources']['title'] = 'Resources'; +$setup_info['resources']['version'] = '1.8'; +$setup_info['resources']['app_order'] = 5; +$setup_info['resources']['tables'] = array('egw_resources','egw_resources_extra'); +$setup_info['resources']['enable'] = 1; +$setup_info['resources']['index'] = 'resources.ui_resources.index'; + +$setup_info['resources']['author'] = 'Cornelius Weiss'; +$setup_info['resources']['license'] = 'GPL'; +$setup_info['resources']['description'] = 'A resource management and booking system, which integrates into eGroupWare\'s calendar.'; +$setup_info['resources']['note'] = ''; +$setup_info['resources']['maintainer'] = array( + 'name' => 'eGroupware coreteam', + 'email' => 'egroupware-developers@lists.sf.net' +); + +$setup_info['resources']['hooks']['preferences'] = 'resources.resources_hooks.admin_prefs_sidebox'; +$setup_info['resources']['hooks']['admin'] = 'resources.resources_hooks.admin_prefs_sidebox'; +$setup_info['resources']['hooks']['sidebox_menu'] = 'resources.resources_hooks.admin_prefs_sidebox'; +$setup_info['resources']['hooks']['search_link'] = 'resources.resources_hooks.search_link'; +$setup_info['resources']['hooks']['calendar_resources'] = 'resources.resources_hooks.calendar_resources'; +// $setup_info['resources']['hooks'][] = 'home'; +// $setup_info['resources']['hooks'][] = 'settings'; + +$setup_info['resources']['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info['resources']['depends'][] = array( // cause eTemplates is not in the api yet + 'appname' => 'etemplate', + 'versions' => Array('1.7','1.8','1.9') +); diff --git a/resources/setup/tables_update.inc.php b/resources/setup/tables_update.inc.php new file mode 100755 index 0000000000..156547c1df --- /dev/null +++ b/resources/setup/tables_update.inc.php @@ -0,0 +1,320 @@ + + * @version $Id$ + */ + +function resources_upgrade0_0_1_008() +{ + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','picture_src',array( + 'type' => 'varchar', + 'precision' => '20' + )); + + $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.012'; + return $GLOBALS['setup_info']['resources']['currentver']; +} + + +function resources_upgrade0_0_1_012() +{ + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','picture_thumb',array( + 'type' => 'blob' + )); + + $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.013'; + return $GLOBALS['setup_info']['resources']['currentver']; +} + + +function resources_upgrade0_0_1_013() +{ + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( + 'fd' => array( + 'id' => array('type' => 'auto'), + 'name' => array('type' => 'varchar','precision' => '100'), + 'short_description' => array('type' => 'varchar','precision' => '100'), + 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), + 'quantity' => array('type' => 'int','precision' => '11'), + 'useable' => array('type' => 'int','precision' => '11'), + 'location' => array('type' => 'varchar','precision' => '100'), + 'bookable' => array('type' => 'varchar','precision' => '1'), + 'buyable' => array('type' => 'varchar','precision' => '1'), + 'prize' => array('type' => 'varchar','precision' => '200'), + 'long_description' => array('type' => 'longtext'), + 'accessories' => array('type' => 'varchar','precision' => '50'), + 'picture_src' => array('type' => 'varchar','precision' => '20'), + 'picture_thumb' => array('type' => 'blob') + ), + 'pk' => array('id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'picture'); + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( + 'fd' => array( + 'id' => array('type' => 'auto'), + 'name' => array('type' => 'varchar','precision' => '100'), + 'short_description' => array('type' => 'varchar','precision' => '100'), + 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), + 'quantity' => array('type' => 'int','precision' => '11'), + 'useable' => array('type' => 'int','precision' => '11'), + 'location' => array('type' => 'varchar','precision' => '100'), + 'bookable' => array('type' => 'varchar','precision' => '1'), + 'buyable' => array('type' => 'varchar','precision' => '1'), + 'prize' => array('type' => 'varchar','precision' => '200'), + 'long_description' => array('type' => 'longtext'), + 'accessories' => array('type' => 'varchar','precision' => '50'), + 'picture_src' => array('type' => 'varchar','precision' => '20') + ), + 'pk' => array('id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'picture_thumb'); + + $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.014'; + return $GLOBALS['setup_info']['resources']['currentver']; +} + + +function resources_upgrade0_0_1_014() +{ + $GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources','quantity',array( + 'type' => 'int', + 'precision' => '11', + 'default' => '1' + )); + $GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources','useable',array( + 'type' => 'int', + 'precision' => '11', + 'default' => '1' + )); + + $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.015'; + return $GLOBALS['setup_info']['resources']['currentver']; +} + + +function resources_upgrade0_0_1_015() +{ + $GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_resources','accessories',array( + 'type' => 'varchar', + 'precision' => '100' + )); + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','accessory_only',array( + 'type' => 'varchar', + 'precision' => '1', + 'default' => '0' + )); + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','relatives',array( + 'type' => 'varchar', + 'precision' => '100' + )); + + $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.016'; + return $GLOBALS['setup_info']['resources']['currentver']; +} + + +function resources_upgrade0_0_1_016() +{ + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( + 'fd' => array( + 'id' => array('type' => 'auto'), + 'name' => array('type' => 'varchar','precision' => '100'), + 'short_description' => array('type' => 'varchar','precision' => '100'), + 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), + 'quantity' => array('type' => 'int','precision' => '11','default' => '1'), + 'useable' => array('type' => 'int','precision' => '11','default' => '1'), + 'location' => array('type' => 'varchar','precision' => '100'), + 'bookable' => array('type' => 'varchar','precision' => '1'), + 'buyable' => array('type' => 'varchar','precision' => '1'), + 'prize' => array('type' => 'varchar','precision' => '200'), + 'long_description' => array('type' => 'longtext'), + 'accessories' => array('type' => 'varchar','precision' => '100'), + 'picture_src' => array('type' => 'varchar','precision' => '20'), + 'relatives' => array('type' => 'varchar','precision' => '100') + ), + 'pk' => array('id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'accessory_only'); + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( + 'fd' => array( + 'id' => array('type' => 'auto'), + 'name' => array('type' => 'varchar','precision' => '100'), + 'short_description' => array('type' => 'varchar','precision' => '100'), + 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), + 'quantity' => array('type' => 'int','precision' => '11','default' => '1'), + 'useable' => array('type' => 'int','precision' => '11','default' => '1'), + 'location' => array('type' => 'varchar','precision' => '100'), + 'bookable' => array('type' => 'varchar','precision' => '1'), + 'buyable' => array('type' => 'varchar','precision' => '1'), + 'prize' => array('type' => 'varchar','precision' => '200'), + 'long_description' => array('type' => 'longtext'), + 'accessories' => array('type' => 'varchar','precision' => '100'), + 'picture_src' => array('type' => 'varchar','precision' => '20') + ), + 'pk' => array('id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'relatives'); + $GLOBALS['phpgw_setup']->oProc->DropColumn('egw_resources',array( + 'fd' => array( + 'id' => array('type' => 'auto'), + 'name' => array('type' => 'varchar','precision' => '100'), + 'short_description' => array('type' => 'varchar','precision' => '100'), + 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), + 'quantity' => array('type' => 'int','precision' => '11','default' => '1'), + 'useable' => array('type' => 'int','precision' => '11','default' => '1'), + 'location' => array('type' => 'varchar','precision' => '100'), + 'bookable' => array('type' => 'varchar','precision' => '1'), + 'buyable' => array('type' => 'varchar','precision' => '1'), + 'prize' => array('type' => 'varchar','precision' => '200'), + 'long_description' => array('type' => 'longtext'), + 'picture_src' => array('type' => 'varchar','precision' => '20') + ), + 'pk' => array('id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + ),'accessories'); + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','accessory_of',array( + 'type' => 'int', + 'precision' => '11', + 'default' => '-1' + )); + $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.017'; + return $GLOBALS['setup_info']['resources']['currentver']; +} + + +function resources_upgrade0_0_1_017() +{ + $GLOBALS['phpgw_setup']->oProc->RenameColumn('egw_resources','id','res_id'); + $GLOBALS['phpgw_setup']->oProc->RefreshTable('egw_resources',array( + 'fd' => array( + 'res_id' => array('type' => 'auto'), + 'name' => array('type' => 'varchar','precision' => '100'), + 'short_description' => array('type' => 'varchar','precision' => '100'), + 'cat_id' => array('type' => 'int','precision' => '11','nullable' => False), + 'quantity' => array('type' => 'int','precision' => '11','default' => '1'), + 'useable' => array('type' => 'int','precision' => '11','default' => '1'), + 'location' => array('type' => 'varchar','precision' => '100'), + 'bookable' => array('type' => 'varchar','precision' => '1'), + 'buyable' => array('type' => 'varchar','precision' => '1'), + 'prize' => array('type' => 'varchar','precision' => '200'), + 'long_description' => array('type' => 'longtext'), + 'picture_src' => array('type' => 'varchar','precision' => '20'), + 'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1') + ), + 'pk' => array('res_id'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.018'; + return $GLOBALS['setup_info']['resources']['currentver']; +} + + +function resources_upgrade0_0_1_018() +{ + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','storage_info',array( + 'type' => 'varchar', + 'precision' => '200' + )); + + $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.019'; + return $GLOBALS['setup_info']['resources']['currentver']; +} + + +function resources_upgrade0_0_1_019() +{ + $GLOBALS['phpgw_setup']->oProc->AddColumn('egw_resources','inventory_number',array( + 'type' => 'varchar', + 'precision' => '20' + )); + + $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.020'; + return $GLOBALS['setup_info']['resources']['currentver']; +} + + +function resources_upgrade0_0_1_020() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('egw_resources_extra',array( + 'fd' => array( + 'extra_id' => array('type' => 'int','precision' => '4','nullable' => False), + 'extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False), + 'extra_owner' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '-1'), + 'extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') + ), + 'pk' => array('extra_id','extra_name','extra_owner'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + return $GLOBALS['setup_info']['resources']['currentver'] = '0.0.1.021'; +} + + +function resources_upgrade0_0_1_021() +{ + return $GLOBALS['setup_info']['resources']['currentver'] = '1.2'; +} + + +function resources_upgrade1_2() +{ + return $GLOBALS['setup_info']['resources']['currentver'] = '1.4'; +} + + +/** + * Move resource pictures into the regular attachmen dirs with name .picture.jpg + * + * @return string + */ +function resources_upgrade1_4() +{ + egw_vfs::$is_root = true; + egw_vfs::load_wrapper('sqlfs'); + if (egw_vfs::is_dir('/resources/pictures')) + { + egw_vfs::remove('/resources/pictures/thumbs'); // remove thumb dir incl. thumbnails + foreach(egw_vfs::find('sqlfs://default/resources/pictures',array('url' => true)) as $url) + { + if (is_numeric($id = basename($url,'.jpg'))) + { + if (!egw_vfs::is_dir($dir = "/apps/resources/$id")) + { + egw_vfs::mkdir($dir,0777,STREAM_MKDIR_RECURSIVE); + } + rename($url,'sqlfs://default'.$dir.'/.picture.jpg'); // we need to rename on the same wrapper! + } + } + egw_vfs::rmdir('/resources/pictures',0); + egw_vfs::rmdir('/resources',0); + } + return $GLOBALS['setup_info']['resources']['currentver'] = '1.6'; +} + + +function resources_upgrade1_6() +{ + return $GLOBALS['setup_info']['resources']['currentver'] = '1.8'; +} diff --git a/timesheet/setup/setup.inc.php b/timesheet/setup/setup.inc.php new file mode 100644 index 0000000000..861ad3b17b --- /dev/null +++ b/timesheet/setup/setup.inc.php @@ -0,0 +1,55 @@ + + * @package timesheet + * @subpackage setup + * @copyright (c) 2005-10 by Ralf Becker + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +if (!defined('TIMESHEET_APP')) +{ + define('TIMESHEET_APP','timesheet'); +} + +$setup_info[TIMESHEET_APP]['name'] = TIMESHEET_APP; +$setup_info[TIMESHEET_APP]['version'] = '1.8'; +$setup_info[TIMESHEET_APP]['app_order'] = 5; +$setup_info[TIMESHEET_APP]['tables'] = array('egw_timesheet','egw_timesheet_extra'); +$setup_info[TIMESHEET_APP]['enable'] = 1; + +$setup_info[TIMESHEET_APP]['author'] = +$setup_info[TIMESHEET_APP]['maintainer'] = array( + 'name' => 'Ralf Becker', + 'email' => 'RalfBecker@outdoor-training.de' +); +$setup_info[TIMESHEET_APP]['license'] = 'GPL'; +$setup_info[TIMESHEET_APP]['description'] = +'Tracking times and other activities for the Projectmanager.'; +$setup_info[TIMESHEET_APP]['note'] = +'The TimeSheet application is sponsored by:'; + +/* The hooks this app includes, needed for hooks registration */ +$setup_info[TIMESHEET_APP]['hooks']['preferences'] = 'timesheet_hooks::all_hooks'; +$setup_info[TIMESHEET_APP]['hooks']['settings'] = 'timesheet_hooks::settings'; +$setup_info[TIMESHEET_APP]['hooks']['admin'] = 'timesheet_hooks::all_hooks'; +$setup_info[TIMESHEET_APP]['hooks']['sidebox_menu'] = 'timesheet_hooks::all_hooks'; +$setup_info[TIMESHEET_APP]['hooks']['search_link'] = 'timesheet_hooks::search_link'; +$setup_info[TIMESHEET_APP]['hooks']['pm_cumulate'] = 'timesheet_hooks::cumulate'; + +/* Dependencies for this app to work */ +$setup_info[TIMESHEET_APP]['depends'][] = array( + 'appname' => 'phpgwapi', + 'versions' => Array('1.7','1.8','1.9') +); +$setup_info[TIMESHEET_APP]['depends'][] = array( + 'appname' => 'etemplate', + 'versions' => Array('1.7','1.8','1.9') +); diff --git a/timesheet/setup/tables_update.inc.php b/timesheet/setup/tables_update.inc.php new file mode 100644 index 0000000000..6e4b18b0b7 --- /dev/null +++ b/timesheet/setup/tables_update.inc.php @@ -0,0 +1,75 @@ + + * @package timesheet + * @subpackage setup + * @copyright (c) 2005-10 by Ralf Becker + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +function timesheet_upgrade0_1_001() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_timesheet','pl_id',array( + 'type' => 'int', + 'precision' => '4', + 'default' => '0' + )); + + return $GLOBALS['setup_info']['timesheet']['currentver'] = '0.2.001'; +} + + +function timesheet_upgrade0_2_001() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('egw_timesheet_extra',array( + 'fd' => array( + 'ts_id' => array('type' => 'int','precision' => '4','nullable' => False), + 'ts_extra_name' => array('type' => 'varchar','precision' => '32','nullable' => False), + 'ts_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') + ), + 'pk' => array('ts_id','ts_extra_name'), + 'fk' => array(), + 'ix' => array(), + 'uc' => array() + )); + + return $GLOBALS['setup_info']['timesheet']['currentver'] = '0.2.002'; +} + + +function timesheet_upgrade0_2_002() +{ + return $GLOBALS['setup_info']['timesheet']['currentver'] = '1.4'; +} + + +function timesheet_upgrade1_4() +{ + // delete empty cf's generated by 1.4 + $GLOBALS['egw_setup']->db->delete('egw_timesheet_extra',"ts_extra_value=''",__LINE__,__FILE__,'timesheet'); + + return $GLOBALS['setup_info']['timesheet']['currentver'] = '1.6'; +} + + +function timesheet_upgrade1_6() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_timesheet','ts_status',array( + 'type' => 'int', + 'precision' => '4' + )); + + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_timesheet','ts_status'); + + return $GLOBALS['setup_info']['timesheet']['currentver'] = '1.7.001'; +} + + +function timesheet_upgrade1_7_001() +{ + return $GLOBALS['setup_info']['timesheet']['currentver'] = '1.8'; +}