phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] phpgwapi inc/class.setup_detection.inc.php inc/...


From: Dave Hall
Subject: [Phpgroupware-cvs] phpgwapi inc/class.setup_detection.inc.php inc/...
Date: Tue, 03 Oct 2006 02:55:50 +0000

CVSROOT:        /cvsroot/phpgwapi
Module name:    phpgwapi
Changes by:     Dave Hall <skwashd>     06/10/03 02:55:50

Modified files:
        inc            : class.setup_detection.inc.php 
                         class.setup.inc.php class.setup_process.inc.php 
Added files:
        templates/base/images: package-generic.png stock_database.png 

Log message:
        get setup working properly again, more notices, more fixes, slight 
improvement to applications and setup main

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.setup_detection.inc.php?cvsroot=phpgwapi&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.setup.inc.php?cvsroot=phpgwapi&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.setup_process.inc.php?cvsroot=phpgwapi&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/templates/base/images/package-generic.png?cvsroot=phpgwapi&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/templates/base/images/stock_database.png?cvsroot=phpgwapi&rev=1.1

Patches:
Index: inc/class.setup_detection.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.setup_detection.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- inc/class.setup_detection.inc.php   1 Oct 2006 13:45:44 -0000       1.15
+++ inc/class.setup_detection.inc.php   3 Oct 2006 02:55:50 -0000       1.16
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.setup_detection.inc.php,v 1.15 2006/10/01 
13:45:44 skwashd Exp $
+       * @version $Id: class.setup_detection.inc.php,v 1.16 2006/10/03 
02:55:50 skwashd Exp $
        */
 
        /**
@@ -20,13 +20,13 @@
        {
                function get_versions()
                {
-                       $d = dir(PHPGW_SERVER_ROOT);
-                       while($entry=$d->read())
+                       $d = dir( realpath(dirname(__FILE__) . '/../..') );
+                       while ( $entry = $d->read() )
                        {
-                               if(!ereg('setup',$entry) && 
is_dir(PHPGW_SERVER_ROOT . '/' . $entry))
+                               if ( $entry != 'setup' && 
is_dir(PHPGW_SERVER_ROOT . '/' . $entry))
                                {
                                        $f = PHPGW_SERVER_ROOT . '/' . $entry . 
'/setup/setup.inc.php';
-                                       if (@file_exists ($f))
+                                       if ( file_exists($f) )
                                        {
                                                include($f);
                                                $setup_info[$entry]['filename'] 
= $f;
@@ -36,7 +36,7 @@
                        $d->close();
 
                        // _debug_array($setup_info);
-                       @ksort($setup_info);
+                       ksort($setup_info);
                        return $setup_info;
                }
 
@@ -53,24 +53,26 @@
                                {
                                        $tname[] = $val;
                                }
-                               $newapps = 
in_array('phpgw_applications',$tname);
-                               $oldapps = in_array('applications',$tname);
+                               $tbl_exists = 
in_array('phpgw_applications',$tname);
                        }
 
-                       if((count($tables) > 0) && (is_array($tables)) && 
($newapps || $oldapps))
+                       if( (count($tables) > 0) && (is_array($tables)) && 
$tbl_exists )
                        {
                                /* one of these tables exists. checking for 
post/pre beta version */
-                               if($newapps)
-                               {
                                        
$GLOBALS['phpgw_setup']->db->query('SELECT * FROM 
phpgw_applications',__LINE__,__FILE__);
-                                       
while(@$GLOBALS['phpgw_setup']->db->next_record())
+                               
while($GLOBALS['phpgw_setup']->db->next_record())
                                        {
                                                
$setup_info[$GLOBALS['phpgw_setup']->db->f('app_name')]['currentver'] = 
$GLOBALS['phpgw_setup']->db->f('app_version');
                                                
$setup_info[$GLOBALS['phpgw_setup']->db->f('app_name')]['enabled'] = 
$GLOBALS['phpgw_setup']->db->f('app_enabled');
                                        }
                                        /* This is to catch old setup installs 
that did not have phpgwapi listed as an app */
-                                       $tmp = 
@$setup_info['phpgwapi']['version']; /* save the file version */
-                                       
if(address@hidden'phpgwapi']['currentver'])
+                               $tmp = null;
+                               if ( isset($setup_info['phpgwapi']['version']) )
+                               {
+                                       $tmp = 
$setup_info['phpgwapi']['version']; /* save the file version */
+                               }
+
+                               if(!$setup_info['phpgwapi']['currentver'])
                                        {
                                                
$setup_info['phpgwapi']['currentver'] = $setup_info['admin']['currentver'];
                                                
$setup_info['phpgwapi']['version'] = $setup_info['admin']['currentver'];
@@ -87,19 +89,6 @@
                                        }
                                        $setup_info['phpgwapi']['version'] = 
$tmp; /* restore the file version */
                                }
-                               elseif($oldapps)
-                               {
-                                       
$GLOBALS['phpgw_setup']->db->query('select * from 
applications',__LINE__,__FILE__);
-                                       
while(@$GLOBALS['phpgw_setup']->db->next_record())
-                                       {
-                                               
if($GLOBALS['phpgw_setup']->db->f('app_name') == 'admin')
-                                               {
-                                                       
$setup_info['phpgwapi']['currentver'] = 
$GLOBALS['phpgw_setup']->db->f('app_version');
-                                               }
-                                               
$setup_info[$GLOBALS['phpgw_setup']->db->f('app_name')]['currentver'] = 
$GLOBALS['phpgw_setup']->db->f('app_version');
-                                       }
-                               }
-                       }
                        // _debug_array($setup_info);
                        return $setup_info;
                }
@@ -245,7 +234,7 @@
                        );
                        
                        
-                       foreach($setup_info as $key => $value)
+                       foreach ( array_keys($setup_info) as $key )
                        {
                                if ( !isset($core_elements[$key])
                                        || !$core_elements[$key] )
@@ -276,7 +265,9 @@
                                        
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage One (Upgrade your 
header.inc.php)';
                                        return 3;
                                }
-                               elseif 
(@$GLOBALS['phpgw_info']['server']['versions']['header'] != 
@$GLOBALS['phpgw_info']['server']['versions']['current_header'])
+                               elseif ( 
isset($GLOBALS['phpgw_info']['server']['versions']['header']) 
+                                       && 
isset($GLOBALS['phpgw_info']['server']['versions']['current_header'])
+                                       && 
$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)';
                                        return 3;
@@ -295,7 +286,7 @@
                        // _debug_array($setup_info);
 
                        //error message supression
-                       if(! @$_POST['debug'])
+                       if( isset($GLOBALS['DEBUG']) && $GLOBALS['DEBUG'] )
                        {
                                flush(); //push what we have
                                ob_start(); //get the output
@@ -309,7 +300,8 @@
                        // _debug_array($setup_info);
                        if (isset($setup_info['phpgwapi']['currentver']))
                        {
-                               if(@$setup_info['phpgwapi']['currentver'] == 
@$setup_info['phpgwapi']['version'])
+                               if ( isset($setup_info['phpgwapi']['version'])
+                                       && 
$setup_info['phpgwapi']['currentver'] == $setup_info['phpgwapi']['version'])
                                {
                                        
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage 1 (Tables Complete)';
                                        return 10;
@@ -324,7 +316,12 @@
                        {
                                /* no tables, so checking if we can create them 
*/
                                $GLOBALS['phpgw_setup']->db->query('CREATE 
TABLE phpgw_testrights ( testfield varchar(5) NOT NULL )',__LINE__,__FILE__);
+                               
+                               if ( ob_get_contents() )
+                               {
                                ob_end_clean();//dump the output
+                               }
+                               
                                if( $GLOBALS['phpgw_setup']->db->link_id() 
                                        && 
!isset($GLOBALS['phpgw_setup']->db->Errno) )
                                {
@@ -349,7 +346,7 @@
                                return '';
                        }
 
-                       $GLOBALS['phpgw_setup']->db->query("select config_value 
from phpgw_config where config_name='freshinstall'",__LINE__,__FILE__);
+                       $GLOBALS['phpgw_setup']->db->query("SELECT config_value 
FROM phpgw_config WHERE config_name='freshinstall'",__LINE__,__FILE__);
                        $GLOBALS['phpgw_setup']->db->next_record();
                        $configed = 
$GLOBALS['phpgw_setup']->db->f('config_value');
                        if($configed)
@@ -364,12 +361,12 @@
                        }
                }
 
-               function check_lang($check = True)
+               function check_lang($check = true)
                {
                        $GLOBALS['phpgw_setup']->db->Halt_On_Error = 'no';
                        if ( $check 
-                               && 
!isset($GLOBALS['phpgw_info']['setup']['stage']['db'])
-                               || 
$GLOBALS['phpgw_info']['setup']['stage']['db'] != 10 )
+                               && 
(!isset($GLOBALS['phpgw_info']['setup']['stage']['db'])
+                                       || 
$GLOBALS['phpgw_info']['setup']['stage']['db'] != 10 ) )
                        {
                                return '';
                        }
@@ -383,10 +380,10 @@
                                $GLOBALS['setup_info'] = 
$this->get_db_versions($GLOBALS['setup_info']);
                        }
 
-                       $langtbl  = 'phpgw_lang';
-                       $languagestbl = 'phpgw_languages';
+                       $langtbl  = '';
+                       $languagestbl = '';
 
-                       $GLOBALS['phpgw_setup']->db->query($q = "SELECT 
COUNT(*) as langcount FROM $langtbl",__LINE__,__FILE__);
+                       $GLOBALS['phpgw_setup']->db->query("SELECT 
COUNT(DISTINCT lang) as langcount FROM phpgw_lang",__LINE__,__FILE__);
                        $GLOBALS['phpgw_setup']->db->next_record();
                        if($GLOBALS['phpgw_setup']->db->f('langcount') == 0)
                        {
@@ -395,14 +392,14 @@
                        }
                        else
                        {
-                               $GLOBALS['phpgw_setup']->db->query($q = "SELECT 
DISTINCT lang FROM $langtbl",__LINE__,__FILE__);
-                               
while(@$GLOBALS['phpgw_setup']->db->next_record())
+                               $GLOBALS['phpgw_setup']->db->query($q = "SELECT 
DISTINCT lang FROM phpgw_lang",__LINE__,__FILE__);
+                               
while($GLOBALS['phpgw_setup']->db->next_record())
                                {
                                        
$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."'";
+                                       $sql = "SELECT lang_name FROM 
phpgw_languages WHERE lang_id = '{$value}'";
                                        
$GLOBALS['phpgw_setup']->db->query($sql,__LINE__,__FILE__);
                                        
$GLOBALS['phpgw_setup']->db->next_record();
                                        
$GLOBALS['phpgw_info']['setup']['installed_langs'][$value] = 
$GLOBALS['phpgw_setup']->db->f('lang_name');
@@ -423,7 +420,8 @@
                        $none = 0;
                        $setup_info = $GLOBALS['setup_info'];
 
-                       if(@$setup_info[$appname]['tables'])
+                       if (isset($setup_info[$appname]['tables']) 
+                               && $setup_info[$appname]['tables'] )
                        {
                                /* Make a copy, else we send some callers into 
an infinite loop */
                                $copy = $setup_info;

Index: inc/class.setup.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.setup.inc.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- inc/class.setup.inc.php     2 Oct 2006 10:11:21 -0000       1.31
+++ inc/class.setup.inc.php     3 Oct 2006 02:55:50 -0000       1.32
@@ -9,7 +9,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.setup.inc.php,v 1.31 2006/10/02 10:11:21 skwashd 
Exp $
+       * @version $Id: class.setup.inc.php,v 1.32 2006/10/03 02:55:50 skwashd 
Exp $
        */
 
        /**
@@ -318,11 +318,14 @@
                                return False;
                        }
 
-                       $enable = 0;
-                       if($enable==99)
+                       if ( $enable == 99 )
                        {
                                $enable = (int) $setup_info[$appname]['enable'];
                        }
+                       else
+                       {
+                               $enable = 0;
+                       }
 
                        if($GLOBALS['DEBUG'])
                        {
@@ -537,12 +540,6 @@
                                return False;
                        }
 
-                       
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5') && 
($setup_info['phpgwapi']['currentver'] != ''))
-                       {
-                               /* No phpgw_hooks table yet. */
-                               return False;
-                       }
-
                        if ( !isset($this->hooks) || !is_object($this->hooks))
                        {
                                $this->hooks = 
createObject('phpgwapi.hooks',$this->db);

Index: inc/class.setup_process.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.setup_process.inc.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- inc/class.setup_process.inc.php     1 Oct 2006 13:45:44 -0000       1.19
+++ inc/class.setup_process.inc.php     3 Oct 2006 02:55:50 -0000       1.20
@@ -6,7 +6,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.setup_process.inc.php,v 1.19 2006/10/01 13:45:44 
skwashd Exp $
+       * @version $Id: class.setup_process.inc.php,v 1.20 2006/10/03 02:55:50 
skwashd Exp $
        */
 
        /**
@@ -63,7 +63,7 @@
                 * @param $DEBUG                optional, print debugging info
                 * @param $force_en     optional, install english language files
                 */
-               function 
pass($setup_info,$method='new',$DEBUG=False,$force_en=False)
+               function pass($setup_info, $method = 'new', $DEBUG = false, 
$force_en = false)
                {
                        if(!$method)
                        {
@@ -96,7 +96,7 @@
                                //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))
+                               foreach($setup_info as $key => $value)
                                {
                                        if ( isset($value['name'])
                                                && $value['name'] != 'phpgwapi'
@@ -139,12 +139,15 @@
                                }
 
                                $pass = array();
-                               @reset($passing);
-                               while(list($key,$value) = @each($passing))
+                               foreach ( $passing as $key => $value )
                                {
+                                       if ( !isset($value['name']) )
+                                       {
+                                               continue;
+                                       }
                                        if($value['status'] == 'C')
                                        {
-                                               $passed[$value['name']] = 
$passing[$value['name']];
+                                               $passed[$value['name']] = 
isset($passing[$value['name']]) ? $passing[$value['name']] : '';
                                                if($DEBUG) { echo 
'<br>process->pass(): '.$passed[$value['name']]['name'] . ' install 
completed'."\n"; }
                                        }
                                        elseif($value['status'] == 'F')
@@ -254,20 +257,22 @@
                        {
                                $setup_info = array();
                        }
-                       foreach($setup_info as $key => $ignored)
+                       foreach ( array_keys($setup_info) as $key )
                        {
                                $enabled = False;
-                               $appname  = $setup_info[$key]['name'];
+                               $appname  = isset($setup_info[$key]['name']) ? 
$setup_info[$key]['name'] : '';
                                $apptitle = isset($setup_info[$key]['title']) ? 
$setup_info[$key]['title'] : '';
 
                                if($DEBUG) { echo '<br>process->current(): 
Incoming status: ' . $appname . ',status: '. $setup_info[$key]['status']; }
 
                                $appdir  = PHPGW_SERVER_ROOT . SEP . $appname . 
SEP . 'setup' . SEP;
 
-                               if($setup_info[$key]['tables'] && 
file_exists($appdir.'tables_current.inc.php'))
+                               if ( isset($setup_info[$key]['tables']) 
+                                       && $setup_info[$key]['tables'] 
+                                       && 
file_exists("{$appdir}tables_current.inc.php") )
                                {
                                        if($DEBUG) { echo 
'<br>process->current(): Including: ' . $appdir.'tables_current.inc.php'; }
-                                       include 
($appdir.'tables_current.inc.php');
+                                       
include_once("{$appdir}tables_current.inc.php");
                                        $ret = 
$this->post_process($phpgw_baseline,$DEBUG);
                                        if($ret)
                                        {
@@ -340,12 +345,14 @@
                        {
                                $setup_info = array();
                        }
-                       foreach($setup_info as $key => $ignored)
+                       foreach ( array_keys($setup_info) as $key )
                        {
-                               $appname = $setup_info[$key]['name'];
+                               $appname = isset($setup_info[$key]['name']) ? 
$setup_info[$key]['name'] : '';
                                $appdir  = PHPGW_SERVER_ROOT . SEP . $appname . 
SEP . 'setup' . SEP;
 
-                               if($setup_info[$key]['tables'] && 
file_exists($appdir.'default_records.inc.php'))
+                               if( isset($setup_info[$key]['tables'])
+                                       && $setup_info[$key]['tables']
+                                       && 
file_exists($appdir.'default_records.inc.php'))
                                {
                                        if($DEBUG)
                                        {
@@ -353,7 +360,7 @@
                                        }
                                        
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
                                        $oProc = 
&$GLOBALS['phpgw_setup']->oProc;       // to be compatible with old apps
-                                       include 
($appdir.'default_records.inc.php');
+                                       
include_once($appdir.'default_records.inc.php');
                                        
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit();
                                }
                                /* $setup_info[$key]['status'] = 'C'; */
@@ -368,20 +375,19 @@
                *
                 * @param $setup_info   array of application info from 
setup.inc.php files, etc.
                 */
-               function add_langs($setup_info,$DEBUG=False,$force_en=False)
+               function add_langs($setup_info, $DEBUG = false, $force_en = 
false)
                {
-                       @reset($setup_info);
-                       while(list($key,$null) = @each($setup_info))
+                       foreach ( array_keys($setup_info) as $key )
                        {
-                               $appname = $setup_info[$key]['name'];
-                               
$this->translation->add_langs($appname,$DEBUG,$force_en);
+                               $appname = isset($setup_info[$key]['name']) ? 
$setup_info[$key]['name'] : '';
+                               $this->translation->add_langs($appname, $DEBUG, 
$force_en);
                                if($DEBUG)
                                {
                                        echo '<br>process->add_langs(): 
Translations added for ' . $appname . "\n";
                                }
                        }
                        /* Done, return current status */
-                       return ($setup_info);
+                       return $setup_info;
                }
 
                /**
@@ -462,7 +468,7 @@
                                                echo '<br>process->test_data(): 
Including baseline test data for ' . $appname . "\n";
                                        }
                                        
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
-                                       include ($appdir.'test_data.inc.php');
+                                       
include_once($appdir.'test_data.inc.php');
                                        
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit();
                                }
                        }
@@ -498,7 +504,7 @@
                                        {
                                                echo '<br>process->baseline(): 
Including baseline tables for ' . $appname . "\n";
                                        }
-                                       include 
($appdir.'tables_baseline.inc.php');
+                                       
include_once($appdir.'tables_baseline.inc.php');
                                        
$GLOBALS['phpgw_setup']->oProc->GenerateScripts($phpgw_baseline, $DEBUG);
                                        
$this->post_process($phpgw_baseline,$DEBUG);
 
@@ -541,7 +547,8 @@
                        foreach($setup_info as $key => $ignored)
                        {
                                /* Don't try to upgrade an app that is not 
installed */
-                               
if(!$GLOBALS['phpgw_setup']->app_registered($setup_info[$key]['name']))
+                               if( !isset($setup_info[$key]['name']) 
+                                       || 
!$GLOBALS['phpgw_setup']->app_registered($setup_info[$key]['name']) )
                                {
                                        if($DEBUG)
                                        {

Index: templates/base/images/package-generic.png
===================================================================
RCS file: templates/base/images/package-generic.png
diff -N templates/base/images/package-generic.png
Binary files /dev/null and /tmp/cvsMRYJaa differ

Index: templates/base/images/stock_database.png
===================================================================
RCS file: templates/base/images/stock_database.png
diff -N templates/base/images/stock_database.png
Binary files /dev/null and /tmp/cvsdx05na differ




reply via email to

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