phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: phpgwapi/inc class.setup.inc.php, 1.15.2.6, 1.15


From: Dave Hall <address@hidden>
Subject: [Phpgroupware-cvs] CVS: phpgwapi/inc class.setup.inc.php, 1.15.2.6, 1.15.2.7 class.setup_detection.inc.php, 1.6.2.2, 1.6.2.3
Date: Tue, 15 Jul 2003 22:52:22 -0400

Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv10396

Modified Files:
      Tag: Version-0_9_16-branch
        class.setup.inc.php class.setup_detection.inc.php 
Log Message:
code cleanup

Index: class.setup.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.setup.inc.php,v
retrieving revision 1.15.2.6
retrieving revision 1.15.2.7
diff -C2 -r1.15.2.6 -r1.15.2.7
*** class.setup.inc.php 27 Jun 2003 07:28:19 -0000      1.15.2.6
--- class.setup.inc.php 16 Jul 2003 02:52:19 -0000      1.15.2.7
***************
*** 1,16 ****
  <?php
    /**************************************************************************\
!   * phpGroupWare - Setup                                                     *
!   * http://www.phpgroupware.org                                              *
!   * --------------------------------------------                             *
!   * This file written by Joseph Engo<address@hidden>                 *
!   *  and Dan Kuykendall<address@hidden>                             *
!   *  and Mark Peters<address@hidden>                               *
!   *  and Miles Lott<address@hidden>                                *
!   * --------------------------------------------                             *
    *  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   *
    *  Free Software Foundation; either version 2 of the License, or (at your  *
!   *  option) any later version.                                              *
    \**************************************************************************/
  
--- 1,16 ----
  <?php
    /**************************************************************************\
!   * phpGroupWare - Setup                                                  *
!   * http://www.phpgroupware.org                                            *
!   * --------------------------------------------                          *
!   * This file written by Joseph Engo<address@hidden>          *
!   *  and Dan Kuykendall<address@hidden>                           *
!   *  and Mark Peters<address@hidden>                        *
!   *  and Miles Lott<address@hidden>                           *
!   * --------------------------------------------                          *
    *  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   *
    *  Free Software Foundation; either version 2 of the License, or (at your  *
!   *  option) any later version.                                            *
    \**************************************************************************/
  
***************
*** 27,30 ****
--- 27,35 ----
                var $html = '';
                var $appreg = '';
+       
+       /* table name vars */
+       var $tbl_apps;
+       var $tbl_config;
+       var $tbl_hooks;
  
                function setup($html=False, $translation=False)
***************
*** 35,40 ****
  
                        /* The setup application needs these */
!                       $this->html        = $html ? 
CreateObject('phpgwapi.setup_html') : '';
                        $this->translation = $translation ? 
CreateObject('phpgwapi.setup_translation') : '';
                }
  
--- 40,49 ----
  
                        /* The setup application needs these */
!                       $this->html     = $html ? 
CreateObject('phpgwapi.setup_html') : '';
                        $this->translation = $translation ? 
CreateObject('phpgwapi.setup_translation') : '';
+                 
+ //                $this->tbl_apps    = $this->get_apps_table_name();
+ //                $this->tbl_config  = $this->get_config_table_name();
+                 $this->tbl_hooks   = $this->get_hooks_table_name();
                }
  
***************
*** 55,59 ****
                        $GLOBALS['phpgw_info']['server']['db_type'] = 
$GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_type'];
  
!                       $this->db           = CreateObject('phpgwapi.db');
                        $this->db->Host     = 
$GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_host'];
                        $this->db->Type     = 
$GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_type'];
--- 64,68 ----
                        $GLOBALS['phpgw_info']['server']['db_type'] = 
$GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_type'];
  
!                       $this->db         = CreateObject('phpgwapi.db');
                        $this->db->Host     = 
$GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_host'];
                        $this->db->Type     = 
$GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_type'];
***************
*** 265,269 ****
                        }
                        
!                       $version = ereg_replace('pre','.',$versionstring);
                        $varray  = explode('.',$version);
                        $major   = 
implode('.',array($varray[0],$varray[1],$varray[2]));
--- 274,278 ----
                        }
                        
!                       $version = str_replace('pre','.',$versionstring);
                        $varray  = explode('.',$version);
                        $major   = 
implode('.',array($varray[0],$varray[1],$varray[2]));
***************
*** 281,285 ****
                        $tables = Array();
                        $tablenames = $this->db->table_names();
!                       while(list($key,$val) = @each($tablenames))
                        {
                                $tables[] = $val['table_name'];
--- 290,294 ----
                        $tables = Array();
                        $tablenames = $this->db->table_names();
!                       foreach($tablenames as $key => $val)
                        {
                                $tables[] = $val['table_name'];
***************
*** 316,321 ****
  
                        /*
!                        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'] != ''))
--- 325,330 ----
  
                        /*
!                       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'] != ''))
***************
*** 346,352 ****
                                if ($setup_info[$appname]['tables_use_prefix'] 
== True)
                                {
!                                       echo "tables_use_prefix turned on, 
Storing".$setup_info[$appname]['tables_prefix']
!                                               ." as prefix for 
".$setup_info[$appname]['name']." tables\n";
!                                                                               
                                                                         
                                        $sql = "INSERT INTO phpgw_config 
(config_app,config_name,config_value) "
                                                ."VALUES 
('".$setup_info[$appname]['name']."','"
--- 355,362 ----
                                if ($setup_info[$appname]['tables_use_prefix'] 
== True)
                                {
!                                       echo $setup_info[$appname]['name'] . ' 
uses tables_use_prefix, storing ' 
!                                       . $setup_info[$appname]['tables_prefix']
!                                               . ' as prefix for ' . 
$setup_info[$appname]['name'] . " tables\n";
!                                                                               
                                                                        
                                        $sql = "INSERT INTO phpgw_config 
(config_app,config_name,config_value) "
                                                ."VALUES 
('".$setup_info[$appname]['name']."','"
***************
*** 614,622 ****
  
                /*!
!                 @function hook
!                 @abstract call the hooks for a single application
!                 @param $location hook location - required
!                 @param $appname application name - optional
!                */
                function hook($location, $appname='')
                {
--- 624,632 ----
  
                /*!
!                @function hook
!                @abstract call the hooks for a single application
!                @param $location hook location - required
!                @param $appname application name - optional
!               */
                function hook($location, $appname='')
                {
***************
*** 797,800 ****
--- 807,821 ----
                        }
                }
+       
+        
+        function get_hooks_table_name()
+        {
+                       
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5') && 
($setup_info['phpgwapi']['currentver'] != ''))
+                       {
+                               /* No phpgw_hooks table yet. */
+                               return False;
+                       }
+                 return 'phpgw_hooks';
+        }
        }
  ?>

Index: class.setup_detection.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.setup_detection.inc.php,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -C2 -r1.6.2.2 -r1.6.2.3
*** class.setup_detection.inc.php       2 Apr 2003 16:56:58 -0000       1.6.2.2
--- class.setup_detection.inc.php       16 Jul 2003 02:52:19 -0000      1.6.2.3
***************
*** 44,48 ****
                        $GLOBALS['phpgw_setup']->db->Halt_On_Error = 'no';
                        $tables = $GLOBALS['phpgw_setup']->db->table_names();
!                       while(list($key,$val) = @each($tables))
                        {
                                $tname[] = $val['table_name'];
--- 44,48 ----
                        $GLOBALS['phpgw_setup']->db->Halt_On_Error = 'no';
                        $tables = $GLOBALS['phpgw_setup']->db->table_names();
!                       foreach($tables as $key => $val)
                        {
                                $tname[] = $val['table_name'];
***************
*** 51,55 ****
                        $oldapps = in_array('applications',$tname);
  
!                       if((is_array($tables)) && (count($tables) > 0) && 
($newapps || $oldapps))
                        {
                                /* one of these tables exists. checking for 
post/pre beta version */
--- 51,55 ----
                        $oldapps = in_array('applications',$tname);
  
!                       if((count($tables) > 0) && (is_array($tables)) && 
($newapps || $oldapps))
                        {
                                /* one of these tables exists. checking for 
post/pre beta version */
***************
*** 70,75 ****
                                                
$setup_info['phpgwapi']['enabled'] = $setup_info['admin']['enabled'];
                                                // 
_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['phpgw_setup']->register_app('phpgwapi');
--- 70,75 ----
                                                
$setup_info['phpgwapi']['enabled'] = $setup_info['admin']['enabled'];
                                                // 
_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['phpgw_setup']->register_app('phpgwapi');
***************
*** 110,130 ****
                function compare_versions($setup_info)
                {
!                       reset ($setup_info);
!                       while(list($key, $value) = each($setup_info))
                        {
!                               //echo 
'<br>'.$setup_info[$key]['name'].'STATUS: '.$setup_info[$key]['status'];
                                /* 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]['currentver'] > 
$setup_info[$key]['version'])
!                                       
if($GLOBALS['phpgw_setup']->amorethanb($setup_info[$key]['currentver'],@$setup_info[$key]['version']))
                                        {
                                                $setup_info[$key]['status'] = 
'V';
                                        }
!                                       elseif(@$setup_info[$key]['currentver'] 
== @$setup_info[$key]['version'])
                                        {
                                                $setup_info[$key]['status'] = 
'C';
                                        }
!                                       
elseif($GLOBALS['phpgw_setup']->alessthanb(@$setup_info[$key]['currentver'],@$setup_info[$key]['version']))
                                        {
                                                $setup_info[$key]['status'] = 
'U';
--- 110,129 ----
                function compare_versions($setup_info)
                {
!                       foreach($setup_info as $key => $value)
                        {
!                               //echo '<br>'.$value['name'].'STATUS: 
'.$value['status'];
                                /* Only set this if it has not already failed 
to upgrade - Milosch */
!                               if(!( (@$value['status'] == 'F') || 
(@$value['status'] == 'C') ))
                                {
                                        //if ($setup_info[$key]['currentver'] > 
$setup_info[$key]['version'])
!                                       
if($GLOBALS['phpgw_setup']->amorethanb($value['currentver'],@$value['version']))
                                        {
                                                $setup_info[$key]['status'] = 
'V';
                                        }
!                                       elseif(@$value['currentver'] == 
@$value['version'])
                                        {
                                                $setup_info[$key]['status'] = 
'C';
                                        }
!                                       
elseif($GLOBALS['phpgw_setup']->alessthanb(@$value['currentver'],@$value['version']))
                                        {
                                                $setup_info[$key]['status'] = 
'U';
***************
*** 142,161 ****
                function check_depends($setup_info)
                {
-                       reset($setup_info);
                        /* Run the list of apps */
!                       while(list ($key, $value) = each ($setup_info))
                        {
                                /* Does this app have any depends */
                                if(isset($value['depends']))
                                {
!                                       /* If so find out which apps it depends 
on */
!                                       while(list($depkey, $depvalue) = 
each($value['depends']))
                                        {
                                                /* I set this to False until we 
find a compatible version of this app */
                                                
$setup_info['depends'][$depkey]['status'] = False;
                                                /* Now we loop thru the 
versions looking for a compatible version */
!                                               while(list ($depskey, 
$depsvalue) = each($value['depends'][$depkey]['versions']))
                                                {
!                                                       $major = 
$GLOBALS['phpgw_setup']->get_major($setup_info[$value['depends'][$depkey]['appname']]['currentver']);
                                                        if ($major == 
$depsvalue)
                                                        {
--- 141,160 ----
                function check_depends($setup_info)
                {
                        /* Run the list of apps */
!                       foreach($setup_info as $key => $value)
                        {
                                /* Does this app have any depends */
                                if(isset($value['depends']))
                                {
!                                 /* If so find out which apps it depends on */
!                                       foreach($value['depends'] as $depkey => 
$depvalue)
                                        {
                                                /* I set this to False until we 
find a compatible version of this app */
                                                
$setup_info['depends'][$depkey]['status'] = False;
                                                /* Now we loop thru the 
versions looking for a compatible version */
!                                         
!                                               foreach($depvalue['versions'] 
as $depskey => $depsvalue)
                                                {
!                                                       $major = 
$GLOBALS['phpgw_setup']->get_major($setup_info[$depvalue['appname']]['currentver']);
                                                        if ($major == 
$depsvalue)
                                                        {
***************
*** 166,170 ****
                                                                
$major_depsvalue = $GLOBALS['phpgw_setup']->get_major($depsvalue);
                                                                
list(,,,$minor_depsvalue) = explode('.',$depsvalue);
!                                                               list(,,,$minor) 
= explode('.',$setup_info[$value['depends'][$depkey]['appname']]['currentver']);
                                                                if ($major == 
$major_depsvalue && $minor <= $minor_depsvalue)
                                                                {
--- 165,169 ----
                                                                
$major_depsvalue = $GLOBALS['phpgw_setup']->get_major($depsvalue);
                                                                
list(,,,$minor_depsvalue) = explode('.',$depsvalue);
!                                                               list(,,,$minor) 
= explode('.',$setup_info[$depsvalue['appname']]['currentver']);
                                                                if ($major == 
$major_depsvalue && $minor <= $minor_depsvalue)
                                                                {
***************
*** 178,183 ****
                                         If we find one, we set the apps 
overall status as a dependency failure.
                                        */
!                                       reset($value['depends']);
!                                       while(list($depkey, $depvalue) = 
each($value['depends']))
                                        {
                                                if 
($setup_info['depends'][$depkey]['status'] == False)
--- 177,181 ----
                                         If we find one, we set the apps 
overall status as a dependency failure.
                                        */
!                                       foreach($value['depends'] as $depkey => 
$depvalue)
                                        {
                                                if 
($setup_info['depends'][$depkey]['status'] == False)
***************
*** 208,213 ****
                function upgrade_exclude($setup_info)
                {
!                       @reset ($setup_info);
!                       while(list($key,$value) = @each($setup_info))
                        {
                                if(isset($value['no_mass_update']))
--- 206,210 ----
                function upgrade_exclude($setup_info)
                {
!                       foreach($setup_info as $key => $value)
                        {
                                if(isset($value['no_mass_update']))
***************
*** 238,242 ****
                                        return '3';
                                }
!                               elseif 
($GLOBALS['phpgw_info']['server']['versions']['header'] != 
$GLOBALS['phpgw_info']['server']['versions']['current_header'])
                                {
                                        
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage One (Upgrade your 
header.inc.php)';
--- 235,239 ----
                                        return '3';
                                }
!                               elseif 
(@$GLOBALS['phpgw_info']['server']['versions']['header'] != 
@$GLOBALS['phpgw_info']['server']['versions']['current_header'])
                                {
                                        
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage One (Upgrade your 
header.inc.php)';
***************
*** 263,267 ****
                        if (isset($setup_info['phpgwapi']['currentver']))
                        {
!                               if($setup_info['phpgwapi']['currentver'] == 
$setup_info['phpgwapi']['version'])
                                {
                                        
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage 1 (Tables Complete)';
--- 260,264 ----
                        if (isset($setup_info['phpgwapi']['currentver']))
                        {
!                               if(@$setup_info['phpgwapi']['currentver'] == 
@$setup_info['phpgwapi']['version'])
                                {
                                        
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage 1 (Tables Complete)';
***************
*** 295,299 ****
                {
                        $GLOBALS['phpgw_setup']->db->Halt_On_Error = 'no';
!                       if($GLOBALS['phpgw_info']['setup']['stage']['db'] != 10)
                        {
                                return '';
--- 292,296 ----
                {
                        $GLOBALS['phpgw_setup']->db->Halt_On_Error = 'no';
!                       if(@$GLOBALS['phpgw_info']['setup']['stage']['db'] != 
10)
                        {
                                return '';
***************
*** 302,306 ****
                        /* Since 0.9.10pre6 config table is named as 
phpgw_config */
                        $config_table = 'config';
!                       $ver = 
explode('.',$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
  
                        if(ereg("([0-9]+)(pre)([0-9]+)",$ver[2],$regs))
--- 299,303 ----
                        /* Since 0.9.10pre6 config table is named as 
phpgw_config */
                        $config_table = 'config';
!                       $ver = 
explode('.',@$GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
  
                        if(ereg("([0-9]+)(pre)([0-9]+)",$ver[2],$regs))
***************
*** 361,366 ****
                                        
$GLOBALS['phpgw_info']['setup']['installed_langs'][$GLOBALS['phpgw_setup']->db->f('lang')]
 = $GLOBALS['phpgw_setup']->db->f('lang');
                                }
!                               
reset($GLOBALS['phpgw_info']['setup']['installed_langs']);
!                               while(list($key, $value) = 
each($GLOBALS['phpgw_info']['setup']['installed_langs']))
                                {
                                        $sql = "SELECT lang_name FROM 
$languagestbl WHERE lang_id = '".$value."'";
--- 358,362 ----
                                        
$GLOBALS['phpgw_info']['setup']['installed_langs'][$GLOBALS['phpgw_setup']->db->f('lang')]
 = $GLOBALS['phpgw_setup']->db->f('lang');
                                }
!                               
foreach($GLOBALS['phpgw_info']['setup']['installed_langs'] as $key => $value)
                                {
                                        $sql = "SELECT lang_name FROM 
$languagestbl WHERE lang_id = '".$value."'";
***************
*** 390,400 ****
                                $copy = $setup_info;
                                $GLOBALS['phpgw_setup']->db->Halt_On_Error = 
'no';
!                               $tablenames = 
$GLOBALS['phpgw_setup']->db->table_names();
                                $tables = Array();
!                               while(list($key,$val) = @each($tablenames))
                                {
                                        $tables[] = $val['table_name'];
                                }
!                               while(list($key,$val) = 
@each($copy[$appname]['tables']))
                                {
                                        if($GLOBALS['DEBUG'])
--- 386,396 ----
                                $copy = $setup_info;
                                $GLOBALS['phpgw_setup']->db->Halt_On_Error = 
'no';
!                               $table_names = 
$GLOBALS['phpgw_setup']->db->table_names();
                                $tables = Array();
!                               foreach($table_names as $key => $val)
                                {
                                        $tables[] = $val['table_name'];
                                }
!                               foreach($copy[$appname]['tables'] as $key => 
$val)
                                {
                                        if($GLOBALS['DEBUG'])





reply via email to

[Prev in Thread] Current Thread [Next in Thread]