mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
Lang files are now installed as part of the install/upgrade process. For step
one (mass install/upgrade), english is installed by default
This commit is contained in:
parent
a9a325f0f3
commit
a012283ba5
@ -12,10 +12,12 @@
|
||||
/* $Id$ */
|
||||
|
||||
$DEBUG = False;
|
||||
// TODO: We allow a user to hose their setup here, need to make use
|
||||
// of dependencies so they are warned that they are pulling the rug
|
||||
// out from under other apps. e.g. if they select to uninstall the api
|
||||
// this will happen without further warning.
|
||||
/*
|
||||
TODO: We allow a user to hose their setup here, need to make use
|
||||
of dependencies so they are warned that they are pulling the rug
|
||||
out from under other apps. e.g. if they select to uninstall the api
|
||||
this will happen without further warning.
|
||||
*/
|
||||
|
||||
$phpgw_info = array();
|
||||
$GLOBALS['phpgw_info']['flags'] = array(
|
||||
@ -142,12 +144,8 @@
|
||||
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('hooks deregistered') . '.';
|
||||
}
|
||||
|
||||
$dropped = False;
|
||||
$dropped = $phpgw_setup->drop_langs($appname);
|
||||
if($dropped)
|
||||
{
|
||||
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('Translations removed') . '.';
|
||||
}
|
||||
$terror = $phpgw_setup->process_drop_langs($terror);
|
||||
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('Translations removed') . '.';
|
||||
}
|
||||
|
||||
while (list($appname,$key) = @each($install))
|
||||
@ -180,7 +178,7 @@
|
||||
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('hooks registered') . '.';
|
||||
}
|
||||
}
|
||||
$phpgw_setup->add_langs($appname);
|
||||
$terror = $phpgw_setup->process_add_langs($terror);
|
||||
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('Translations added') . '.';
|
||||
}
|
||||
|
||||
@ -199,6 +197,9 @@
|
||||
{
|
||||
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('upgraded') . '.';
|
||||
}
|
||||
|
||||
$terror = $phpgw_setup->process_upgrade_langs($terror);
|
||||
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('Translations upgraded') . '.';
|
||||
}
|
||||
|
||||
//$setup_tpl->set_var('goback',
|
||||
|
@ -107,7 +107,7 @@
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/* Following functions are called for app (un)install in applications.php only */
|
||||
/* Following functions are called for app (un)install */
|
||||
|
||||
/*!
|
||||
@function get_langs
|
||||
@ -148,9 +148,13 @@
|
||||
@abstract process an application's lang files, calling get_langs() to see what langs the admin installed already
|
||||
@param $appname app_name of application to process
|
||||
*/
|
||||
function add_langs($appname)
|
||||
function add_langs($appname,$force_en=False)
|
||||
{
|
||||
$langs = $this->get_langs();
|
||||
if($force_en && !isinarray('en',$langs))
|
||||
{
|
||||
$langs[] = 'en';
|
||||
}
|
||||
|
||||
$GLOBALS['phpgw_setup']->db->transaction_begin();
|
||||
|
||||
@ -165,7 +169,7 @@
|
||||
|
||||
while (list($null,$line) = @each($raw_file))
|
||||
{
|
||||
list($message_id,$app_name,$phpgw_setup->db_lang,$content) = explode("\t",$line);
|
||||
list($message_id,$app_name,$GLOBALS['phpgw_setup']->db_lang,$content) = explode("\t",$line);
|
||||
$message_id = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($message_id));
|
||||
/* echo '<br>APPNAME:' . $app_name . ' PHRASE:' . $message_id; */
|
||||
$app_name = $GLOBALS['phpgw_setup']->db->db_addslashes(chop($app_name));
|
||||
|
@ -54,8 +54,10 @@
|
||||
@abstract the mother of all multipass upgrade parental loop functions
|
||||
@param $setup_info array of application info from setup.inc.php files
|
||||
@param $type optional, defaults to new(install), could also be 'upgrade'
|
||||
@param $DEBUG optional, print debugging info
|
||||
@param $force_en optional, install english language files
|
||||
*/
|
||||
function process_pass($setup_info,$method='new',$DEBUG=False)
|
||||
function process_pass($setup_info,$method='new',$DEBUG=False,$force_en=False)
|
||||
{
|
||||
if (!$method)
|
||||
{
|
||||
@ -76,15 +78,15 @@
|
||||
{
|
||||
$passing = array();
|
||||
if ($DEBUG) { echo '<br>process_pass(): #' . $i . ' for ' . $method . ' processing' . "\n"; }
|
||||
// Check current versions and dependencies
|
||||
/* Check current versions and dependencies */
|
||||
$setup_info = $this->get_db_versions($setup_info);
|
||||
$setup_info = $this->compare_versions($setup_info);
|
||||
//var_dump($setup_info);exit;
|
||||
// var_dump($setup_info);exit;
|
||||
$setup_info = $this->check_depends($setup_info);
|
||||
//if($i==2) { var_dump($passed);exit; }
|
||||
|
||||
// stuff the rest of the apps, but only those with available upgrades
|
||||
while(list($key,$value) = each($setup_info))
|
||||
/* stuff the rest of the apps, but only those with available upgrades */
|
||||
while(list($key,$value) = @each($setup_info))
|
||||
{
|
||||
if (($value['name'] != 'phpgwapi') && ($value['status'] == 'U'))
|
||||
{
|
||||
@ -93,34 +95,38 @@
|
||||
$pass[$value['name']] = $setup_info[$value['name']];
|
||||
}
|
||||
}
|
||||
// Now if we are on the 2nd or more passes, add api in
|
||||
//if (!$pass['phpgwapi'])
|
||||
//{
|
||||
// $pass['phpgwapi'] = $setup_info['phpgwapi'];
|
||||
//}
|
||||
/*
|
||||
Now if we are on the 2nd or more passes, add api in
|
||||
if (!$pass['phpgwapi'])
|
||||
{
|
||||
$pass['phpgwapi'] = $setup_info['phpgwapi'];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
switch ($method)
|
||||
{
|
||||
case 'new':
|
||||
// Create tables and insert new records for each app in this list
|
||||
/* Create tables and insert new records for each app in this list */
|
||||
$passing = $this->process_current($pass,$DEBUG);
|
||||
$passing = $this->process_default_records($passing,$DEBUG);
|
||||
$passing = $this->process_add_langs($passing,$DEBUG,$force_en);
|
||||
break;
|
||||
case 'upgrade':
|
||||
// Run upgrade scripts on each app in the list
|
||||
/* Run upgrade scripts on each app in the list */
|
||||
$passing = $this->process_upgrade($pass,$DEBUG);
|
||||
$passing = $this->process_upgrade_langs($passing,$DEBUG);
|
||||
//echo var_dump($pass);exit;
|
||||
break;
|
||||
default:
|
||||
// What the heck are you doing?
|
||||
/* What the heck are you doing? */
|
||||
return False;
|
||||
break;
|
||||
}
|
||||
|
||||
$pass = array();
|
||||
reset($passing);
|
||||
while(list($key,$value) = each($passing))
|
||||
@reset($passing);
|
||||
while(list($key,$value) = @each($passing))
|
||||
{
|
||||
if($value['status'] == 'C')
|
||||
{
|
||||
@ -161,7 +167,7 @@
|
||||
|
||||
// now return the list
|
||||
@reset($passed);
|
||||
while(list($key,$value) = each($passed))
|
||||
while(list($key,$value) = @each($passed))
|
||||
{
|
||||
$setup_info[$value['name']] = $passed[$value['name']];
|
||||
}
|
||||
@ -190,7 +196,7 @@
|
||||
}
|
||||
|
||||
@reset($setup_info);
|
||||
while (list($key,$null) = each($setup_info))
|
||||
while (list($key,$null) = @each($setup_info))
|
||||
{
|
||||
if ($setup_info[$key]['tables'])
|
||||
{
|
||||
@ -227,7 +233,7 @@
|
||||
$this->oProc->m_bDeltaOnly = False;
|
||||
|
||||
@reset($setup_info);
|
||||
while (list($key,$null) = each($setup_info))
|
||||
while (list($key,$null) = @each($setup_info))
|
||||
{
|
||||
$enabled = False;
|
||||
$appname = $setup_info[$key]['name'];
|
||||
@ -308,7 +314,7 @@
|
||||
$oProc = $this->oProc;
|
||||
|
||||
@reset($setup_info);
|
||||
while (list($key,$null) = each($setup_info))
|
||||
while (list($key,$null) = @each($setup_info))
|
||||
{
|
||||
$appname = $setup_info[$key]['name'];
|
||||
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
|
||||
@ -330,6 +336,72 @@
|
||||
return ($setup_info);
|
||||
}
|
||||
|
||||
/*!
|
||||
@function process_add_langs
|
||||
@abstract process application lang files and uninstall
|
||||
@param $setup_info array of application info from setup.inc.php files, etc.
|
||||
*/
|
||||
function process_add_langs($setup_info,$DEBUG=False,$force_en=False)
|
||||
{
|
||||
@reset($setup_info);
|
||||
while (list($key,$null) = @each($setup_info))
|
||||
{
|
||||
$appname = $setup_info[$key]['name'];
|
||||
/* This is in the setup_lang class */
|
||||
$this->add_langs($appname,$force_en);
|
||||
if($DEBUG)
|
||||
{
|
||||
echo '<br>process_add_langs(): Translations added for ' . $appname . "\n";
|
||||
}
|
||||
}
|
||||
// Done, return current status
|
||||
return ($setup_info);
|
||||
}
|
||||
|
||||
/*!
|
||||
@function process_drop_langs
|
||||
@abstract process application lang files and install
|
||||
@param $setup_info array of application info from setup.inc.php files, etc.
|
||||
*/
|
||||
function process_drop_langs($setup_info,$DEBUG=False)
|
||||
{
|
||||
@reset($setup_info);
|
||||
while (list($key,$null) = @each($setup_info))
|
||||
{
|
||||
$appname = $setup_info[$key]['name'];
|
||||
/* This is in the setup_lang class */
|
||||
$this->drop_langs($appname);
|
||||
if($DEBUG)
|
||||
{
|
||||
echo '<br>process_drop_langs(): Translations removed for ' . $appname . "\n";
|
||||
}
|
||||
}
|
||||
// Done, return current status
|
||||
return ($setup_info);
|
||||
}
|
||||
|
||||
/*!
|
||||
@function process_upgrade_langs
|
||||
@abstract process application lang files and reinstall
|
||||
@param $setup_info array of application info from setup.inc.php files, etc.
|
||||
*/
|
||||
function process_upgrade_langs($setup_info,$DEBUG=False)
|
||||
{
|
||||
@reset($setup_info);
|
||||
while (list($key,$null) = @each($setup_info))
|
||||
{
|
||||
$appname = $setup_info[$key]['name'];
|
||||
/* These are in the setup_lang class */
|
||||
$this->drop_langs($appname);
|
||||
$this->add_langs($appname);
|
||||
if($DEBUG)
|
||||
{
|
||||
echo '<br>process_upgrade_langs(): Translations reinstalled for ' . $appname . "\n";
|
||||
}
|
||||
}
|
||||
// Done, return current status
|
||||
return ($setup_info);
|
||||
}
|
||||
/*!
|
||||
@function process_test_data
|
||||
@abstract process test_data.inc.php in each application/setup dir for developer tests
|
||||
@ -346,7 +418,7 @@
|
||||
$oProc = $this->oProc;
|
||||
|
||||
@reset($setup_info);
|
||||
while (list($key,$null) = each($setup_info))
|
||||
while (list($key,$null) = @each($setup_info))
|
||||
{
|
||||
$appname = $setup_info[$key]['name'];
|
||||
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
|
||||
@ -380,7 +452,7 @@
|
||||
}
|
||||
|
||||
@reset($setup_info);
|
||||
while (list($key,$null) = each($setup_info))
|
||||
while (list($key,$null) = @each($setup_info))
|
||||
{
|
||||
$appname = $setup_info[$key]['name'];
|
||||
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
|
||||
@ -428,7 +500,7 @@
|
||||
|
||||
|
||||
@reset($setup_info);
|
||||
while (list($key,$null) = each($setup_info))
|
||||
while (list($key,$null) = @each($setup_info))
|
||||
{
|
||||
// if upgrade required, or if we are running again after an upgrade or dependency failure
|
||||
if ($DEBUG) { echo '<br>process_upgrade(): Incoming : appname: '.$setup_info[$key]['name'] . ' status: ' . $setup_info[$key]['status']; }
|
||||
|
@ -10,10 +10,12 @@
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
// Idea: This is so I don't forget. When they are preforming a new install, after config,
|
||||
// forward them right to index.php. Create a session for them and have a nice little intro
|
||||
// page explaining what to do from there (ie, create there own account)
|
||||
|
||||
/*
|
||||
Idea: This is so I don't forget. When they are preforming a new install, after config,
|
||||
forward them right to index.php. Create a session for them and have a nice little intro
|
||||
page explaining what to do from there (ie, create there own account)
|
||||
*/
|
||||
$DEBUG = False;
|
||||
|
||||
$phpgw_info = array();
|
||||
@ -246,7 +248,8 @@
|
||||
$setup_info = $phpgw_setup->process_droptables($setup_info);
|
||||
break;
|
||||
case 'new':
|
||||
$setup_info = $phpgw_setup->process_pass($setup_info,'new',$DEBUG);
|
||||
/* process all apps and langs(last param True) */
|
||||
$setup_info = $phpgw_setup->process_pass($setup_info,'new',$DEBUG,True);
|
||||
$included = True;
|
||||
include('lang.php');
|
||||
$GLOBALS['phpgw_info']['setup']['currentver']['phpgwapi'] = 'oldversion';
|
||||
|
Loading…
Reference in New Issue
Block a user