From c2778383c582df7201e31ca7721f7104c10c3b04 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 22 Mar 2003 01:32:43 +0000 Subject: [PATCH] 2 changes: - newer lang-files get now installed automaticaly when a user log's in - Czech is added to the supported lang's ==> phpgwapi version updated to 0.9.14.002 --- phpgwapi/inc/class.setup_detection.inc.php | 9 ++-- phpgwapi/setup/default_records.inc.php | 2 +- phpgwapi/setup/setup.inc.php | 8 +-- phpgwapi/setup/tables_update.inc.php | 59 +++++++++++++++++++++- setup/lang.php | 32 ++++++++++-- setup/templates/default/lang_main.tpl | 8 +-- 6 files changed, 96 insertions(+), 22 deletions(-) diff --git a/phpgwapi/inc/class.setup_detection.inc.php b/phpgwapi/inc/class.setup_detection.inc.php index 4f39683225..1d8691dadd 100644 --- a/phpgwapi/inc/class.setup_detection.inc.php +++ b/phpgwapi/inc/class.setup_detection.inc.php @@ -319,14 +319,17 @@ } } - function check_lang() + function check_lang($check = True) { $GLOBALS['phpgw_setup']->db->Halt_On_Error = 'no'; - if($GLOBALS['phpgw_info']['setup']['stage']['db'] != 10) + if($check && $GLOBALS['phpgw_info']['setup']['stage']['db'] != 10) { return ''; } - + if (!$check) + { + $GLOBALS['setup_info'] = $GLOBALS['phpgw_setup']->detection->get_db_versions($GLOBALS['setup_info']); + } if($GLOBALS['phpgw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.15.002')) { $langtbl = 'lang'; diff --git a/phpgwapi/setup/default_records.inc.php b/phpgwapi/setup/default_records.inc.php index 4e626163e1..9a8014f425 100644 --- a/phpgwapi/setup/default_records.inc.php +++ b/phpgwapi/setup/default_records.inc.php @@ -29,7 +29,7 @@ $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('br','Breton','No')"); $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('ca','Catalan','No')"); $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('co','Corsican','No')"); - $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('cs','Czech','No')"); + $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('cs','Czech','Yes')"); $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('cy','Welsh','No')"); $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('da','Danish','Yes')"); $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_languages (lang_id, lang_name, available) VALUES ('de','German','Yes')"); diff --git a/phpgwapi/setup/setup.inc.php b/phpgwapi/setup/setup.inc.php index dcef7d9a98..99180c4863 100755 --- a/phpgwapi/setup/setup.inc.php +++ b/phpgwapi/setup/setup.inc.php @@ -13,7 +13,7 @@ /* Basic information about this app */ $setup_info['phpgwapi']['name'] = 'phpgwapi'; - $setup_info['phpgwapi']['version'] = '0.9.15.008'; + $setup_info['phpgwapi']['version'] = '0.9.15.009'; $setup_info['phpgwapi']['versions']['current_header'] = '1.23'; $setup_info['phpgwapi']['enable'] = 3; $setup_info['phpgwapi']['app_order'] = 1; @@ -32,12 +32,6 @@ 'email' => 'jengo@phpgroupware.org' ); - $setup_info['phpgwapi']['maintainer'][] = array - ( - 'name' => 'Marc A. Peters', - 'email' => 'skeeter@phpgroupware.org' - ); - $setup_info['phpgwapi']['maintainer'][] = array ( 'name' => 'Bettina Gille', diff --git a/phpgwapi/setup/tables_update.inc.php b/phpgwapi/setup/tables_update.inc.php index 00f036607d..448d2820ab 100644 --- a/phpgwapi/setup/tables_update.inc.php +++ b/phpgwapi/setup/tables_update.inc.php @@ -9,7 +9,7 @@ * option) any later version. * \**************************************************************************/ /* $Id$ */ - + /* Include older phpGroupWare update support */ include($appdir . 'tables_update_0_9_9.inc.php'); include($appdir . 'tables_update_0_9_10.inc.php'); @@ -45,6 +45,13 @@ return $GLOBALS['setup_info']['phpgwapi']['currentver']; } + $test[] = '0.9.14.002'; + function phpgwapi_upgrade0_9_14_002() + { + $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.001'; + return $GLOBALS['setup_info']['phpgwapi']['currentver']; + } + $test[] = '0.9.15.001'; function phpgwapi_upgrade0_9_15_001() { @@ -125,11 +132,49 @@ $test[] = '0.9.15.006'; function phpgwapi_upgrade0_9_15_006() { + // Fix bug from update script in 0.9.11.004/5: + // column config_app was added to table phpgw_config (which places it as last column), + // but in the tables_current.inc.php it was added as first column. + // When setup / schemaproc wants to do the AlterColum it recreates the table for pgSql, + // as pgSql could not change the column-type. This recreation is can not be based on + // tables_current, but on running tables_baseline throught all update-scripts. + // Which gives at the end two different versions of the table on new or updated installs. + // I fix it now in the (wrong) order of the tables_current, as some apps might depend on! + /* $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_config','config_value',array( 'type' => 'text', 'nullable' => False )); - + */ + $GLOBALS['phpgw_setup']->oProc->query("SELECT * FROM phpgw_config"); + while ($GLOBALS['phpgw_setup']->oProc->next_record()) + { + $confs[] = array( + 'config_app' => $GLOBALS['phpgw_setup']->oProc->f('config_app'), + 'config_name' => $GLOBALS['phpgw_setup']->oProc->f('config_name'), + 'config_value' => $GLOBALS['phpgw_setup']->oProc->f('config_value') + ); + } + $GLOBALS['phpgw_setup']->oProc->DropTable('phpgw_config'); + + $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_config',array( + 'fd' => array( + 'config_app' => array('type' => 'varchar', 'precision' => 50), + 'config_name' => array('type' => 'varchar', 'precision' => 255, 'nullable' => false), + 'config_value' => array('type' => 'text') + ), + 'pk' => array(), + 'fk' => array(), + 'ix' => array(), + 'uc' => array('config_name') + )); + + foreach($confs as $conf) + { + $GLOBALS['phpgw_setup']->oProc->query( + "INSERT INTO phpgw_config (config_app,config_name,config_value) VALUES ('". + $conf['config_app']."','".$conf['config_name']."','".$conf['config_value']."')"); + } $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.007'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; @@ -158,4 +203,14 @@ $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.008'; return $GLOBALS['setup_info']['phpgwapi']['currentver']; } + + $test[] = '0.9.15.008'; + function phpgwapi_upgrade0_9_15_008() + { + // this might already be done in 0.9.14.002, but it does not harm to set it again to YES + $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_languages SET available='Yes' WHERE lang_id='cs'"); + + $GLOBALS['setup_info']['phpgwapi']['currentver'] = '0.9.15.009'; + return $GLOBALS['setup_info']['phpgwapi']['currentver']; + } ?> diff --git a/setup/lang.php b/setup/lang.php index 7cdcb1f1ad..b0fa95ed2b 100644 --- a/setup/lang.php +++ b/setup/lang.php @@ -35,7 +35,7 @@ // this is not used //$sep = $common->filesystem_separator(); } - else + elseif ($included != 'from_login') { $newinstall = True; $lang_selected['en'] = 'en'; @@ -46,6 +46,16 @@ { $lang_selected = @$GLOBALS['HTTP_POST_VARS']['lang_selected']; $upgrademethod = @$GLOBALS['HTTP_POST_VARS']['upgrademethod']; + + if (!isset($GLOBALS['phpgw_info']['server']) && $upgrademethod != 'dumpold') + { + $GLOBALS['phpgw_setup']->db->query("select * from phpgw_config WHERE config_app='phpgwapi' AND config_name='lang_ctimes'",__LINE__,__FILE__); + if ($GLOBALS['phpgw_setup']->db->next_record()) + { + $GLOBALS['phpgw_info']['server']['lang_ctimes'] = unserialize(stripslashes($GLOBALS['phpgw_setup']->db->f('config_value'))); + } + } + $GLOBALS['phpgw_setup']->db->transaction_begin(); if (count($lang_selected)) { @@ -54,6 +64,7 @@ // dont delete the custom main- & loginscreen messages every time $GLOBALS['phpgw_setup']->db->query("DELETE FROM phpgw_lang where app_name != 'mainscreen' AND app_name != 'loginscreen'",__LINE__,__FILE__); //echo '
Test: dumpold'; + $GLOBALS['phpgw_info']['server']['lang_ctimes'] = array(); } while (list($null,$lang) = each($lang_selected)) { @@ -86,6 +97,8 @@ { //echo '
Including: ' . $appfile; $raw[] = file($appfile); + + $GLOBALS['phpgw_info']['server']['lang_ctimes'][$lang][$app['name']] = filectime($appfile); } } @reset($raw); @@ -100,7 +113,7 @@ $app_name = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($app_name)); $GLOBALS['phpgw_setup']->db_lang = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($GLOBALS['phpgw_setup']->db_lang)); $content = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($content)); - if ($upgrademethod == 'addmissing' || $upgrademethod == 'dumpold') + if ($upgrademethod == 'addmissing') { //echo '
Test: addmissing'; $GLOBALS['phpgw_setup']->db->query("SELECT COUNT(*) FROM phpgw_lang WHERE message_id='".$message_id."' and lang='".$GLOBALS['phpgw_setup']->db_lang."' and (app_name='".$app_name."' or app_name='common')",__LINE__,__FILE__); @@ -113,8 +126,7 @@ } } -// if ($addit || ($upgrademethod == 'dumpold' || $newinstall || $upgrademethod == 'addonlynew')) - if ($addit || ($newinstall || $upgrademethod == 'addonlynew')) + if ($addit || $newinstall || $upgrademethod == 'addonlynew' || $upgrademethod == 'dumpold') { if($message_id && $content) { @@ -131,6 +143,10 @@ } } $GLOBALS['phpgw_setup']->db->transaction_commit(); + + $GLOBALS['phpgw_setup']->db->query("DELETE from phpgw_config WHERE config_app='phpgwapi' AND config_name='lang_ctimes'",__LINE__,__FILE__); + $GLOBALS['phpgw_setup']->db->query($query="INSERT INTO phpgw_config(config_app,config_name,config_value) VALUES ('phpgwapi','lang_ctimes','". + addslashes(serialize($GLOBALS['phpgw_info']['server']['lang_ctimes']))."')",__LINE__,__FILE__); } if(!$included) @@ -167,14 +183,20 @@ $td_align = $newinstall ? ' align="center"' : ''; $hidden_var1 = $newinstall ? '' : ''; + if (!$newinstall && !isset($GLOBALS['phpgw_info']['setup']['installed_langs'])) + { + $GLOBALS['phpgw_setup']->detection->check_lang(false); // get installed langs + } $select_box_desc = lang('Select which languages you would like to use'); $select_box = ''; $GLOBALS['phpgw_setup']->db->query("select lang_id,lang_name from phpgw_languages where available='Yes'"); while ($GLOBALS['phpgw_setup']->db->next_record()) { + $id = $GLOBALS['phpgw_setup']->db->f('lang_id'); $select_box_langs = $select_box_langs - .'' ."\n"; } diff --git a/setup/templates/default/lang_main.tpl b/setup/templates/default/lang_main.tpl index bf65bf173e..1dbeb951b8 100644 --- a/setup/templates/default/lang_main.tpl +++ b/setup/templates/default/lang_main.tpl @@ -25,14 +25,14 @@ {meth_desc}

- + +  {blurb_dumpold} +
+  {blurb_addonlynew}
 {blurb_addmissing} -
- -  {blurb_dumpold}