Some major cleanups. Should reduce warnings by 75%. This will speed things up if the admin is logging php errors/warnings.

This commit is contained in:
skeeter 2002-02-18 16:18:34 +00:00
parent 306160dd1e
commit 532993d024
8 changed files with 88 additions and 55 deletions

View File

@ -109,13 +109,13 @@
//var_dump($setup_info);exit; //var_dump($setup_info);exit;
@ksort($setup_info); @ksort($setup_info);
if ($HTTP_POST_VARS['cancel']) if(@$HTTP_POST_VARS['cancel'])
{ {
Header("Location: index.php"); Header("Location: index.php");
exit; exit;
} }
if ($HTTP_POST_VARS['submit']) if(@$HTTP_POST_VARS['submit'])
{ {
$phpgw_setup->show_header(lang('Application Management'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]['db_type'] . ')'); $phpgw_setup->show_header(lang('Application Management'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]['db_type'] . ')');
$setup_tpl->set_var('description',lang('App install/remove/upgrade') . ':'); $setup_tpl->set_var('description',lang('App install/remove/upgrade') . ':');
@ -220,7 +220,7 @@
$phpgw_setup->show_header(lang('Application Management'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]['db_type'] . ')'); $phpgw_setup->show_header(lang('Application Management'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]['db_type'] . ')');
} }
if($HTTP_GET_VARS['detail']) if(@$HTTP_GET_VARS['detail'])
{ {
$detail = $HTTP_GET_VARS['detail']; $detail = $HTTP_GET_VARS['detail'];
@ksort($setup_info[$detail]); @ksort($setup_info[$detail]);
@ -258,7 +258,7 @@
$setup_tpl->pparse('out','footer'); $setup_tpl->pparse('out','footer');
exit; exit;
} }
elseif ($HTTP_GET_VARS['resolve']) elseif (@$HTTP_GET_VARS['resolve'])
{ {
$resolve = $HTTP_GET_VARS['resolve']; $resolve = $HTTP_GET_VARS['resolve'];
$version = $HTTP_GET_VARS['version']; $version = $HTTP_GET_VARS['version'];
@ -366,9 +366,10 @@
$setup_tpl->pparse('out','app_header'); $setup_tpl->pparse('out','app_header');
@reset ($setup_info); @reset ($setup_info);
$i = 0;
while (list ($key, $value) = each ($setup_info)) while (list ($key, $value) = each ($setup_info))
{ {
if($value['name']) if(@$value['name'])
{ {
if ($i) if ($i)
{ {
@ -379,7 +380,7 @@
$i = 1; $i = 1;
} }
$setup_tpl->set_var('apptitle',$value['title']); $setup_tpl->set_var('apptitle',$value['title']);
$setup_tpl->set_var('currentver',$value['currentver']); $setup_tpl->set_var('currentver',@$value['currentver']);
$setup_tpl->set_var('version',$value['version']); $setup_tpl->set_var('version',$value['version']);
$setup_tpl->set_var('bg_color',$bgcolor[$i]); $setup_tpl->set_var('bg_color',$bgcolor[$i]);
@ -424,7 +425,7 @@
case 'U': case 'U':
$setup_tpl->set_var('instimg','incomplete.gif'); $setup_tpl->set_var('instimg','incomplete.gif');
$setup_tpl->set_var('instalt',lang('Not Completed')); $setup_tpl->set_var('instalt',lang('Not Completed'));
if (!$value['currentver']) if (!@$value['currentver'])
{ {
if ($value['tables'] && $phpgw_setup->check_app_tables($value['name'],True)) if ($value['tables'] && $phpgw_setup->check_app_tables($value['name'],True))
{ {

View File

@ -326,7 +326,7 @@
$appstbl = 'phpgw_applications'; $appstbl = 'phpgw_applications';
} }
if($GLOBALS['DEBUG']) if(@$GLOBALS['DEBUG'])
{ {
echo '<br>app_registered(): checking ' . $appname . ', table: ' . $appstbl; echo '<br>app_registered(): checking ' . $appname . ', table: ' . $appstbl;
// _debug_array($setup_info[$appname]); // _debug_array($setup_info[$appname]);
@ -336,13 +336,13 @@
$this->db->next_record(); $this->db->next_record();
if ($this->db->f(0)) if ($this->db->f(0))
{ {
if($GLOBALS['DEBUG']) if(@$GLOBALS['DEBUG'])
{ {
echo '... app previously registered.'; echo '... app previously registered.';
} }
return True; return True;
} }
if($GLOBALS['DEBUG']) if(@$GLOBALS['DEBUG'])
{ {
echo '... app not registered'; echo '... app not registered';
} }
@ -610,11 +610,19 @@
$newa = ereg_replace('pre','.',$a); $newa = ereg_replace('pre','.',$a);
$newb = ereg_replace('pre','.',$b); $newb = ereg_replace('pre','.',$b);
$testa = explode('.',$newa); $testa = explode('.',$newa);
if(@$testa[1] == '')
{
$testa[1] = 0;
}
if(@$testa[3] == '') if(@$testa[3] == '')
{ {
$testa[3] = 0; $testa[3] = 0;
} }
$testb = explode('.',$newb); $testb = explode('.',$newb);
if(@$testb[1] == '')
{
$testb[1] = 0;
}
if(@$testb[3] == '') if(@$testb[3] == '')
{ {
$testb[3] = 0; $testb[3] = 0;
@ -696,9 +704,9 @@
$testa[3] = 0; $testa[3] = 0;
} }
$testb = explode('.',$newb); $testb = explode('.',$newb);
if($testa[3] == '') if($testb[3] == '')
{ {
$testa[3] = 0; $testb[3] = 0;
} }
$less = 0; $less = 0;

View File

@ -58,24 +58,30 @@
/* one of these tables exists. checking for post/pre beta version */ /* one of these tables exists. checking for post/pre beta version */
if ($newapps) if ($newapps)
{ {
$this->db->query('select * from phpgw_applications'); $this->db->query('select * from phpgw_applications',__LINE__,__FILE__);
while (@$this->db->next_record()) while (@$this->db->next_record())
{ {
$setup_info[$this->db->f('app_name')]['currentver'] = $this->db->f('app_version'); $setup_info[$this->db->f('app_name')]['currentver'] = $this->db->f('app_version');
$setup_info[$this->db->f('app_name')]['enabled'] = $this->db->f('app_enabled'); $setup_info[$this->db->f('app_name')]['enabled'] = $this->db->f('app_enabled');
} }
/* This is to catch old setup installs that did not have phpgwapi listed as an app */ /* 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 */
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']['currentver'] = $setup_info['admin']['currentver'];
$setup_info['phpgwapi']['version'] = $setup_info['admin']['currentver']; $setup_info['phpgwapi']['version'] = $setup_info['admin']['currentver'];
$setup_info['phpgwapi']['enabled'] = $setup_info['admin']['enabled']; $setup_info['phpgwapi']['enabled'] = $setup_info['admin']['enabled'];
// _debug_array($setup_info['phpgwapi']);exit; // _debug_array($setup_info['phpgwapi']);exit;
// There seems to be a problem here. If ['phpgwapi']['currentver'] is set,
// The GLOBALS never gets set.
$GLOBALS['setup_info'] = $setup_info; $GLOBALS['setup_info'] = $setup_info;
$this->register_app('phpgwapi'); $this->register_app('phpgwapi');
$setup_info['phpgwapi']['version'] = $tmp; /* restore the file version */
} }
else
{
$GLOBALS['setup_info'] = $setup_info;
}
$setup_info['phpgwapi']['version'] = $tmp; /* restore the file version */
} }
elseif ($oldapps) elseif ($oldapps)
{ {
@ -111,18 +117,18 @@
{ {
//echo '<br>'.$setup_info[$key]['name'].'STATUS: '.$setup_info[$key]['status']; //echo '<br>'.$setup_info[$key]['name'].'STATUS: '.$setup_info[$key]['status'];
/* Only set this if it has not already failed to upgrade - Milosch */ /* Only set this if it has not already failed to upgrade - Milosch */
if (!( ($setup_info[$key]['status'] == 'F') || ($setup_info[$key]['status'] == 'C') )) if (!( (@$setup_info[$key]['status'] == 'F') || (@$setup_info[$key]['status'] == 'C') ))
{ {
//if ($setup_info[$key]['currentver'] > $setup_info[$key]['version']) //if ($setup_info[$key]['currentver'] > $setup_info[$key]['version'])
if ($this->amorethanb($setup_info[$key]['currentver'],$setup_info[$key]['version'])) if ($this->amorethanb($setup_info[$key]['currentver'],@$setup_info[$key]['version']))
{ {
$setup_info[$key]['status'] = 'V'; $setup_info[$key]['status'] = 'V';
} }
elseif ($setup_info[$key]['currentver'] == $setup_info[$key]['version']) elseif (@$setup_info[$key]['currentver'] == @$setup_info[$key]['version'])
{ {
$setup_info[$key]['status'] = 'C'; $setup_info[$key]['status'] = 'C';
} }
elseif ($this->alessthanb($setup_info[$key]['currentver'],$setup_info[$key]['version'])) elseif ($this->alessthanb(@$setup_info[$key]['currentver'],@$setup_info[$key]['version']))
{ {
$setup_info[$key]['status'] = 'U'; $setup_info[$key]['status'] = 'U';
} }
@ -245,7 +251,7 @@
$this->db->Halt_On_Error = 'no'; $this->db->Halt_On_Error = 'no';
// _debug_array($setup_info); // _debug_array($setup_info);
if (isset($setup_info['phpgwapi']['currentver'])) if (!isset($setup_info['phpgwapi']['currentver']))
{ {
$setup_info = $this->get_db_versions($setup_info); $setup_info = $this->get_db_versions($setup_info);
} }
@ -368,9 +374,10 @@
*/ */
function check_app_tables($appname,$any=False) function check_app_tables($appname,$any=False)
{ {
$none = 0;
$setup_info = $GLOBALS['setup_info']; $setup_info = $GLOBALS['setup_info'];
if($setup_info[$appname]['tables']) if(@$setup_info[$appname]['tables'])
{ {
/* Make a copy, else we send some callers into an infinite loop */ /* Make a copy, else we send some callers into an infinite loop */
$copy = $setup_info; $copy = $setup_info;
@ -382,10 +389,16 @@
} }
while(list($key,$val) = @each($copy[$appname]['tables'])) while(list($key,$val) = @each($copy[$appname]['tables']))
{ {
if ($GLOBALS['DEBUG']) { echo '<br>check_app_tables(): Checking: ' . $appname . ',table: ' . $val; } if ($GLOBALS['DEBUG'])
{
echo '<br>check_app_tables(): Checking: ' . $appname . ',table: ' . $val;
}
if(!$this->isinarray($val,$tables)) if(!$this->isinarray($val,$tables))
{ {
if ($GLOBALS['DEBUG']) { echo '<br>check_app_tables(): ' . $val . ' missing!'; } if ($GLOBALS['DEBUG'])
{
echo '<br>check_app_tables(): ' . $val . ' missing!';
}
if (!$any) if (!$any)
{ {
return False; return False;
@ -399,7 +412,10 @@
{ {
if ($any) if ($any)
{ {
if ($GLOBALS['DEBUG']) { echo '<br>check_app_tables(): Some tables installed'; } if ($GLOBALS['DEBUG'])
{
echo '<br>check_app_tables(): Some tables installed';
}
return True; return True;
} }
} }
@ -407,12 +423,18 @@
} }
if ($none && $any) if ($none && $any)
{ {
if ($GLOBALS['DEBUG']) { echo '<br>check_app_tables(): No tables installed'; } if ($GLOBALS['DEBUG'])
{
echo '<br>check_app_tables(): No tables installed';
}
return False; return False;
} }
else else
{ {
if ($GLOBALS['DEBUG']) { echo '<br>check_app_tables(): All tables installed'; } if ($GLOBALS['DEBUG'])
{
echo '<br>check_app_tables(): All tables installed';
}
return True; return True;
} }
} }

View File

@ -37,7 +37,7 @@
{ {
$ConfigLang = @$GLOBALS['HTTP_COOKIE_VARS']['ConfigLang'] ? @$GLOBALS['HTTP_COOKIE_VARS']['ConfigLang'] : @$GLOBALS['HTTP_POST_VARS']['ConfigLang']; $ConfigLang = @$GLOBALS['HTTP_COOKIE_VARS']['ConfigLang'] ? @$GLOBALS['HTTP_COOKIE_VARS']['ConfigLang'] : @$GLOBALS['HTTP_POST_VARS']['ConfigLang'];
if($this->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.15.002')) if($this->alessthanb(@$GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.15.002'))
{ {
$this->langtbl = 'lang'; $this->langtbl = 'lang';
} }

View File

@ -736,7 +736,7 @@
@function post_process @function post_process
@abstract commit above processing to the db @abstract commit above processing to the db
*/ */
function post_process($tables,$DEBUG) function post_process($tables,$DEBUG=False)
{ {
if (!$tables) if (!$tables)
{ {

View File

@ -16,7 +16,7 @@
forward them right to index.php. Create a session for them and have a nice little intro 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) page explaining what to do from there (ie, create there own account)
*/ */
$DEBUG = False; $GLOBALS['DEBUG'] = False;
$GLOBALS['phpgw_info'] = array(); $GLOBALS['phpgw_info'] = array();
$GLOBALS['phpgw_info']['flags'] = array( $GLOBALS['phpgw_info']['flags'] = array(
@ -82,13 +82,13 @@
$setup_info = $phpgw_setup->get_versions(); $setup_info = $phpgw_setup->get_versions();
$setup_info = $phpgw_setup->get_db_versions($setup_info); $setup_info = $phpgw_setup->get_db_versions($setup_info);
$GLOBALS['phpgw_info']['setup']['stage']['db'] = $phpgw_setup->check_db(); $GLOBALS['phpgw_info']['setup']['stage']['db'] = $phpgw_setup->check_db();
if($DEBUG) if($GLOBALS['DEBUG'])
{ {
_debug_array($setup_info); _debug_array($setup_info);
} }
} }
if ($DEBUG) { echo 'Stage: ' . $GLOBALS['phpgw_info']['setup']['stage']['db']; } if ($GLOBALS['DEBUG']) { echo 'Stage: ' . $GLOBALS['phpgw_info']['setup']['stage']['db']; }
// begin DEBUG code // begin DEBUG code
//$GLOBALS['phpgw_info']['setup']['stage']['db'] = 0; //$GLOBALS['phpgw_info']['setup']['stage']['db'] = 0;
//$action = 'Upgrade'; //$action = 'Upgrade';
@ -243,13 +243,13 @@
case 'new': case 'new':
/* process all apps and langs(last param True), excluding apps with the no_mass_update flag set. */ /* process all apps and langs(last param True), excluding apps with the no_mass_update flag set. */
$setup_info = $phpgw_setup->upgrade_exclude($setup_info); $setup_info = $phpgw_setup->upgrade_exclude($setup_info);
$setup_info = $phpgw_setup->process_pass($setup_info,'new',$DEBUG,True); $setup_info = $phpgw_setup->process_pass($setup_info,'new',$GLOBALS['DEBUG'],True);
$included = True; $GLOBALS['included'] = True;
include('lang.php'); include('lang.php');
$GLOBALS['phpgw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; $GLOBALS['phpgw_info']['setup']['currentver']['phpgwapi'] = 'oldversion';
break; break;
case 'oldversion': case 'oldversion':
$setup_info = $phpgw_setup->process_pass($setup_info,'upgrade',$DEBUG); $setup_info = $phpgw_setup->process_pass($setup_info,'upgrade',$GLOBALS['DEBUG']);
$GLOBALS['phpgw_info']['setup']['currentver']['phpgwapi'] = 'oldversion'; $GLOBALS['phpgw_info']['setup']['currentver']['phpgwapi'] = 'oldversion';
break; break;
} }

View File

@ -12,7 +12,7 @@
/* $Id$ */ /* $Id$ */
$phpgw_info = array(); $phpgw_info = array();
if (!$included) if (!@$GLOBALS['included'])
{ {
$GLOBALS['phpgw_info']['flags'] = array( $GLOBALS['phpgw_info']['flags'] = array(
'noheader' => True, 'noheader' => True,
@ -32,6 +32,9 @@
include(PHPGW_API_INC.'/class.common.inc.php'); include(PHPGW_API_INC.'/class.common.inc.php');
$common = new common; $common = new common;
$newinstall = False;
// this is not used // this is not used
//$sep = $common->filesystem_separator(); //$sep = $common->filesystem_separator();
} }
@ -42,8 +45,8 @@
$submit = True; $submit = True;
} }
$setup_info = $phpgw_setup->get_versions(); $setup_info_temp = $phpgw_setup->get_versions();
$setup_info = $phpgw_setup->get_db_versions($setup_info); $setup_info = $phpgw_setup->get_db_versions($setup_info_temp);
if($phpgw_setup->alessthanb($setup_info['phpgwapi']['currentver'], '0.9.15.002')) if($phpgw_setup->alessthanb($setup_info['phpgwapi']['currentver'], '0.9.15.002'))
{ {
@ -56,7 +59,7 @@
$langstbl = 'phpgw_languages'; $langstbl = 'phpgw_languages';
} }
if ($HTTP_POST_VARS['submit']) if (@$HTTP_POST_VARS['submit'])
{ {
$lang_selected = $HTTP_POST_VARS['lang_selected']; $lang_selected = $HTTP_POST_VARS['lang_selected'];
$upgrademethod = $HTTP_POST_VARS['upgrademethod']; $upgrademethod = $HTTP_POST_VARS['upgrademethod'];
@ -65,7 +68,7 @@
{ {
if ($upgrademethod == 'dumpold') if ($upgrademethod == 'dumpold')
{ {
$phpgw_setup->db->query("DELETE FROM lang",__LINE__,__FILE__); $phpgw_setup->db->query('DELETE FROM '.$langtbl,__LINE__,__FILE__);
//echo '<br>Test: dumpold'; //echo '<br>Test: dumpold';
} }
while (list($null,$lang) = each($lang_selected)) while (list($null,$lang) = each($lang_selected))
@ -130,8 +133,8 @@
{ {
if($message_id && $content) if($message_id && $content)
{ {
// echo "<br>adding - insert into $langtbl values ('$message_id','$app_name','$phpgw_setup->db_lang','$content')"; // echo "<br>adding - insert into $langtbl(message_id,app_name,lang,content) values ('$message_id','$app_name','$phpgw_setup->db_lang','$content')";
$phpgw_setup->db->query("INSERT into $langtbl VALUES ('$message_id','$app_name','$phpgw_setup->db_lang','$content')",__LINE__,__FILE__); $phpgw_setup->db->query("INSERT into $langtbl(message_id,app_name,lang,content) VALUES ('$message_id','$app_name','$phpgw_setup->db_lang','$content')",__LINE__,__FILE__);
} }
} }
} }
@ -141,7 +144,7 @@
$phpgw_setup->db->transaction_commit(); $phpgw_setup->db->transaction_commit();
} }
if(!$included) if(!@$GLOBALS['included'])
{ {
Header('Location: index.php'); Header('Location: index.php');
exit; exit;
@ -149,13 +152,13 @@
} }
else else
{ {
if ($HTTP_POST_VARS['cancel']) if (@$HTTP_POST_VARS['cancel'])
{ {
Header('Location: index.php'); Header('Location: index.php');
exit; exit;
} }
if (!$included) if (!@$GLOBALS['included'])
{ {
$tpl_root = $phpgw_setup->setup_tpl_dir('setup'); $tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
@ -176,13 +179,12 @@
$hidden_var1 = $newinstall ? '<input type="hidden" name="newinstall" value="True">' : ''; $hidden_var1 = $newinstall ? '<input type="hidden" name="newinstall" value="True">' : '';
$select_box_desc = lang('Select which languages you would like to use'); $select_box_desc = lang('Select which languages you would like to use');
$select_box = ''; $select_box_langs = '';
$phpgw_setup->db->query("select lang_id,lang_name from $langstbl where available='Yes'"); $phpgw_setup->db->query("select lang_id,lang_name from $langstbl where available='Yes'");
while ($phpgw_setup->db->next_record()) while ($phpgw_setup->db->next_record())
{ {
$select_box_langs = $select_box_langs .=
$select_box_langs '<option value="' . $phpgw_setup->db->f('lang_id') . '">'
.'<option value="' . $phpgw_setup->db->f('lang_id') . '">'
. $phpgw_setup->db->f('lang_name') . '</option>' . $phpgw_setup->db->f('lang_name') . '</option>'
."\n"; ."\n";
} }

View File

@ -11,7 +11,7 @@
/* $Id$ */ /* $Id$ */
$DEBUG = True; $GLOBALS['DEBUG'] = True;
$phpgw_info = array(); $phpgw_info = array();
$GLOBALS['phpgw_info']['flags'] = array( $GLOBALS['phpgw_info']['flags'] = array(
@ -127,7 +127,7 @@
// Drop newest tables // Drop newest tables
$terror[$appname]['tables'] = $GLOBALS['setup_info'][$appname]['tables']; $terror[$appname]['tables'] = $GLOBALS['setup_info'][$appname]['tables'];
$GLOBALS['phpgw_setup']->process_droptables($terror,$DEBUG); $GLOBALS['phpgw_setup']->process_droptables($terror,$GLOBALS['DEBUG']);
$terror[$appname]['tables'] = array(); $terror[$appname]['tables'] = array();
// Reset tables field to baseline table names // Reset tables field to baseline table names
@ -145,13 +145,13 @@
{ {
echo '<br>Processing ' . $terror[$appname]['name'] . ' to ' . $version[$appname]; echo '<br>Processing ' . $terror[$appname]['name'] . ' to ' . $version[$appname];
$terror = $GLOBALS['phpgw_setup']->process_droptables($terror,$DEBUG); $terror = $GLOBALS['phpgw_setup']->process_droptables($terror,$GLOBALS['DEBUG']);
$GLOBALS['phpgw_setup']->deregister_app($terror[$appname]['name']); $GLOBALS['phpgw_setup']->deregister_app($terror[$appname]['name']);
$terror = $GLOBALS['phpgw_setup']->process_baseline($terror,$DEBUG); $terror = $GLOBALS['phpgw_setup']->process_baseline($terror,$GLOBALS['DEBUG']);
$terror = $GLOBALS['phpgw_setup']->process_test_data($terror,$DEBUG); $terror = $GLOBALS['phpgw_setup']->process_test_data($terror,$GLOBALS['DEBUG']);
$terror = $GLOBALS['phpgw_setup']->process_upgrade($terror,$DEBUG); $terror = $GLOBALS['phpgw_setup']->process_upgrade($terror,$GLOBALS['DEBUG']);
} }
else else
{ {