';exit;
+ // _debug_array($setup_info);
if (isset($setup_info['phpgwapi']['currentver']))
{
if ($setup_info['phpgwapi']['currentver'] == $setup_info['phpgwapi']['version'])
diff --git a/setup/inc/class.setup_lang.inc.php b/setup/inc/class.setup_lang.inc.php
index 75e867ad65..df6409d693 100644
--- a/setup/inc/class.setup_lang.inc.php
+++ b/setup/inc/class.setup_lang.inc.php
@@ -113,14 +113,21 @@
@function get_langs
@abstract return array of installed languages, e.g. array('de','en')
*/
- function get_langs()
+ function get_langs($DEBUG=False)
{
+ if($DEBUG)
+ {
+ echo ' get_langs(): checking db...' . "\n";
+ }
$GLOBALS['phpgw_setup']->db->query("SELECT DISTINCT(lang) FROM lang",__LINE__,__FILE__);
$langs = array();
while($GLOBALS['phpgw_setup']->db->next_record())
{
- /* echo 'HELLO: ' . $GLOBALS['phpgw_setup']->db->f(0); */
+ if($DEBUG)
+ {
+ echo ' get_langs(): found ' . $GLOBALS['phpgw_setup']->db->f(0);
+ }
$langs[] = $GLOBALS['phpgw_setup']->db->f(0);
}
return $langs;
@@ -131,8 +138,12 @@
@abstract delete all lang entries for an application, return True if langs were found
@param $appname app_name whose translations you want to delete
*/
- function drop_langs($appname)
+ function drop_langs($appname,$DEBUG=False)
{
+ if($DEBUG)
+ {
+ echo ' drop_langs(): Working on: ' . $appname;
+ }
$GLOBALS['phpgw_setup']->db->query("SELECT COUNT(message_id) FROM lang WHERE app_name='$appname'",__LINE__,__FILE__);
$GLOBALS['phpgw_setup']->db->next_record();
if($GLOBALS['phpgw_setup']->db->f(0))
@@ -148,23 +159,35 @@
@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,$force_en=False)
+ function add_langs($appname,$DEBUG=False,$force_en=False)
{
- $langs = $this->get_langs();
+ $langs = $this->get_langs($DEBUG);
if($force_en && !isinarray('en',$langs))
{
$langs[] = 'en';
}
+ if($DEBUG)
+ {
+ echo ' add_langs(): chose these langs: ';
+ _debug_array($langs);
+ }
+
$GLOBALS['phpgw_setup']->db->transaction_begin();
while (list($null,$lang) = each($langs))
{
- /* echo ' Working on: ' . $lang; */
+ if($DEBUG)
+ {
+ echo ' add_langs(): Working on: ' . $lang . ' for ' . $appname;
+ }
$appfile = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP . 'phpgw_' . strtolower($lang) . '.lang';
if(file_exists($appfile))
{
- /* echo ' Including: ' . $appfile; */
+ if($DEBUG)
+ {
+ echo ' add_langs(): Including: ' . $appfile;
+ }
$raw_file = file($appfile);
while (list($null,$line) = @each($raw_file))
@@ -184,7 +207,10 @@
{
if($message_id && $content)
{
- /* echo " adding - INSERT INTO lang VALUES ('$message_id','$app_name','$phpgw_setup->db_lang','$content')"; */
+ if($DEBUG)
+ {
+ echo " add_langs(): adding - INSERT INTO lang VALUES ('$message_id','$app_name','$phpgw_setup->db_lang','$content')";
+ }
$GLOBALS['phpgw_setup']->db->query("INSERT INTO lang VALUES ('$message_id','$app_name','"
. $GLOBALS['phpgw_setup']->db_lang . "','$content')",__LINE__,__FILE__);
}
diff --git a/setup/inc/class.setup_process.inc.php b/setup/inc/class.setup_process.inc.php
index 07ff90f58d..2ac85fc1c9 100755
--- a/setup/inc/class.setup_process.inc.php
+++ b/setup/inc/class.setup_process.inc.php
@@ -26,6 +26,7 @@
var $db;
var $oProc;
var $tables;
+ var $updateincluded = array();
/*!
@function init_process
@@ -81,9 +82,9 @@
/* 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;
+ //_debug_array($setup_info);exit;
$setup_info = $this->check_depends($setup_info);
- //if($i==2) { var_dump($passed);exit; }
+ //if($i==2) { _debug_array($passed);exit; }
/* stuff the rest of the apps, but only those with available upgrades */
while(list($key,$value) = @each($setup_info))
@@ -116,7 +117,7 @@
/* 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;
+ //_debug_array($pass);exit;
break;
default:
/* What the heck are you doing? */
@@ -154,11 +155,10 @@
if ($i == 20) // Then oops it broke
{
echo ' Setup failure: excess looping in process_pass():'."\n";
- echo ' Pass:
'."\n";
- echo var_dump($pass);
- echo '
Passed:
'."\n";
- echo var_dump($passed);
- echo "
";
+ echo ' Pass: '."\n";
+ _debug_array($pass);
+ echo ' Passed: '."\n";
+ _debug_array($passed);
exit;
}
$pass_string = implode (':', $pass);
@@ -348,7 +348,7 @@
{
$appname = $setup_info[$key]['name'];
/* This is in the setup_lang class */
- $this->add_langs($appname,$force_en);
+ $this->add_langs($appname,$DEBUG,$force_en);
if($DEBUG)
{
echo ' process_add_langs(): Translations added for ' . $appname . "\n";
@@ -370,7 +370,7 @@
{
$appname = $setup_info[$key]['name'];
/* This is in the setup_lang class */
- $this->drop_langs($appname);
+ $this->drop_langs($appname,$DEBUG);
if($DEBUG)
{
echo ' process_drop_langs(): Translations removed for ' . $appname . "\n";
@@ -390,10 +390,15 @@
@reset($setup_info);
while (list($key,$null) = @each($setup_info))
{
+ /* Don't upgrade lang files in the middle of an upgrade */
+ if($setup_info[$key]['status'] == 'R')
+ {
+ continue;
+ }
$appname = $setup_info[$key]['name'];
/* These are in the setup_lang class */
- $this->drop_langs($appname);
- $this->add_langs($appname);
+ $this->drop_langs($appname,$DEBUG);
+ $this->add_langs($appname,$DEBUG);
if($DEBUG)
{
echo ' process_upgrade_langs(): Translations reinstalled for ' . $appname . "\n";
@@ -497,12 +502,21 @@
}
$this->oProc->m_odb->HaltOnError = 'no';
$this->oProc->m_bDeltaOnly = True;
-
@reset($setup_info);
while (list($key,$null) = @each($setup_info))
{
- // if upgrade required, or if we are running again after an upgrade or dependency failure
+ /* Don't try to upgrade an app that is not installed */
+ if(!$this->app_registered($setup_info[$key]['name']))
+ {
+ if ($DEBUG)
+ {
+ echo ' process_upgrade(): Application not installed: ' . $appname . "\n";
+ }
+ continue;
+ }
+
+ /* if upgrade required, or if we are running again after an upgrade or dependency failure */
if ($DEBUG) { echo ' process_upgrade(): Incoming : appname: '.$setup_info[$key]['name'] . ' status: ' . $setup_info[$key]['status']; }
if ($setup_info[$key]['status'] == 'U' ||
$setup_info[$key]['status'] == 'D' ||
@@ -545,13 +559,14 @@
{
echo ' process_baseline(): No baseline tables for ' . $appname . "\n";
}
- // This should be a break with a status setting, or not at all
- //break;
+ /* This should be a break with a status setting, or not at all
+ break;
+ */
}
- if (file_exists($appdir . 'tables_update.inc.php') && !@$setup_info[$key]['updateincluded'])
+ if (file_exists($appdir . 'tables_update.inc.php') && !@$this->updateincluded[$appname])
{
include ($appdir . 'tables_update.inc.php');
- $setup_info[$key]['updateincluded'] = True;
+ $this->updateincluded[$appname] = True;
// $test array comes from update file, it is a list of available upgrade functions
@reset($test);
@@ -559,7 +574,7 @@
{
$currentver = $setup_info[$key]['currentver'];
- // build upgrade function name
+ /* build upgrade function name */
$function = $appname . '_upgrade' . ereg_replace("\.", '_', $value);
if ($DEBUG)
diff --git a/setup/index.php b/setup/index.php
index 8bba9651a4..d3d6d2a1bb 100644
--- a/setup/index.php
+++ b/setup/index.php
@@ -91,6 +91,10 @@
$setup_info = $phpgw_setup->get_versions();
$setup_info = $phpgw_setup->get_db_versions($setup_info);
$GLOBALS['phpgw_info']['setup']['stage']['db'] = $phpgw_setup->check_db();
+ if($DEBUG)
+ {
+ _debug_array($setup_info);
+ }
}
if ($DEBUG) { echo 'Stage: ' . $GLOBALS['phpgw_info']['setup']['stage']['db']; }
diff --git a/setup/lang/phpgw_en.lang b/setup/lang/phpgw_en.lang
index 07d66e3825..faf0b33262 100644
--- a/setup/lang/phpgw_en.lang
+++ b/setup/lang/phpgw_en.lang
@@ -204,6 +204,7 @@ top setup en top
to setup 1 admin account and 3 demo accounts. this will delete all existing accounts setup en to setup 1 admin account and 3 demo accounts. This will delete all existing accounts
translations added setup en Translations Added
translations removed setup en Translations Removed
+translations upgraded setup en Translations Upgraded
two weeks setup en two weeks
uninstall all applications setup en Uninstall all applications
uninstalled setup en uninstalled
diff --git a/setup/manageheader.php b/setup/manageheader.php
index b0aff1ef23..1c536dbf72 100644
--- a/setup/manageheader.php
+++ b/setup/manageheader.php
@@ -358,13 +358,11 @@