From c13ade18dca5db172f6d0735347f33b7b4348fc2 Mon Sep 17 00:00:00 2001 From: seek3r Date: Mon, 7 Jan 2002 10:50:42 +0000 Subject: [PATCH] Several fixes in this commit because the switch from sf to savannah had to come from a day old copy of our cvs tree. Much was fixed including email being fixed for PHP3 compatibility, skeeter updated all the setup.inc.php files to say they would be comaptible with the new API version, ceb made fixes to the projects app based on newly submitted bug reports. Im sure there are more but I dont know all the details. Oh, I did add a print_r() to the php3 support files. --- admin/setup/setup.inc.php | 2 +- calendar/setup/setup.inc.php | 26 +++++----- filemanager/setup/setup.inc.php | 7 ++- infolog/setup/setup.inc.php | 2 +- phpgwapi/inc/class.vfs_sql.inc.php | 31 ++++++------ phpgwapi/inc/php3_support_functions.inc.php | 19 ++++++++ preferences/setup/setup.inc.php | 2 +- setup/applications.php | 11 +++-- setup/inc/class.setup.inc.php | 6 ++- setup/inc/class.setup_detection.inc.php | 17 ++++--- setup/inc/class.setup_lang.inc.php | 42 ++++++++++++---- setup/inc/class.setup_process.inc.php | 53 +++++++++++++-------- setup/index.php | 4 ++ setup/lang/phpgw_en.lang | 1 + setup/manageheader.php | 2 - 15 files changed, 152 insertions(+), 73 deletions(-) diff --git a/admin/setup/setup.inc.php b/admin/setup/setup.inc.php index 0503d84fad..4d5d73b117 100755 --- a/admin/setup/setup.inc.php +++ b/admin/setup/setup.inc.php @@ -31,6 +31,6 @@ /* Dependacies for this app to work */ $setup_info['admin']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('0.9.10', '0.9.11' , '0.9.12', '0.9.13') + 'versions' => Array('0.9.10', '0.9.11' , '0.9.12', '0.9.13', '0.9.14') ); ?> diff --git a/calendar/setup/setup.inc.php b/calendar/setup/setup.inc.php index 970743de5e..b03dd55c05 100755 --- a/calendar/setup/setup.inc.php +++ b/calendar/setup/setup.inc.php @@ -24,23 +24,21 @@ $setup_info['calendar']['tables'][] = 'phpgw_cal_alarm'; /* The hooks this app includes, needed for hooks registration */ - $setup_info['calendar']['hooks'] = array( - 'add_def_prefs', - 'admin', - 'deleteaccount', - 'email', - 'home', - 'home_day', - 'home_month', - 'home_week', - 'home_year', - 'manual', - 'preferences' - ); + $setup_info['calendar']['hooks'][] = 'add_def_prefs'; + $setup_info['calendar']['hooks'][] = 'admin'; + $setup_info['calendar']['hooks'][] = 'deleteaccount'; + $setup_info['calendar']['hooks'][] = 'email'; + $setup_info['calendar']['hooks'][] = 'home'; + $setup_info['calendar']['hooks'][] = 'home_day'; + $setup_info['calendar']['hooks'][] = 'home_month'; + $setup_info['calendar']['hooks'][] = 'home_week'; + $setup_info['calendar']['hooks'][] = 'home_year'; + $setup_info['calendar']['hooks'][] = 'manual'; + $setup_info['calendar']['hooks'][] = 'preferences'; /* Dependencies for this app to work */ $setup_info['calendar']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('0.9.10', '0.9.11' , '0.9.12', '0.9.13') + 'versions' => Array('0.9.10', '0.9.11' , '0.9.12', '0.9.13', '0.9.14') ); ?> diff --git a/filemanager/setup/setup.inc.php b/filemanager/setup/setup.inc.php index ab00ef4f82..2d80fa6a5a 100755 --- a/filemanager/setup/setup.inc.php +++ b/filemanager/setup/setup.inc.php @@ -18,11 +18,14 @@ $setup_info['phpwebhosting']['enable'] = 1; /* The hooks this app includes, needed for hooks registration */ - $setup_info['phpwebhosting']['hooks'] = array ('add_def_pref', 'admin', 'deleteaccount', 'preferences'); + $setup_info['phpwebhosting']['hooks'][] = 'add_def_pref'; + $setup_info['phpwebhosting']['hooks'][] = 'admin'; + $setup_info['phpwebhosting']['hooks'][] = 'deleteaccount'; + $setup_info['phpwebhosting']['hooks'][] = 'preferences'; /* Dependencies for this app to work */ $setup_info['phpwebhosting']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => array('0.9.10', '0.9.11' , '0.9.12', '0.9.13') + 'versions' => array('0.9.10', '0.9.11' , '0.9.12', '0.9.13', '0.9.14') ); ?> diff --git a/infolog/setup/setup.inc.php b/infolog/setup/setup.inc.php index 8568df5cfa..8b52b00941 100755 --- a/infolog/setup/setup.inc.php +++ b/infolog/setup/setup.inc.php @@ -28,6 +28,6 @@ /* Dependacies for this app to work */ $setup_info['infolog']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('0.9.13') + 'versions' => Array('0.9.13', '0.9.14') ); ?> diff --git a/phpgwapi/inc/class.vfs_sql.inc.php b/phpgwapi/inc/class.vfs_sql.inc.php index 537605b2b5..d6eac01703 100644 --- a/phpgwapi/inc/class.vfs_sql.inc.php +++ b/phpgwapi/inc/class.vfs_sql.inc.php @@ -1415,7 +1415,7 @@ while (list ($num, $entry) = each ($ls)) { $newdir = ereg_replace ("^$f->fake_full_path", "$t->fake_full_path", $entry['directory']); - $this->mkdir ("$newdir/$entry[name]", array ($t->mask)); + $this->mkdir ($newdir.'/'.$entry['name'], array ($t->mask)); } /* Lastly, we copy the files over */ @@ -1972,19 +1972,24 @@ if ($p->fake_leading_dirs != $this->fakebase && $p->fake_leading_dirs != '/') { $ls_array = $this->ls ($string, array ($relatives[0]), False, False, True); - $this->set_attributes ($string, array ($relatives[0]), array ('owner_id' => $ls_array[0]['owner_id'])); - return True; + $var = Array( + 'owner_id' => $ls_array[0]['owner_id'] + ); } elseif (preg_match ("+^$this->fakebase\/(.*)$+U", $p->fake_full_path, $matches)) { - $this->set_attributes ($string, array ($relatives[0]), array ('owner_id' => $GLOBALS['phpgw']->accounts->name2id ($matches[1]))); - return True; + $var = Array( + 'owner_id' => $GLOBALS['phpgw']->accounts->name2id ($matches[1]) + ); } else { - $this->set_attributes ($string, array ($relatives[0]), array ('owner_id' => 0)); - return True; + $var = Array( + 'owner_id' => 0 + ); } + $this->set_attributes ($string, array ($relatives[0]), $var); + return True; } function get_mime_type($file) @@ -2552,18 +2557,16 @@ $p2 = $this->path_parts ($file_array['directory'] . '/' . $file_array['name'], array (RELATIVE_NONE)); /* Note the mime_type. This can be "Directory", which is how we create directories */ - $set_attributes_array = array ('size' => $file_array['size'], 'mime_type' => $file_array['mime_type']); + $set_attributes_array = Array( + 'size' => $file_array['size'], + 'mime_type' => $file_array['mime_type'] + ); if (!$this->file_exists ($p2->fake_full_path, array (RELATIVE_NONE))) { $this->touch ($p2->fake_full_path, array (RELATIVE_NONE)); - - $this->set_attributes ($p2->fake_full_path, array (RELATIVE_NONE), $set_attributes_array); - } - else - { - $this->set_attributes ($p2->fake_full_path, array (RELATIVE_NONE), $set_attributes_array); } + $this->set_attributes ($p2->fake_full_path, array (RELATIVE_NONE), $set_attributes_array); } } } diff --git a/phpgwapi/inc/php3_support_functions.inc.php b/phpgwapi/inc/php3_support_functions.inc.php index 18221c8dfa..7fc9f1d1d2 100755 --- a/phpgwapi/inc/php3_support_functions.inc.php +++ b/phpgwapi/inc/php3_support_functions.inc.php @@ -248,4 +248,23 @@ } return $output; } + + function print_r($array) + { + if(gettype($array)=="array") + { + echo ''; + } + else + { + echo $array; + } + } ?> diff --git a/preferences/setup/setup.inc.php b/preferences/setup/setup.inc.php index 884d4291ec..a5195a71ef 100755 --- a/preferences/setup/setup.inc.php +++ b/preferences/setup/setup.inc.php @@ -28,6 +28,6 @@ /* Dependacies for this app to work */ $setup_info['preferences']['depends'][] = array( 'appname' => 'phpgwapi', - 'versions' => Array('0.9.10', '0.9.11' , '0.9.12', '0.9.13') + 'versions' => Array('0.9.10', '0.9.11' , '0.9.12', '0.9.13', '0.9.14') ); ?> diff --git a/setup/applications.php b/setup/applications.php index bd216e9673..52e157d25f 100644 --- a/setup/applications.php +++ b/setup/applications.php @@ -144,7 +144,7 @@ echo '
' . $setup_info[$appname]['title'] . ' ' . lang('hooks deregistered') . '.'; } - $terror = $phpgw_setup->process_drop_langs($terror); + $terror = $phpgw_setup->process_drop_langs($terror,$DEBUG); echo '
' . $setup_info[$appname]['title'] . ' ' . lang('Translations removed') . '.'; } @@ -178,7 +178,12 @@ echo '
' . $setup_info[$appname]['title'] . ' ' . lang('hooks registered') . '.'; } } - $terror = $phpgw_setup->process_add_langs($terror); + $force_en = False; + if($appname == 'phpgwapi') + { + $force_en = True; + } + $terror = $phpgw_setup->process_add_langs($terror,$DEBUG,$force_en); echo '
' . $setup_info[$appname]['title'] . ' ' . lang('Translations added') . '.'; } @@ -198,7 +203,7 @@ echo '
' . $setup_info[$appname]['title'] . ' ' . lang('upgraded') . '.'; } - $terror = $phpgw_setup->process_upgrade_langs($terror); + $terror = $phpgw_setup->process_upgrade_langs($terror,$DEBUG); echo '
' . $setup_info[$appname]['title'] . ' ' . lang('Translations upgraded') . '.'; } diff --git a/setup/inc/class.setup.inc.php b/setup/inc/class.setup.inc.php index a9a59efe4d..cae13e3b95 100644 --- a/setup/inc/class.setup.inc.php +++ b/setup/inc/class.setup.inc.php @@ -212,8 +212,10 @@ } $enable = intval($enable); - // Use old applications table if the currentver is less than 0.9.10pre8, - // but not if the currentver = '', which probably means new install. + /* + Use old applications table if the currentver is less than 0.9.10pre8, + but not if the currentver = '', which probably means new install. + */ if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != '')) { $appstbl = 'applications'; diff --git a/setup/inc/class.setup_detection.inc.php b/setup/inc/class.setup_detection.inc.php index 1f7cb9d25d..d0a245581a 100755 --- a/setup/inc/class.setup_detection.inc.php +++ b/setup/inc/class.setup_detection.inc.php @@ -34,7 +34,8 @@ } $d->close(); -// echo '
';	echo var_dump($setup_info);	echo '
'; exit; + // _debug_array($setup_info); + @ksort($setup_info); return $setup_info; } @@ -63,10 +64,14 @@ // This is to catch old setup installs that did not have phpgwapi listed as an app if (!$setup_info['phpgwapi']['currentver']) { + $tmp = $setup_info['phpgwapi']['version']; /* save the file version */ $setup_info['phpgwapi']['currentver'] = $setup_info['admin']['currentver']; + $setup_info['phpgwapi']['version'] = $setup_info['admin']['currentver']; $setup_info['phpgwapi']['enabled'] = $setup_info['admin']['enabled']; - //var_dump($setup_info['phpgwapi']);exit; + // _debug_array($setup_info['phpgwapi']);exit; + $GLOBALS['setup_info'] = $setup_info; $this->register_app('phpgwapi'); + $setup_info['phpgwapi']['version'] = $tmp; /* restore the file version */ } } elseif ($oldapps) @@ -82,7 +87,7 @@ } } } - //echo print_r($setup_info);exit; + // _debug_array($setup_info); return $setup_info; } @@ -124,7 +129,7 @@ } } } - //echo '
';	echo var_dump($setup_info);	echo '
'; + // _debug_array($setup_info); return $setup_info; } @@ -211,13 +216,13 @@ $setup_info = $GLOBALS['setup_info']; $this->db->Halt_On_Error = 'no'; - //echo '
'.var_dump($setup_info).'
';exit; + // _debug_array($setup_info); if (isset($setup_info['phpgwapi']['currentver'])) { $setup_info = $this->get_db_versions($setup_info); } - //echo '
'.var_dump($setup_info).'
';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 @@ Sessions Type