diff --git a/addressbook/setup/setup.inc.php b/addressbook/setup/setup.inc.php index a253f27a00..c4211bd87b 100755 --- a/addressbook/setup/setup.inc.php +++ b/addressbook/setup/setup.inc.php @@ -10,7 +10,7 @@ /* Basic information about this app */ $setup_info['addressbook']['name'] = 'addressbook'; $setup_info['addressbook']['title'] = 'Addressbook'; -$setup_info['addressbook']['version'] = '1.9.001'; +$setup_info['addressbook']['version'] = '14.1'; $setup_info['addressbook']['app_order'] = 4; $setup_info['addressbook']['enable'] = 1; $setup_info['addressbook']['index'] = 'addressbook.addressbook_ui.index&ajax=true'; @@ -52,11 +52,11 @@ $setup_info['addressbook']['hooks']['categories'] = 'addressbook_hooks::categori /* Dependencies for this app to work */ $setup_info['addressbook']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); $setup_info['addressbook']['depends'][] = array( 'appname' => 'etemplate', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); // installation checks for addresbook diff --git a/admin/setup/setup.inc.php b/admin/setup/setup.inc.php index 61ab4d5102..4b6a7117e9 100755 --- a/admin/setup/setup.inc.php +++ b/admin/setup/setup.inc.php @@ -10,7 +10,7 @@ */ $setup_info['admin']['name'] = 'admin'; -$setup_info['admin']['version'] = '1.9.001'; +$setup_info['admin']['version'] = '14.1'; $setup_info['admin']['app_order'] = 1; $setup_info['admin']['tables'] = array('egw_admin_queue','egw_admin_remote'); $setup_info['admin']['enable'] = 1; @@ -48,9 +48,9 @@ $setup_info['admin']['hooks']['addressbook_edit'] = 'admin.admin_account.address /* Dependencies for this app to work */ $setup_info['admin']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); $setup_info['admin']['depends'][] = array( 'appname' => 'etemplate', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); diff --git a/admin/setup/tables_update.inc.php b/admin/setup/tables_update.inc.php index 3274ebfec3..73da15de9c 100644 --- a/admin/setup/tables_update.inc.php +++ b/admin/setup/tables_update.inc.php @@ -101,3 +101,9 @@ function admin_upgrade1_8() { return $GLOBALS['setup_info']['admin']['currentver'] = '1.9.001'; } + + +function admin_upgrade1_9_001() +{ + return $GLOBALS['setup_info']['admin']['currentver'] = '14.1'; +} diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php index 7ca0721410..902b5f3017 100755 --- a/calendar/setup/setup.inc.php +++ b/calendar/setup/setup.inc.php @@ -10,7 +10,7 @@ */ $setup_info['calendar']['name'] = 'calendar'; -$setup_info['calendar']['version'] = '1.9.011'; +$setup_info['calendar']['version'] = '14.1'; $setup_info['calendar']['app_order'] = 3; $setup_info['calendar']['enable'] = 1; $setup_info['calendar']['index'] = 'calendar.calendar_uiviews.index'; @@ -51,11 +51,11 @@ $setup_info['calendar']['hooks']['categories'] = 'calendar_hooks::categories'; /* Dependencies for this app to work */ $setup_info['calendar']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); $setup_info['calendar']['depends'][] = array( 'appname' => 'etemplate', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); // installation checks for calendar diff --git a/calendar/setup/tables_update.inc.php b/calendar/setup/tables_update.inc.php index c54abfa81d..656c022dbf 100644 --- a/calendar/setup/tables_update.inc.php +++ b/calendar/setup/tables_update.inc.php @@ -2292,3 +2292,7 @@ function calendar_upgrade1_9_010() return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.011'; } +function calendar_upgrade1_9_011() +{ + return $GLOBALS['setup_info']['calendar']['currentver'] = '14.1'; +} diff --git a/etemplate/setup/setup.inc.php b/etemplate/setup/setup.inc.php index 1085341c25..21b58ccb9d 100644 --- a/etemplate/setup/setup.inc.php +++ b/etemplate/setup/setup.inc.php @@ -12,7 +12,7 @@ */ $setup_info['etemplate']['name'] = 'etemplate'; -$setup_info['etemplate']['version'] = '1.8'; +$setup_info['etemplate']['version'] = '14.1'; $setup_info['etemplate']['app_order'] = 60; // just behind the developers-tools $setup_info['etemplate']['tables'] = array('egw_etemplate'); $setup_info['etemplate']['enable'] = 1; @@ -39,5 +39,5 @@ $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') + 'versions' => Array('14.1') ); diff --git a/etemplate/setup/tables_update.inc.php b/etemplate/setup/tables_update.inc.php index c5ab8e1ae8..a88dca6f88 100644 --- a/etemplate/setup/tables_update.inc.php +++ b/etemplate/setup/tables_update.inc.php @@ -124,3 +124,9 @@ function etemplate_upgrade1_6() { return $GLOBALS['setup_info']['etemplate']['currentver'] = '1.8'; } + + +function etemplate_upgrade1_8() +{ + return $GLOBALS['setup_info']['etemplate']['currentver'] = '14.1'; +} diff --git a/filemanager/setup/setup.inc.php b/filemanager/setup/setup.inc.php index 20c77786dd..165c567ef2 100755 --- a/filemanager/setup/setup.inc.php +++ b/filemanager/setup/setup.inc.php @@ -10,7 +10,7 @@ $setup_info['filemanager']['name'] = 'filemanager'; $setup_info['filemanager']['title'] = 'Filemanager'; -$setup_info['filemanager']['version'] = '1.9.001'; +$setup_info['filemanager']['version'] = '14.1'; $setup_info['filemanager']['app_order'] = 6; $setup_info['filemanager']['enable'] = 1; $setup_info['filemanager']['index'] = 'filemanager.filemanager_ui.index&ajax=true'; @@ -33,5 +33,9 @@ $setup_info['filemanager']['hooks']['search_link'] = 'filemanager_hooks::search_ /* Dependencies for this app to work */ $setup_info['filemanager']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => array('1.7','1.8','1.9') + 'versions' => array('14.1') +); +$setup_info['filemanager']['depends'][] = array( + 'appname' => 'etemplate', + 'versions' => array('14.1') ); diff --git a/home/setup/setup.inc.php b/home/setup/setup.inc.php index 153a705d78..61414b364b 100755 --- a/home/setup/setup.inc.php +++ b/home/setup/setup.inc.php @@ -11,7 +11,7 @@ /* Basic information about this app */ $setup_info['home']['name'] = 'home'; $setup_info['home']['title'] = 'Home'; -$setup_info['home']['version'] = '1.9'; +$setup_info['home']['version'] = '14.1'; $setup_info['home']['app_order'] = 1; $setup_info['home']['enable'] = 1; $setup_info['home']['index'] = 'home.home_ui.index&ajax=true'; @@ -27,9 +27,9 @@ $setup_info['home']['maintainer'] = array( /* 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.9') + 'versions' => Array('14.1') ); diff --git a/importexport/setup/setup.inc.php b/importexport/setup/setup.inc.php index 20c7dee150..dbb11b42eb 100644 --- a/importexport/setup/setup.inc.php +++ b/importexport/setup/setup.inc.php @@ -10,7 +10,7 @@ */ $setup_info['importexport']['name'] = 'importexport'; -$setup_info['importexport']['version'] = '1.9.004'; +$setup_info['importexport']['version'] = '14.1'; $setup_info['importexport']['app_order'] = 2; $setup_info['importexport']['enable'] = 2; $setup_info['importexport']['tables'] = array('egw_importexport_definitions'); @@ -37,11 +37,11 @@ $setup_info['importexport']['hooks']['etemplate2_register_widgets'] = 'importexp /* Dependencies for this app to work */ $setup_info['importexport']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); $setup_info['importexport']['depends'][] = array( 'appname' => 'etemplate', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); // installation checks for importexport @@ -56,5 +56,3 @@ $setup_info['importexport']['check_install'] = array( 'func' => 'pear_check', ), ); - - diff --git a/importexport/setup/tables_update.inc.php b/importexport/setup/tables_update.inc.php index 55564a09f0..2bc6320dbe 100755 --- a/importexport/setup/tables_update.inc.php +++ b/importexport/setup/tables_update.inc.php @@ -122,3 +122,7 @@ function importexport_upgrade1_9_003() return $GLOBALS['setup_info']['importexport']['currentver'] = '1.9.004'; } +function importexport_upgrade1_9_004() +{ + return $GLOBALS['setup_info']['importexport']['currentver'] = '14.1'; +} diff --git a/infolog/setup/setup.inc.php b/infolog/setup/setup.inc.php index 66df517cbd..20156b41bb 100755 --- a/infolog/setup/setup.inc.php +++ b/infolog/setup/setup.inc.php @@ -12,7 +12,7 @@ */ $setup_info['infolog']['name'] = 'infolog'; -$setup_info['infolog']['version'] = '1.9.006'; +$setup_info['infolog']['version'] = '14.1'; $setup_info['infolog']['app_order'] = 5; $setup_info['infolog']['tables'] = array('egw_infolog','egw_infolog_extra'); $setup_info['infolog']['enable'] = 1; @@ -68,10 +68,10 @@ $setup_info['infolog']['hooks']['calendar_set'] = 'infolog.infolog_ui.calendar_s /* Dependencies for this app to work */ $setup_info['infolog']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); $setup_info['infolog']['depends'][] = array( 'appname' => 'etemplate', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); diff --git a/infolog/setup/tables_update.inc.php b/infolog/setup/tables_update.inc.php index 9d98584d6d..e10a21010c 100644 --- a/infolog/setup/tables_update.inc.php +++ b/infolog/setup/tables_update.inc.php @@ -736,3 +736,9 @@ function infolog_upgrade1_9_005() return $GLOBALS['setup_info']['infolog']['currentver'] = '1.9.006'; } + + +function infolog_upgrade1_9_006() +{ + return $GLOBALS['setup_info']['infolog']['currentver'] = '14.1'; +} diff --git a/mail/setup/setup.inc.php b/mail/setup/setup.inc.php index 408f36a854..cebc187d3b 100644 --- a/mail/setup/setup.inc.php +++ b/mail/setup/setup.inc.php @@ -13,7 +13,7 @@ $setup_info['mail']['name'] = 'mail'; $setup_info['mail']['title'] = 'mail'; -$setup_info['mail']['version'] = '1.9.001'; +$setup_info['mail']['version'] = '14.1'; $setup_info['mail']['app_order'] = 2; $setup_info['mail']['enable'] = 1; $setup_info['mail']['index'] = 'mail.mail_ui.index&ajax=true'; @@ -44,11 +44,15 @@ $setup_info['mail']['hooks'][] = 'home'; /* Dependencies for this app to work */ $setup_info['mail']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') +); +$setup_info['mail']['depends'][] = array( + 'appname' => 'etemplate', + 'versions' => Array('14.1') ); $setup_info['mail']['depends'][] = array( 'appname' => 'emailadmin', - 'versions' => Array('1.9') + 'versions' => Array('14.1') ); // installation checks for mail $setup_info['mail']['check_install'] = array( diff --git a/notifications/setup/setup.inc.php b/notifications/setup/setup.inc.php index 5860edccd1..0b6e9bb3c2 100644 --- a/notifications/setup/setup.inc.php +++ b/notifications/setup/setup.inc.php @@ -15,7 +15,7 @@ if (!defined('NOTIFICATION_APP')) } $setup_info[NOTIFICATION_APP]['name'] = NOTIFICATION_APP; -$setup_info[NOTIFICATION_APP]['version'] = '1.9.004'; +$setup_info[NOTIFICATION_APP]['version'] = '14.1'; $setup_info[NOTIFICATION_APP]['app_order'] = 1; $setup_info[NOTIFICATION_APP]['tables'] = array('egw_notificationpopup'); $setup_info[NOTIFICATION_APP]['enable'] = 2; @@ -38,10 +38,9 @@ $setup_info[NOTIFICATION_APP]['hooks']['deleteaccount'] = 'notifications.notific /* Dependencies for this app to work */ $setup_info[NOTIFICATION_APP]['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); $setup_info[NOTIFICATION_APP]['depends'][] = array( 'appname' => 'etemplate', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); - diff --git a/notifications/setup/tables_update.inc.php b/notifications/setup/tables_update.inc.php index 7cf8bbdbb2..387715dba3 100644 --- a/notifications/setup/tables_update.inc.php +++ b/notifications/setup/tables_update.inc.php @@ -101,3 +101,8 @@ function notifications_upgrade1_9_003() return $GLOBALS['setup_info']['notifications']['currentver'] = '1.9.004'; } + +function notifications_upgrade1_9_004() +{ + return $GLOBALS['setup_info']['notifications']['currentver'] = '14.1'; +} diff --git a/phpgwapi/setup/setup.inc.php b/phpgwapi/setup/setup.inc.php index ab235ef2ff..d64012a605 100755 --- a/phpgwapi/setup/setup.inc.php +++ b/phpgwapi/setup/setup.inc.php @@ -12,7 +12,7 @@ /* Basic information about this app */ $setup_info['phpgwapi']['name'] = 'phpgwapi'; $setup_info['phpgwapi']['title'] = 'EGroupware API'; -$setup_info['phpgwapi']['version'] = '1.9.021'; +$setup_info['phpgwapi']['version'] = '14.1'; $setup_info['phpgwapi']['versions']['current_header'] = '1.29'; $setup_info['phpgwapi']['enable'] = 3; $setup_info['phpgwapi']['app_order'] = 1; @@ -63,12 +63,12 @@ $setup_info['phpgwapi']['hooks']['editgroup'] = 'phpgwapi.vfs_home_hooks.editGr // egw-pear dependency for modified HTTP_WebDAV_Server $setup_info['phpgwapi']['depends'][] = array( 'appname' => 'egw-pear', - 'versions' => Array('1.8','1.9') + 'versions' => Array('1.9','14.1') ); /* CalDAV/CardDAV/GroupDAV app */ $setup_info['groupdav']['name'] = 'groupdav'; -$setup_info['groupdav']['version'] = '1.8'; +$setup_info['groupdav']['version'] = '14.1'; $setup_info['groupdav']['enable'] = 2; $setup_info['groupdav']['app_order'] = 1; $setup_info['groupdav']['icon'] = 'groupdav'; diff --git a/phpgwapi/setup/tables_current.inc.php b/phpgwapi/setup/tables_current.inc.php index 67238c12f5..130fde7aae 100644 --- a/phpgwapi/setup/tables_current.inc.php +++ b/phpgwapi/setup/tables_current.inc.php @@ -475,11 +475,12 @@ $phpgw_baseline = array( 'cf_needed' => array('type' => 'bool','default' => '0','comment' => 'field is required'), 'cf_private' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '2048','comment' => 'comma-separated account_id'), 'cf_modifier' => array('type' => 'int','meta' => 'account','precision' => '4','comment' => 'last modifier'), - 'cf_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'last modification time') + 'cf_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'last modification time'), + 'cf_tab' => array('type' => 'varchar','precision' => '64','comment' => 'tab customfield should be shown') ), 'pk' => array('cf_id'), 'fk' => array(), - 'ix' => array(array('cf_app', 'cf_order')), - 'uc' => array(array('cf_app', 'cf_name')) + 'ix' => array(array('cf_app','cf_order')), + 'uc' => array(array('cf_app','cf_name')) ) ); diff --git a/phpgwapi/setup/tables_update.inc.php b/phpgwapi/setup/tables_update.inc.php index 1cfcc4eee5..3edb852b15 100644 --- a/phpgwapi/setup/tables_update.inc.php +++ b/phpgwapi/setup/tables_update.inc.php @@ -2,7 +2,7 @@ /** * EGroupware - API Setup * - * Update scripts 1.8 --> 2.0 + * Update scripts from 14.1 onwards * * @link http://www.egroupware.org * @package api @@ -20,541 +20,4 @@ include('tables_update_1_0.inc.php'); include('tables_update_1_2.inc.php'); include('tables_update_1_4.inc.php'); include('tables_update_1_6.inc.php'); - -/** - * Update from the stable 1.8 branch to the new devel branch 1.9.xxx - */ -function phpgwapi_upgrade1_8_001() -{ - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.001'; -} -function phpgwapi_upgrade1_8_002() -{ - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.001'; -} -function phpgwapi_upgrade1_8_003() -{ - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.001'; -} -/** - * Combiupdate 1.8.004/5/6: includes Trunk updates 1.9.001-1.9.010+1.9.013 - * - * @return string - */ -function phpgwapi_upgrade1_8_004() -{ - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.8.005'; -} -function phpgwapi_upgrade1_8_005() -{ - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.8.006'; -} -function phpgwapi_upgrade1_8_006() -{ - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.8.007'; -} -function phpgwapi_upgrade1_8_007() -{ - // run the two not included updates - phpgwapi_upgrade1_9_010(); - phpgwapi_upgrade1_9_011(); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.013'; -} - -/** - * Add index to improve import of contacts using a custom field as primary key - * - * @return string - */ -function phpgwapi_upgrade1_9_001() -{ - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook_extra', - array('contact_name','contact_value(32)')); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.002'; -} - -function phpgwapi_upgrade1_9_002() -{ - /* done by RefreshTable() anyway - $GLOBALS['egw_setup']->oProc->AddColumn('egw_links','deleted',array( - 'type' => 'timestamp' - ));*/ - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_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' => '100'), - 'link_lastmod' => array('type' => 'int','precision' => '8','nullable' => False), - 'link_owner' => array('type' => 'int','precision' => '4','nullable' => False), - 'deleted' => array('type' => 'timestamp') - ), - 'pk' => array('link_id'), - 'fk' => array(), - 'ix' => array('deleted',array('link_app1','link_id1','link_lastmod'),array('link_app2','link_id2','link_lastmod')), - 'uc' => array() - )); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.003'; -} - - -function phpgwapi_upgrade1_9_003() -{ - $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook','adr_one_countrycode',array( - 'type' => 'varchar', - 'precision' => '2' - )); - $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook','adr_two_countrycode',array( - 'type' => 'varchar', - 'precision' => '2' - )); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.004'; -} - - -/** - * Update script to populate country codes - * - * Sets country code for any recognized country in any installed language, then clears the country name - * to avoid conflicts / confusion. - */ -function phpgwapi_upgrade1_9_004() -{ - // Get all installed translations for names - $country = new country(); - $country_query = 'SELECT DISTINCT message_id, content - FROM ' . translation::LANG_TABLE . ' - WHERE message_id IN ("' . implode('","', array_values($country->countries())) . '") - ORDER BY message_id'; - $result = $GLOBALS['egw_setup']->oProc->query($country_query, __LINE__, __FILE__); - - $country_list = array(); - $current_name = null; - $id = null; - foreach($result as $row) { - if($row['message_id'] != $current_name) { - $current_name = $row['message_id']; - $id = array_search(strtoupper($current_name), $country->countries()); - if(!$id) continue; - } - $country_list[$id][] = $row['content']; - } - - // Build conversion - $case = 'CASE UPPER(adr_%1$s_countryname)'; - foreach($country_list as $key => $names) { - foreach($names as $name) { - $case .= "\n" . "WHEN UPPER(\"$name\") THEN '$key'"; - } - } - $case .= ' END'; - - $sql = 'UPDATE egw_addressbook SET '; - $sql .= "adr_one_countrycode = (" . sprintf($case, 'one') . '),'; - $sql .= "adr_two_countrycode = (" . sprintf($case, 'two') . ')'; - - // Change names (if there are changes, gives sql error otherwise!) - if ($country_list) $GLOBALS['egw_setup']->oProc->query($sql,__LINE__,__FILE__); - - // Clear text names - $GLOBALS['egw_setup']->oProc->query('UPDATE egw_addressbook SET adr_one_countryname = NULL WHERE adr_one_countrycode IS NOT NULL',__LINE__,__FILE__); - $GLOBALS['egw_setup']->oProc->query('UPDATE egw_addressbook SET adr_two_countryname = NULL WHERE adr_two_countrycode IS NOT NULL',__LINE__,__FILE__); - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.005'; -} - - -/** - * Add index to li (login time) column to speed up maintenance (periodic delete of old rows) - * - * Delete some obsolete / since a long time not used tables: - * - egw_vfs (replaced by egw_sqlfs in 1.6) - * - egw_(app_)sessions (not used since 1.4) - */ -function phpgwapi_upgrade1_9_005() -{ - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_access_log','li'); - - $GLOBALS['egw_setup']->oProc->DropTable('egw_app_sessions'); - $GLOBALS['egw_setup']->oProc->DropTable('egw_sessions'); - $GLOBALS['egw_setup']->oProc->DropTable('egw_vfs'); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.006'; -} - -/** - * Add column to store CalDAV name given by client - */ -function phpgwapi_upgrade1_9_006() -{ - $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook','carddav_name',array( - 'type' => 'varchar', - 'precision' => '64', - 'comment' => 'name part of CardDAV URL, if specified by client' - )); - $GLOBALS['egw_setup']->db->query($sql='UPDATE egw_addressbook SET carddav_name='. - $GLOBALS['egw_setup']->db->concat( - $GLOBALS['egw_setup']->db->to_varchar('contact_id'),"'.vcf'"),__LINE__,__FILE__); - - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook','carddav_name'); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.007'; -} - -/** - * Add columns for session list (dla, action), make sessionid primary key and TS 64bit - */ -function phpgwapi_upgrade1_9_007() -{ - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_access_log',array( - 'fd' => array( - 'sessionid' => array('type' => 'auto','nullable' => False,'comment' => 'primary key'), - 'loginid' => array('type' => 'varchar','precision' => '64','nullable' => False,'comment' => 'username used to login'), - 'ip' => array('type' => 'varchar','precision' => '40','nullable' => False,'comment' => 'ip of user'), - 'li' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'TS if login'), - 'lo' => array('type' => 'int','precision' => '8','comment' => 'TD of logout'), - 'account_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'numerical account id'), - 'session_dla' => array('type' => 'int','precision' => '8','comment' => 'TS of last user action'), - 'session_action' => array('type' => 'varchar','precision' => '64','comment' => 'menuaction or path of last user action'), - 'session_php' => array('type' => 'char','precision' => '64','nullable' => False,'comment' => 'php session-id or error-message'), - 'notification_heartbeat' => array('type' => 'int','precision' => '8','comment' => 'TS of last notification request') - ), - 'pk' => array('sessionid'), - 'fk' => array(), - 'ix' => array('li','lo','session_dla','notification_heartbeat'), - 'uc' => array() - ),array( - 'session_php' => 'sessionid', - 'sessionid' => 'NULL', // to NOT copy old sessionid, but create a new sequence - )); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.008'; -} - -/** - * Alter column cat_owner to varchar(255) to support multiple owners/groups per cat - */ -function phpgwapi_upgrade1_9_008() -{ - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_categories','cat_owner',array( - 'type' => 'varchar', - 'precision' => '255', - 'nullable' => False, - 'default' => '0' - )); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.009'; -} - -/** - * Alter column account_pwd to varchar(128) to allow to store sha256_crypt hashes - * - * Enable password migration to new default "securest available", if current hash is the default (sql: md5, ldap: des) - * or the 1.9.009 migration to ssha is running - */ -function phpgwapi_upgrade1_9_009() -{ - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_accounts','account_pwd',array( - 'type' => 'varchar', - 'precision' => '128', - 'nullable' => False - )); - - // query password hashing from database - $config = array( - 'auth_type' => 'sql', - 'account_repository' => null, // default is auth_type - 'sql_encryption_type' => 'md5', - 'ldap_encryption_type' => 'des', - 'pwd_migration_allowed' => null, // default off - 'pwd_migration_types' => null, - ); - foreach($GLOBALS['egw_setup']->db->select('egw_config','config_name,config_value',array( - 'config_app' => 'phpgwapi', - 'config_name' => array_keys($config), - ),__LINE__,__FILE__) as $row) - { - $config[$row['config_name']] = $row['config_value']; - } - if (!isset($config['account_repository'])) $config['account_repository'] = $config['auth_type']; - - // changing pw hashing only, if we auth agains our own account repository and no migration already active - if ($config['auth_type'] == $config['account_repository'] && - (!$config['pwd_migration_allowed'] || $config['pwd_migration_types'] == 'md5,crypt')) // 1.9.009 migration to ssha - { - require_once EGW_SERVER_ROOT.'/setup/inc/hook_config.inc.php'; // for sql_passwdhashes to get securest available password hash - $securest = null; - sql_passwdhashes(array(), true, $securest); - // OpenLDAP has no own support for extended crypt like sha512_crypt, but relys the OS crypt implementation, - // do NOT automatically migrate to anything above SSHA for OS other then Linux (Darwin can not auth anymore!) - if ($config['auth_type'] == 'sql' && in_array($config['sql_encryption_type'], array('md5','ssha')) || - $config['auth_type'] == 'ldap'&& in_array($config['ldap_encryption_type'], array('des','ssha')) && - (PHP_OS == 'Linux' || $securest == 'ssha')) - { - $config['pwd_migration_types'] = 'md5,crypt'; // des is called crypt in hash - if ($config['pwd_migration_allowed'] && $securest != 'ssha') $config['pwd_migration_types'] .= ',ssha'; - $config['sql_encryption_type'] = $config['ldap_encryption_type'] = $securest; - $config['pwd_migration_allowed'] = 'True'; - echo "
Enabling password migration to $securest
\n"; - } - foreach($config as $name => $value) - { - $GLOBALS['egw_setup']->db->insert('egw_config',array( - 'config_value' => $value, - ),array( - 'config_app' => 'phpgwapi', - 'config_name' => $name, - ),__LINE__,__FILE__); - } - } - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.010'; -} - -/** - * Create template directory and set default document_dir preference of addressbook, calendar, infolog, tracker, timesheet and projectmanager - */ -function phpgwapi_upgrade1_9_010() -{ - $admins = $GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False); - - egw_vfs::$is_root = true; - $prefs = new preferences(); - $prefs->read_repository(false); - foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager') as $app) - { - if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue; - - // create directory and set permissions: Admins writable and other readable - $dir = '/templates'.($app ? '/'.$app : ''); - egw_vfs::mkdir($dir, 075, STREAM_MKDIR_RECURSIVE); - egw_vfs::chgrp($dir, abs($admins)); - egw_vfs::chmod($dir, 075); - if (!$app) continue; - - // set default preference for app (preserving a maybe already set document-directory) - if ($prefs->default[$app]['document_dir']) $dir .= ' '.$prefs->default[$app]['document_dir']; - $prefs->add($app, 'document_dir', $dir, 'default'); - } - $prefs->save_repository(false, 'default'); - egw_vfs::$is_root = false; - - // check if categories are already updated to global == cat_owner=0 - // has to run as API update, before apps (tracker) creates new global cats with cat_owner=0 stopping the update - categories::invalidate_cache(); - categories::init_cache(); // updates the cats - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.011'; -} - -/** - * Language: French --> Français - */ -function phpgwapi_upgrade1_9_011() -{ - $GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->languages_table,array('lang_name' => 'Français'),array('lang_id' => 'fr'),__LINE__,__FILE__); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.012'; -} - -/** - * Add index for contact_modified to improve performance of ctag generation on big installtions - */ -function phpgwapi_upgrade1_9_012() -{ - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook','contact_modified'); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.013'; -} - -/** - * Adding neccessary information to return list to (Apple) CardDAV clients as "Group" - */ -function phpgwapi_upgrade1_9_013() -{ - $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_uid',array( - 'type' => 'varchar', - 'precision' => '255' - )); - $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_carddav_name',array( - 'type' => 'varchar', - 'precision' => '64' - )); - $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_etag',array( - 'type' => 'int', - 'precision' => '4', - 'nullable' => False, - 'default' => '0' - )); - $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_modified',array( - 'type' => 'timestamp', - 'nullable' => False, - 'default' => 'current_timestamp' - )); - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook_lists','list_modified'); - $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_modifier',array( - 'type' => 'int', - 'precision' => '4' - )); - $install_id = $GLOBALS['egw_setup']->db->select('egw_config','config_value',array( - 'config_app' => 'phpgwapi', - 'config_name' => 'install_id', - ),__LINE__,__FILE__)->fetchColumn(); - // setting values for existing lists - $GLOBALS['egw_setup']->db->query('UPDATE egw_addressbook_lists SET '. - 'list_uid='.$GLOBALS['egw_setup']->db->concat("'addressbook-lists-'",'list_id',"'-$install_id'"). - ',list_carddav_name='.$GLOBALS['egw_setup']->db->concat("'addressbook-lists-'",'list_id',"'-$install_id.vcf'"), - __LINE__,__FILE__); - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook_lists','list_uid',true); - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook_lists','list_carddav_name',true); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.014'; -} - - -function phpgwapi_upgrade1_9_014() -{ - $GLOBALS['egw_setup']->oProc->AddColumn('egw_access_log','user_agent',array( - 'type' => 'varchar', - 'precision' => '255', - 'comment' => 'User-agent of browser/device' - )); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.015'; -} - - -function phpgwapi_upgrade1_9_015() -{ - $GLOBALS['egw_setup']->oProc->AddColumn('egw_history_log','sessionid',array( - 'type' => 'int', - 'precision' => '4', - 'comment' => 'primary key to egw_access_log' - )); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.016'; -} - - -/** - * Some index to speed up access/update of huge access-logs - * - * ALTER TABLE `egw_access_log` ADD INDEX `egw_access_log_session_php` ( `session_php` ) - * ALTER TABLE `egw_access_log` ADD INDEX `egw_access_log_account_id_ip_li` ( `account_id` , `ip` , `li` ) - * ALTER TABLE `egw_access_log` ADD INDEX `egw_access_log_account_id_loginid_li` ( `account_id` , `loginid` , `li` ) - */ -function phpgwapi_upgrade1_9_016() -{ - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_access_log','session_php'); - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_access_log',array('account_id','ip','li')); - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_access_log',array('account_id','loginid','li')); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.017'; -} - - -/** - * Some index to speed up access/update of huge history-logs - * - * ALTER TABLE `egw_history_log` ADD INDEX `egw_history_log_appname_record_id_id` (`history_appname`, `history_record_id`, `history_id`) - * DROP INDEX `egw_history_log_appname_record_id_status_timestamp` ON `egw_history_log` - */ -function phpgwapi_upgrade1_9_017() -{ - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_history_log', array('history_appname','history_record_id','history_id')); - $GLOBALS['egw_setup']->oProc->DropIndex('egw_history_log', array('history_appname','history_record_id','history_status','history_timestamp')); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.018'; -} - - -function phpgwapi_upgrade1_9_018() -{ - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_addressbook','carddav_name',array( - 'type' => 'varchar', - 'precision' => '200', - 'comment' => 'name part of CardDAV URL, if specified by client' - )); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.019'; -} - - -function phpgwapi_upgrade1_9_019() -{ - $GLOBALS['egw_setup']->oProc->DropTable('egw_interserv'); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.020'; -} - -/** - * Create own table for custom-fields and migrate values over from egw_config - * - * @return string - */ -function phpgwapi_upgrade1_9_020() -{ - $GLOBALS['egw_setup']->oProc->CreateTable('egw_customfields',array( - 'fd' => array( - 'cf_id' => array('type' => 'auto','nullable' => False), - 'cf_app' => array('type' => 'varchar','precision' => '50','nullable' => False,'comment' => 'app-name cf belongs too'), - 'cf_name' => array('type' => 'varchar','precision' => '128','nullable' => False,'comment' => 'internal name'), - 'cf_label' => array('type' => 'varchar','precision' => '128','comment' => 'label to display'), - 'cf_type' => array('type' => 'varchar','precision' => '64','nullable' => False,'default' => 'text','comment' => 'type of field'), - 'cf_type2' => array('type' => 'varchar','precision' => '2048','comment' => 'comma-separated subtypes of app, cf is valid for'), - 'cf_help' => array('type' => 'varchar','precision' => '256','comment' => 'helptext'), - 'cf_values' => array('type' => 'varchar','precision' => '8096','comment' => 'json object with value label pairs'), - 'cf_len' => array('type' => 'int','precision' => '2','comment' => 'length or columns of field'), - 'cf_rows' => array('type' => 'int','precision' => '2','comment' => 'rows of field'), - 'cf_order' => array('type' => 'int','precision' => '2','comment' => 'order to display fields'), - 'cf_needed' => array('type' => 'bool','default' => '0','comment' => 'field is required'), - 'cf_private' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '2048','comment' => 'comma-separated account_id'), - 'cf_modifier' => array('type' => 'int','meta' => 'account','precision' => '4','comment' => 'last modifier'), - 'cf_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'last modification time') - ), - 'pk' => array('cf_id'), - 'fk' => array(), - 'ix' => array(array('cf_app', 'cf_order')), - 'uc' => array(array('cf_app', 'cf_name')) - )); - - foreach($GLOBALS['egw_setup']->db->select('egw_config', '*', "config_name='customfields'", __LINE__, __FILE__) as $row) - { - $cfs = $row['config_value'][1] == ':' ? unserialize($row['config_value']) : json_decode($row['config_value']); - foreach($cfs as $name => $cf) - { - $data = array( - 'cf_name' => $name, - 'cf_app' => $row['config_app'], - ); - foreach($cf as $attr => $val) - { - switch($attr) - { - case 'private': - case 'type2': - $val = $val ? (is_array($val) ? implode(',', $val) : $val) : null; - break; - case 'values': - $val = $val && is_array($val) ? json_encode($val) : null; - break; - case 'len': - case 'rows': - $val = (string)$val !== '' ? $val : null; - break; - } - $data['cf_'.$attr] = $val; - } - $GLOBALS['egw_setup']->db->insert('egw_customfields', $data, false, __LINE__, __FILE__); - } - } - $GLOBALS['egw_setup']->db->delete('egw_config', "config_name='customfields'", __LINE__, __FILE__); - - return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.021'; -} - +include('tables_update_1_8.inc.php'); diff --git a/phpgwapi/setup/tables_update_1_8.inc.php b/phpgwapi/setup/tables_update_1_8.inc.php new file mode 100644 index 0000000000..ace42096fa --- /dev/null +++ b/phpgwapi/setup/tables_update_1_8.inc.php @@ -0,0 +1,561 @@ + 14.1 + * + * @link http://www.egroupware.org + * @package api + * @subpackage setup + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ + +/** + * Update from the stable 1.8 branch to the new devel branch 1.9.xxx + */ +function phpgwapi_upgrade1_8_001() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.001'; +} +function phpgwapi_upgrade1_8_002() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.001'; +} +function phpgwapi_upgrade1_8_003() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.001'; +} +/** + * Combiupdate 1.8.004/5/6: includes Trunk updates 1.9.001-1.9.010+1.9.013 + * + * @return string + */ +function phpgwapi_upgrade1_8_004() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.8.005'; +} +function phpgwapi_upgrade1_8_005() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.8.006'; +} +function phpgwapi_upgrade1_8_006() +{ + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.8.007'; +} +function phpgwapi_upgrade1_8_007() +{ + // run the two not included updates + phpgwapi_upgrade1_9_010(); + phpgwapi_upgrade1_9_011(); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.013'; +} + +/** + * Add index to improve import of contacts using a custom field as primary key + * + * @return string + */ +function phpgwapi_upgrade1_9_001() +{ + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook_extra', + array('contact_name','contact_value(32)')); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.002'; +} + +function phpgwapi_upgrade1_9_002() +{ + /* done by RefreshTable() anyway + $GLOBALS['egw_setup']->oProc->AddColumn('egw_links','deleted',array( + 'type' => 'timestamp' + ));*/ + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_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' => '100'), + 'link_lastmod' => array('type' => 'int','precision' => '8','nullable' => False), + 'link_owner' => array('type' => 'int','precision' => '4','nullable' => False), + 'deleted' => array('type' => 'timestamp') + ), + 'pk' => array('link_id'), + 'fk' => array(), + 'ix' => array('deleted',array('link_app1','link_id1','link_lastmod'),array('link_app2','link_id2','link_lastmod')), + 'uc' => array() + )); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.003'; +} + + +function phpgwapi_upgrade1_9_003() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook','adr_one_countrycode',array( + 'type' => 'varchar', + 'precision' => '2' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook','adr_two_countrycode',array( + 'type' => 'varchar', + 'precision' => '2' + )); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.004'; +} + + +/** + * Update script to populate country codes + * + * Sets country code for any recognized country in any installed language, then clears the country name + * to avoid conflicts / confusion. + */ +function phpgwapi_upgrade1_9_004() +{ + // Get all installed translations for names + $country = new country(); + $country_query = 'SELECT DISTINCT message_id, content + FROM ' . translation::LANG_TABLE . ' + WHERE message_id IN ("' . implode('","', array_values($country->countries())) . '") + ORDER BY message_id'; + $result = $GLOBALS['egw_setup']->oProc->query($country_query, __LINE__, __FILE__); + + $country_list = array(); + $current_name = null; + $id = null; + foreach($result as $row) { + if($row['message_id'] != $current_name) { + $current_name = $row['message_id']; + $id = array_search(strtoupper($current_name), $country->countries()); + if(!$id) continue; + } + $country_list[$id][] = $row['content']; + } + + // Build conversion + $case = 'CASE UPPER(adr_%1$s_countryname)'; + foreach($country_list as $key => $names) { + foreach($names as $name) { + $case .= "\n" . "WHEN UPPER(\"$name\") THEN '$key'"; + } + } + $case .= ' END'; + + $sql = 'UPDATE egw_addressbook SET '; + $sql .= "adr_one_countrycode = (" . sprintf($case, 'one') . '),'; + $sql .= "adr_two_countrycode = (" . sprintf($case, 'two') . ')'; + + // Change names (if there are changes, gives sql error otherwise!) + if ($country_list) $GLOBALS['egw_setup']->oProc->query($sql,__LINE__,__FILE__); + + // Clear text names + $GLOBALS['egw_setup']->oProc->query('UPDATE egw_addressbook SET adr_one_countryname = NULL WHERE adr_one_countrycode IS NOT NULL',__LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->query('UPDATE egw_addressbook SET adr_two_countryname = NULL WHERE adr_two_countrycode IS NOT NULL',__LINE__,__FILE__); + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.005'; +} + + +/** + * Add index to li (login time) column to speed up maintenance (periodic delete of old rows) + * + * Delete some obsolete / since a long time not used tables: + * - egw_vfs (replaced by egw_sqlfs in 1.6) + * - egw_(app_)sessions (not used since 1.4) + */ +function phpgwapi_upgrade1_9_005() +{ + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_access_log','li'); + + $GLOBALS['egw_setup']->oProc->DropTable('egw_app_sessions'); + $GLOBALS['egw_setup']->oProc->DropTable('egw_sessions'); + $GLOBALS['egw_setup']->oProc->DropTable('egw_vfs'); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.006'; +} + +/** + * Add column to store CalDAV name given by client + */ +function phpgwapi_upgrade1_9_006() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook','carddav_name',array( + 'type' => 'varchar', + 'precision' => '64', + 'comment' => 'name part of CardDAV URL, if specified by client' + )); + $GLOBALS['egw_setup']->db->query($sql='UPDATE egw_addressbook SET carddav_name='. + $GLOBALS['egw_setup']->db->concat( + $GLOBALS['egw_setup']->db->to_varchar('contact_id'),"'.vcf'"),__LINE__,__FILE__); + + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook','carddav_name'); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.007'; +} + +/** + * Add columns for session list (dla, action), make sessionid primary key and TS 64bit + */ +function phpgwapi_upgrade1_9_007() +{ + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_access_log',array( + 'fd' => array( + 'sessionid' => array('type' => 'auto','nullable' => False,'comment' => 'primary key'), + 'loginid' => array('type' => 'varchar','precision' => '64','nullable' => False,'comment' => 'username used to login'), + 'ip' => array('type' => 'varchar','precision' => '40','nullable' => False,'comment' => 'ip of user'), + 'li' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'TS if login'), + 'lo' => array('type' => 'int','precision' => '8','comment' => 'TD of logout'), + 'account_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'numerical account id'), + 'session_dla' => array('type' => 'int','precision' => '8','comment' => 'TS of last user action'), + 'session_action' => array('type' => 'varchar','precision' => '64','comment' => 'menuaction or path of last user action'), + 'session_php' => array('type' => 'char','precision' => '64','nullable' => False,'comment' => 'php session-id or error-message'), + 'notification_heartbeat' => array('type' => 'int','precision' => '8','comment' => 'TS of last notification request') + ), + 'pk' => array('sessionid'), + 'fk' => array(), + 'ix' => array('li','lo','session_dla','notification_heartbeat'), + 'uc' => array() + ),array( + 'session_php' => 'sessionid', + 'sessionid' => 'NULL', // to NOT copy old sessionid, but create a new sequence + )); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.008'; +} + +/** + * Alter column cat_owner to varchar(255) to support multiple owners/groups per cat + */ +function phpgwapi_upgrade1_9_008() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_categories','cat_owner',array( + 'type' => 'varchar', + 'precision' => '255', + 'nullable' => False, + 'default' => '0' + )); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.009'; +} + +/** + * Alter column account_pwd to varchar(128) to allow to store sha256_crypt hashes + * + * Enable password migration to new default "securest available", if current hash is the default (sql: md5, ldap: des) + * or the 1.9.009 migration to ssha is running + */ +function phpgwapi_upgrade1_9_009() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_accounts','account_pwd',array( + 'type' => 'varchar', + 'precision' => '128', + 'nullable' => False + )); + + // query password hashing from database + $config = array( + 'auth_type' => 'sql', + 'account_repository' => null, // default is auth_type + 'sql_encryption_type' => 'md5', + 'ldap_encryption_type' => 'des', + 'pwd_migration_allowed' => null, // default off + 'pwd_migration_types' => null, + ); + foreach($GLOBALS['egw_setup']->db->select('egw_config','config_name,config_value',array( + 'config_app' => 'phpgwapi', + 'config_name' => array_keys($config), + ),__LINE__,__FILE__) as $row) + { + $config[$row['config_name']] = $row['config_value']; + } + if (!isset($config['account_repository'])) $config['account_repository'] = $config['auth_type']; + + // changing pw hashing only, if we auth agains our own account repository and no migration already active + if ($config['auth_type'] == $config['account_repository'] && + (!$config['pwd_migration_allowed'] || $config['pwd_migration_types'] == 'md5,crypt')) // 1.9.009 migration to ssha + { + require_once EGW_SERVER_ROOT.'/setup/inc/hook_config.inc.php'; // for sql_passwdhashes to get securest available password hash + $securest = null; + sql_passwdhashes(array(), true, $securest); + // OpenLDAP has no own support for extended crypt like sha512_crypt, but relys the OS crypt implementation, + // do NOT automatically migrate to anything above SSHA for OS other then Linux (Darwin can not auth anymore!) + if ($config['auth_type'] == 'sql' && in_array($config['sql_encryption_type'], array('md5','ssha')) || + $config['auth_type'] == 'ldap'&& in_array($config['ldap_encryption_type'], array('des','ssha')) && + (PHP_OS == 'Linux' || $securest == 'ssha')) + { + $config['pwd_migration_types'] = 'md5,crypt'; // des is called crypt in hash + if ($config['pwd_migration_allowed'] && $securest != 'ssha') $config['pwd_migration_types'] .= ',ssha'; + $config['sql_encryption_type'] = $config['ldap_encryption_type'] = $securest; + $config['pwd_migration_allowed'] = 'True'; + echo "Enabling password migration to $securest
\n"; + } + foreach($config as $name => $value) + { + $GLOBALS['egw_setup']->db->insert('egw_config',array( + 'config_value' => $value, + ),array( + 'config_app' => 'phpgwapi', + 'config_name' => $name, + ),__LINE__,__FILE__); + } + } + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.010'; +} + +/** + * Create template directory and set default document_dir preference of addressbook, calendar, infolog, tracker, timesheet and projectmanager + */ +function phpgwapi_upgrade1_9_010() +{ + $admins = $GLOBALS['egw_setup']->add_account('Admins','Admin','Group',False,False); + + egw_vfs::$is_root = true; + $prefs = new preferences(); + $prefs->read_repository(false); + foreach(array('','addressbook', 'calendar', 'infolog', 'tracker', 'timesheet', 'projectmanager') as $app) + { + if ($app && !file_exists(EGW_SERVER_ROOT.'/'.$app)) continue; + + // create directory and set permissions: Admins writable and other readable + $dir = '/templates'.($app ? '/'.$app : ''); + egw_vfs::mkdir($dir, 075, STREAM_MKDIR_RECURSIVE); + egw_vfs::chgrp($dir, abs($admins)); + egw_vfs::chmod($dir, 075); + if (!$app) continue; + + // set default preference for app (preserving a maybe already set document-directory) + if ($prefs->default[$app]['document_dir']) $dir .= ' '.$prefs->default[$app]['document_dir']; + $prefs->add($app, 'document_dir', $dir, 'default'); + } + $prefs->save_repository(false, 'default'); + egw_vfs::$is_root = false; + + // check if categories are already updated to global == cat_owner=0 + // has to run as API update, before apps (tracker) creates new global cats with cat_owner=0 stopping the update + categories::invalidate_cache(); + categories::init_cache(); // updates the cats + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.011'; +} + +/** + * Language: French --> Français + */ +function phpgwapi_upgrade1_9_011() +{ + $GLOBALS['egw_setup']->db->insert($GLOBALS['egw_setup']->languages_table,array('lang_name' => 'Français'),array('lang_id' => 'fr'),__LINE__,__FILE__); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.012'; +} + +/** + * Add index for contact_modified to improve performance of ctag generation on big installtions + */ +function phpgwapi_upgrade1_9_012() +{ + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook','contact_modified'); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.013'; +} + +/** + * Adding neccessary information to return list to (Apple) CardDAV clients as "Group" + */ +function phpgwapi_upgrade1_9_013() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_uid',array( + 'type' => 'varchar', + 'precision' => '255' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_carddav_name',array( + 'type' => 'varchar', + 'precision' => '64' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_etag',array( + 'type' => 'int', + 'precision' => '4', + 'nullable' => False, + 'default' => '0' + )); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_modified',array( + 'type' => 'timestamp', + 'nullable' => False, + 'default' => 'current_timestamp' + )); + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook_lists','list_modified'); + $GLOBALS['egw_setup']->oProc->AddColumn('egw_addressbook_lists','list_modifier',array( + 'type' => 'int', + 'precision' => '4' + )); + $install_id = $GLOBALS['egw_setup']->db->select('egw_config','config_value',array( + 'config_app' => 'phpgwapi', + 'config_name' => 'install_id', + ),__LINE__,__FILE__)->fetchColumn(); + // setting values for existing lists + $GLOBALS['egw_setup']->db->query('UPDATE egw_addressbook_lists SET '. + 'list_uid='.$GLOBALS['egw_setup']->db->concat("'addressbook-lists-'",'list_id',"'-$install_id'"). + ',list_carddav_name='.$GLOBALS['egw_setup']->db->concat("'addressbook-lists-'",'list_id',"'-$install_id.vcf'"), + __LINE__,__FILE__); + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook_lists','list_uid',true); + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_addressbook_lists','list_carddav_name',true); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.014'; +} + + +function phpgwapi_upgrade1_9_014() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_access_log','user_agent',array( + 'type' => 'varchar', + 'precision' => '255', + 'comment' => 'User-agent of browser/device' + )); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.015'; +} + + +function phpgwapi_upgrade1_9_015() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_history_log','sessionid',array( + 'type' => 'int', + 'precision' => '4', + 'comment' => 'primary key to egw_access_log' + )); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.016'; +} + + +/** + * Some index to speed up access/update of huge access-logs + * + * ALTER TABLE `egw_access_log` ADD INDEX `egw_access_log_session_php` ( `session_php` ) + * ALTER TABLE `egw_access_log` ADD INDEX `egw_access_log_account_id_ip_li` ( `account_id` , `ip` , `li` ) + * ALTER TABLE `egw_access_log` ADD INDEX `egw_access_log_account_id_loginid_li` ( `account_id` , `loginid` , `li` ) + */ +function phpgwapi_upgrade1_9_016() +{ + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_access_log','session_php'); + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_access_log',array('account_id','ip','li')); + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_access_log',array('account_id','loginid','li')); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.017'; +} + + +/** + * Some index to speed up access/update of huge history-logs + * + * ALTER TABLE `egw_history_log` ADD INDEX `egw_history_log_appname_record_id_id` (`history_appname`, `history_record_id`, `history_id`) + * DROP INDEX `egw_history_log_appname_record_id_status_timestamp` ON `egw_history_log` + */ +function phpgwapi_upgrade1_9_017() +{ + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_history_log', array('history_appname','history_record_id','history_id')); + $GLOBALS['egw_setup']->oProc->DropIndex('egw_history_log', array('history_appname','history_record_id','history_status','history_timestamp')); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.018'; +} + + +function phpgwapi_upgrade1_9_018() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_addressbook','carddav_name',array( + 'type' => 'varchar', + 'precision' => '200', + 'comment' => 'name part of CardDAV URL, if specified by client' + )); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.019'; +} + + +function phpgwapi_upgrade1_9_019() +{ + $GLOBALS['egw_setup']->oProc->DropTable('egw_interserv'); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.020'; +} + +/** + * Create own table for custom-fields and migrate values over from egw_config + * + * @return string + */ +function phpgwapi_upgrade1_9_020() +{ + $GLOBALS['egw_setup']->oProc->CreateTable('egw_customfields',array( + 'fd' => array( + 'cf_id' => array('type' => 'auto','nullable' => False), + 'cf_app' => array('type' => 'varchar','precision' => '50','nullable' => False,'comment' => 'app-name cf belongs too'), + 'cf_name' => array('type' => 'varchar','precision' => '128','nullable' => False,'comment' => 'internal name'), + 'cf_label' => array('type' => 'varchar','precision' => '128','comment' => 'label to display'), + 'cf_type' => array('type' => 'varchar','precision' => '64','nullable' => False,'default' => 'text','comment' => 'type of field'), + 'cf_type2' => array('type' => 'varchar','precision' => '2048','comment' => 'comma-separated subtypes of app, cf is valid for'), + 'cf_help' => array('type' => 'varchar','precision' => '256','comment' => 'helptext'), + 'cf_values' => array('type' => 'varchar','precision' => '8096','comment' => 'json object with value label pairs'), + 'cf_len' => array('type' => 'int','precision' => '2','comment' => 'length or columns of field'), + 'cf_rows' => array('type' => 'int','precision' => '2','comment' => 'rows of field'), + 'cf_order' => array('type' => 'int','precision' => '2','comment' => 'order to display fields'), + 'cf_needed' => array('type' => 'bool','default' => '0','comment' => 'field is required'), + 'cf_private' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '2048','comment' => 'comma-separated account_id'), + 'cf_modifier' => array('type' => 'int','meta' => 'account','precision' => '4','comment' => 'last modifier'), + 'cf_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'last modification time') + ), + 'pk' => array('cf_id'), + 'fk' => array(), + 'ix' => array(array('cf_app', 'cf_order')), + 'uc' => array(array('cf_app', 'cf_name')) + )); + + foreach($GLOBALS['egw_setup']->db->select('egw_config', '*', "config_name='customfields'", __LINE__, __FILE__) as $row) + { + $cfs = $row['config_value'][1] == ':' ? unserialize($row['config_value']) : json_decode($row['config_value']); + foreach($cfs as $name => $cf) + { + $data = array( + 'cf_name' => $name, + 'cf_app' => $row['config_app'], + ); + foreach($cf as $attr => $val) + { + switch($attr) + { + case 'private': + case 'type2': + $val = $val ? (is_array($val) ? implode(',', $val) : $val) : null; + break; + case 'values': + $val = $val && is_array($val) ? json_encode($val) : null; + break; + case 'len': + case 'rows': + $val = (string)$val !== '' ? $val : null; + break; + } + $data['cf_'.$attr] = $val; + } + $GLOBALS['egw_setup']->db->insert('egw_customfields', $data, false, __LINE__, __FILE__); + } + } + $GLOBALS['egw_setup']->db->delete('egw_config', "config_name='customfields'", __LINE__, __FILE__); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.021'; +} + + +function phpgwapi_upgrade1_9_021() +{ + $GLOBALS['egw_setup']->oProc->AddColumn('egw_customfields','cf_tab',array( + 'type' => 'varchar', + 'precision' => '64', + 'comment' => 'tab customfield should be shown' + )); + + return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '14.1'; +} diff --git a/preferences/setup/setup.inc.php b/preferences/setup/setup.inc.php index 9c3119eec2..a145604a17 100755 --- a/preferences/setup/setup.inc.php +++ b/preferences/setup/setup.inc.php @@ -11,7 +11,7 @@ $setup_info['preferences']['name'] = 'preferences'; $setup_info['preferences']['title'] = 'Preferences'; -$setup_info['preferences']['version'] = '1.9.001'; +$setup_info['preferences']['version'] = '14.1'; $setup_info['preferences']['app_order'] = 1; $setup_info['preferences']['tables'] = ''; $setup_info['preferences']['enable'] = 2; @@ -34,5 +34,9 @@ $setup_info['preferences']['hooks']['deny_cats'] = 'preferences_hooks::deny_ /* Dependencies for this app to work */ $setup_info['preferences']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') +); +$setup_info['preferences']['depends'][] = array( + 'appname' => 'etemplate', + 'versions' => Array('14.1') ); diff --git a/resources/setup/setup.inc.php b/resources/setup/setup.inc.php index 1d56ca03e2..1268beae34 100755 --- a/resources/setup/setup.inc.php +++ b/resources/setup/setup.inc.php @@ -13,7 +13,7 @@ $setup_info['resources']['name'] = 'resources'; $setup_info['resources']['title'] = 'Resources'; -$setup_info['resources']['version'] = '1.9.004'; +$setup_info['resources']['version'] = '14.1'; $setup_info['resources']['app_order'] = 5; $setup_info['resources']['tables'] = array('egw_resources','egw_resources_extra'); $setup_info['resources']['enable'] = 1; @@ -40,11 +40,11 @@ $setup_info['resources']['hooks']['settings'] = 'resources_hooks::settings'; $setup_info['resources']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); $setup_info['resources']['depends'][] = array( // cause eTemplates is not in the api yet 'appname' => 'etemplate', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); diff --git a/resources/setup/tables_update.inc.php b/resources/setup/tables_update.inc.php index 76c72f8dd8..59f6c7c6a4 100755 --- a/resources/setup/tables_update.inc.php +++ b/resources/setup/tables_update.inc.php @@ -330,12 +330,12 @@ function resources_upgrade1_8() // Give default group all rights to this general cat $defaultgroup = $GLOBALS['egw_setup']->add_account('Default','Default','Group',False,False); $GLOBALS['egw_setup']->add_acl('resources','run',$defaultgroup); - $GLOBALS['egw_setup']->add_acl('resources',"L$cat_id",$defaultgroup,399); $GLOBALS['egw_setup']->add_acl('resources',"L$locations_cat_id",$defaultgroup,399); return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.001'; } + function resources_upgrade1_9_001() { $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','deleted',array( @@ -346,10 +346,13 @@ function resources_upgrade1_9_001() return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.002'; } + function resources_upgrade1_9_002() { return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.003'; } + + function resources_upgrade1_9_003() { $GLOBALS['egw_setup']->oProc->AddColumn('egw_resources','res_creator',array( @@ -376,3 +379,8 @@ function resources_upgrade1_9_003() return $GLOBALS['setup_info']['resources']['currentver'] = '1.9.004'; } + +function resources_upgrade1_9_004() +{ + return $GLOBALS['setup_info']['resources']['currentver'] = '14.1'; +} diff --git a/timesheet/setup/setup.inc.php b/timesheet/setup/setup.inc.php index b88ce64453..b083f40991 100644 --- a/timesheet/setup/setup.inc.php +++ b/timesheet/setup/setup.inc.php @@ -17,7 +17,7 @@ if (!defined('TIMESHEET_APP')) } $setup_info[TIMESHEET_APP]['name'] = TIMESHEET_APP; -$setup_info[TIMESHEET_APP]['version'] = '1.9.002'; +$setup_info[TIMESHEET_APP]['version'] = '14.1'; $setup_info[TIMESHEET_APP]['app_order'] = 5; $setup_info[TIMESHEET_APP]['tables'] = array('egw_timesheet','egw_timesheet_extra'); $setup_info[TIMESHEET_APP]['enable'] = 1; @@ -50,10 +50,9 @@ $setup_info[TIMESHEET_APP]['hooks']['acl_rights'] = 'timesheet_hooks::acl_rights /* Dependencies for this app to work */ $setup_info[TIMESHEET_APP]['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); $setup_info[TIMESHEET_APP]['depends'][] = array( 'appname' => 'etemplate', - 'versions' => Array('1.7','1.8','1.9') + 'versions' => Array('14.1') ); - diff --git a/timesheet/setup/tables_update.inc.php b/timesheet/setup/tables_update.inc.php index 7276b0df73..602bec4745 100644 --- a/timesheet/setup/tables_update.inc.php +++ b/timesheet/setup/tables_update.inc.php @@ -115,3 +115,8 @@ function timesheet_upgrade1_9_001() return $GLOBALS['setup_info']['timesheet']['currentver'] = '1.9.002'; } + +function timesheet_upgrade1_9_002() +{ + return $GLOBALS['setup_info']['timesheet']['currentver'] = '14.1'; +}