Fix old setup bug with tables_current output and extra comma

This commit is contained in:
Miles Lott 2003-11-13 12:25:56 +00:00
parent f023e56ff8
commit e5cf023559
3 changed files with 49 additions and 30 deletions

View File

@ -1,7 +1,7 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* eGroupWare - Setup *
* http://www.egroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
@ -134,7 +134,10 @@
function printout($template)
{
global $download,$appname,$table,$showall;
$download = get_var('download',array('POST','GET'));
$appname = get_var('appname',array('POST','GET'));
$table = get_var('table','GLOBALS');
$showall = get_var('showall',array('POST','GET'));
if($download)
{
@ -155,7 +158,6 @@
function download_handler($dlstring,$fn='tables_current.inc.php')
{
//include( PHPGW_SERVER_ROOT . '/phpgwapi/inc/class.browser.inc.php');
$b = CreateObject('phpgwapi.browser');
$b->content_header($fn);
echo $dlstring;
@ -182,10 +184,17 @@
$term = ',';
$dlstring .= printout('sqlheader');
$db = $GLOBALS['phpgw_setup']->db;
copyobj($GLOBALS['phpgw_setup']->db,$db);
$db->query('SHOW TABLES');
$i = 0;
$tbls = $db->num_rows();
while($db->next_record())
{
$i++;
if($i == $tbls)
{
$term = '';
}
$table = $db->f(0);
parse_vars($table,$term);
$dlstring .= printout('sqlbody');
@ -201,20 +210,23 @@
if(!$setup_info[$appname]['tables'])
{
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php';
if (file_exists ($f)) { include($f); }
if(file_exists($f))
{
include($f);
}
}
//$tables = explode(',',$setup_info[$appname]['tables']);
$tables = $setup_info[$appname]['tables'];
/* $i = 1; */
$i = 0;
$tbls = count($tables);
while(list($key,$table) = @each($tables))
{
/*
if($i == count($tables))
$i++;
if($i == $tbls)
{
$term = '';
}
*/
parse_vars($table,$term);
$dlstring .= printout('sqlbody');
/* $i++; */
@ -250,7 +262,10 @@
while($entry = $d->read())
{
$f = PHPGW_SERVER_ROOT . '/' . $entry . '/setup/setup.inc.php';
if (file_exists ($f)) { include($f); }
if(file_exists($f))
{
include($f);
}
}
while(list($key,$data) = @each($setup_info))

View File

@ -1,7 +1,7 @@
<!-- BEGIN sqlheader --><?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* eGroupWare - Setup *
* http://www.egroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
@ -19,16 +19,18 @@
/* table array for {appname} */
$phpgw_baseline = array(
<!-- END sqlheader -->
<!-- BEGIN sqlbody -->
'{table}' => array(
'fd' => array(
{arr} ){term}
{arr} ),
'pk' => array({pks}),
'fk' => array({fks}),
'ix' => array({ixs}),
'uc' => array({ucs})
){term}
<!-- END sqlbody -->
<!-- BEGIN sqlfooter -->
);
?>

View File

@ -5,16 +5,18 @@
<pre>
$phpgw_baseline = array(
<!-- END sqlheader -->
<!-- BEGIN sqlbody -->
'{table}' => array(
'fd' => array(
{arr} ){term}
{arr} ),
'pk' => array({pks}),
'fk' => array({fks}),
'ix' => array({ixs}),
'uc' => array({ucs})
){term}
<!-- END sqlbody -->
<!-- BEGIN sqlfooter -->
);
</pre>