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 clas...


From: Dave Hall
Subject: [Phpgroupware-cvs] phpgwapi/inc class.setup_detection.inc.php clas...
Date: Sun, 01 Oct 2006 13:45:44 +0000

CVSROOT:        /cvsroot/phpgwapi
Module name:    phpgwapi
Changes by:     Dave Hall <skwashd>     06/10/01 13:45:44

Modified files:
        inc            : class.setup_detection.inc.php 
                         class.setup.inc.php class.setup_process.inc.php 
                         class.setup_translation.inc.php 

Log message:
        notices and other little cleanups

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.setup_detection.inc.php?cvsroot=phpgwapi&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.setup.inc.php?cvsroot=phpgwapi&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.setup_process.inc.php?cvsroot=phpgwapi&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/class.setup_translation.inc.php?cvsroot=phpgwapi&r1=1.7&r2=1.8

Patches:
Index: class.setup_detection.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.setup_detection.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- class.setup_detection.inc.php       17 Sep 2006 04:45:44 -0000      1.14
+++ class.setup_detection.inc.php       1 Oct 2006 13:45:44 -0000       1.15
@@ -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.14 2006/09/17 
04:45:44 skwashd Exp $
+       * @version $Id: class.setup_detection.inc.php,v 1.15 2006/10/01 
13:45:44 skwashd Exp $
        */
 
        /**
@@ -165,6 +165,11 @@
                                                                                
                                                foreach($depvalue['versions'] 
as $depskey => $depsvalue)
                                                {
+                                                       if ( 
!isset($setup_info[$depvalue['appname']]['currentver']) )
+                                                       {
+                                                               
$setup_info[$depvalue['appname']]['currentver'] = null; //deals with undefined 
index notice
+                                                       }
+
                                                        $major = 
$GLOBALS['phpgw_setup']->get_major($setup_info[$depvalue['appname']]['currentver']);
                                                        if ($major == 
$depsvalue)
                                                        {
@@ -232,7 +237,8 @@
                */
                function base_install($setup_info)
                {
-                       $core_elements = array(
+                       $core_elements = array
+                       (
                                'phpgwapi' => true,
                                'admin' => true,
                                'preferences' => true
@@ -241,7 +247,8 @@
                        
                        foreach($setup_info as $key => $value)
                        {
-                               if(!$core_elements[$key])
+                               if ( !isset($core_elements[$key])
+                                       || !$core_elements[$key] )
                                {
                                        unset($setup_info[$key]);
                                }
@@ -318,7 +325,8 @@
                                /* 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__);
                                ob_end_clean();//dump the output
-                               if($GLOBALS['phpgw_setup']->db->link_id() && 
!$GLOBALS['phpgw_setup']->db->Errno)
+                               if( $GLOBALS['phpgw_setup']->db->link_id() 
+                                       && 
!isset($GLOBALS['phpgw_setup']->db->Errno) )
                                {
                                        
$GLOBALS['phpgw_setup']->db->query('DROP TABLE 
phpgw_testrights',__LINE__,__FILE__);
                                        
$GLOBALS['phpgw_info']['setup']['header_msg'] = 'Stage 3 (Install 
Applications)';
@@ -335,16 +343,13 @@
                function check_config()
                {
                        $GLOBALS['phpgw_setup']->db->Halt_On_Error = 'no';
-                       if(@$GLOBALS['phpgw_info']['setup']['stage']['db'] != 
10)
+                       if( 
!isset($GLOBALS['phpgw_info']['setup']['stage']['db'])
+                               || 
$GLOBALS['phpgw_info']['setup']['stage']['db'] != 10 )
                        {
                                return '';
                        }
 
-                       /* Since 0.9.10pre6 config table is named as 
phpgw_config */
-                       /* Support for pre 0.9.10pre6 users removed from 16+ - 
skwahd*/
-                       $config_table = 'phpgw_config';
-
-                       @$GLOBALS['phpgw_setup']->db->query("select 
config_value from $config_table 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)
@@ -362,7 +367,9 @@
                function check_lang($check = True)
                {
                        $GLOBALS['phpgw_setup']->db->Halt_On_Error = 'no';
-                       if($check && 
$GLOBALS['phpgw_info']['setup']['stage']['db'] != 10)
+                       if ( $check 
+                               && 
!isset($GLOBALS['phpgw_info']['setup']['stage']['db'])
+                               || 
$GLOBALS['phpgw_info']['setup']['stage']['db'] != 10 )
                        {
                                return '';
                        }

Index: class.setup.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.setup.inc.php,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- class.setup.inc.php 3 Sep 2006 16:55:13 -0000       1.28
+++ class.setup.inc.php 1 Oct 2006 13:45:44 -0000       1.29
@@ -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.28 2006/09/03 16:55:13 Caeies 
Exp $
+       * @version $Id: class.setup.inc.php,v 1.29 2006/10/01 13:45:44 skwashd 
Exp $
        */
 
        /**
@@ -41,8 +41,8 @@
                        $this->process   = 
createObject('phpgwapi.setup_process');
 
                        /* The setup application needs these */
-                       $this->html     = $html ? 
CreateObject('phpgwapi.setup_html') : '';
-                       $this->translation = $translation ? 
CreateObject('phpgwapi.setup_translation') : '';
+                       $this->html     = $html ? 
CreateObject('phpgwapi.setup_html') : null;
+                       $this->translation = $translation ? 
CreateObject('phpgwapi.setup_translation') : null;
                        
                        //$this->tbl_apps    = $this->get_apps_table_name();
                        //$this->tbl_config  = $this->get_config_table_name();
@@ -318,24 +318,27 @@
                                return False;
                        }
 
+                       $enable = 0;
                        if($enable==99)
                        {
-                               $enable = $setup_info[$appname]['enable'];
+                               $enable = (int) $setup_info[$appname]['enable'];
                        }
-                       $enable = intval($enable);
 
                        if($GLOBALS['DEBUG'])
                        {
                                echo '<br>register_app(): ' . $appname . ', 
version: ' . $setup_info[$appname]['version'] . ', table: 
phpgw_applications<br>';
                        }
 
+                       $tables = '';
                        if($setup_info[$appname]['version'])
                        {
-                               if($setup_info[$appname]['tables'])
+                               if ( isset($setup_info[$appname]['tables'])
+                                       && 
is_array($setup_info[$appname]['tables']) )
                                {
                                        $tables = 
implode(',',$setup_info[$appname]['tables']);
                                }
-                               if ($setup_info[$appname]['tables_use_prefix'] 
== True)
+                               if ( 
isset($setup_info[$appname]['tables_use_prefix'])
+                                       && 
$setup_info[$appname]['tables_use_prefix'] )
                                {
                                        echo $setup_info[$appname]['name'] . ' 
uses tables_use_prefix, storing ' 
                                        . $setup_info[$appname]['tables_prefix']
@@ -349,11 +352,11 @@
                                $this->db->query('INSERT INTO 
phpgw_applications '
                                        . 
'(app_name,app_enabled,app_order,app_tables,app_version) '
                                        . 'VALUES ('
-                                       . "'" . $setup_info[$appname]['name'] . 
"',"
-                                       . $enable . ","
-                                       . 
intval($setup_info[$appname]['app_order']) . ","
-                                       . "'" . $tables . "',"
-                                       . "'" . 
$setup_info[$appname]['version'] . "')"
+                                       . "'{$setup_info[$appname]['name']}', "
+                                       . "$enable, "
+                                       . 
intval($setup_info[$appname]['app_order']) . ", "
+                                       . "'$tables', "
+                                       . 
"'{$setup_info[$appname]['version']}')"
                                        ,__LINE__,__FILE__
                                );
                                $this->clear_session_cache();
@@ -447,17 +450,19 @@
                        if($setup_info[$appname]['version'])
                        {
                                //echo '<br>' . 
$setup_info[$appname]['version'];
-                               if($setup_info[$appname]['tables'])
+                               $tables = '';
+                               if ( isset($setup_info[$appname]['tables'])
+                                       && 
is_array($setup_info[$appname]['tables']) )
                                {
                                        $tables = 
implode(',',$setup_info[$appname]['tables']);
                                }
 
                                $sql = "UPDATE $appstbl "
-                                       . "SET app_name='" . 
$setup_info[$appname]['name'] . "',"
+                                       . "SET 
app_name='{$setup_info[$appname]['name']}',"
                                        . " app_enabled=" . 
intval($setup_info[$appname]['enable']) . ","
                                        . " app_order=" . 
intval($setup_info[$appname]['app_order']) . ","
-                                       . " app_tables='" . $tables . "',"
-                                       . " app_version='" . 
$setup_info[$appname]['currentver'] . "'"
+                                       . " app_tables = '$tables',"
+                                       . " app_version = 
'{$setup_info[$appname]['currentver']}'"
                                        . " WHERE app_name='" . $appname . "'";
                                //echo $sql; exit;
 
@@ -535,7 +540,8 @@
                {
                        $setup_info = $GLOBALS['setup_info'];
 
-                       if(!$appname)
+                       if( !$appname
+                               || !isset($setup_info[$appname]['hooks']) )
                        {
                                return False;
                        }
@@ -551,6 +557,7 @@
                                $this->hooks = 
createObject('phpgwapi.hooks',$this->db);
                        }
                        
$this->hooks->register_hooks($appname,$setup_info[$appname]['hooks']);
+                       return true; //i suppose
                }
 
                /**

Index: class.setup_process.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.setup_process.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- class.setup_process.inc.php 3 Sep 2006 06:15:27 -0000       1.18
+++ class.setup_process.inc.php 1 Oct 2006 13:45:44 -0000       1.19
@@ -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.18 2006/09/03 06:15:27 
skwashd Exp $
+       * @version $Id: class.setup_process.inc.php,v 1.19 2006/10/01 13:45:44 
skwashd Exp $
        */
 
        /**
@@ -70,17 +70,17 @@
                                return False;
                        }
                        // Place api first
+                       $pass = array();
                        $pass['phpgwapi']               = 
$setup_info['phpgwapi'];
                        $pass['admin']                  = $setup_info['admin'];
                        $pass['preferences']    = $setup_info['preferences'];
                        $setup_info = 
$GLOBALS['phpgw_setup']->detection->get_versions($setup_info);
-                       @reset($setup_info);
 
-                       $i = 1;
                        $passed = array();
                        $passing = array();
-                       $pass_string = implode (':', $pass);
+                       $pass_string = implode (':', array_keys($pass) );
                        $passing_string = implode (':', $passing);
+                       $i = 1;
                        while(count($pass) && $pass_string != $passing_string)
                        {
                                $passing = array();
@@ -98,9 +98,13 @@
                                /* stuff the rest of the apps, but only those 
with available upgrades */
                                while(list($key,$value) = @each($setup_info))
                                {
-                                       if(($value['name'] != 'phpgwapi') && 
($value['status'] == 'U'))
-                                       {
-                                               
if(($passed[$value['name']]['status'] != 'F') && 
($passed[$value['name']]['status'] != 'C'))
+                                       if ( isset($value['name'])
+                                               && $value['name'] != 'phpgwapi'
+                                               && $value['status'] == 'U' )
+                                       {
+                                               if ( 
isset($passed[$value['name']]['status'])
+                                                       && 
$passed[$value['name']]['status'] != 'F'
+                                                       && 
$passed[$value['name']]['status'] != 'C' )
                                                {
                                                        $pass[$value['name']] = 
$setup_info[$value['name']];
                                                }
@@ -170,8 +174,8 @@
                                        _debug_array($passed);
                                        exit;
                                }
-                               $pass_string = implode (':', $pass);
-                               $passing_string = implode (':', $passing);
+                               $pass_string = implode (':', array_keys($pass) 
);
+                               $passing_string = implode (':', 
array_keys($passing) );
                        }
 
                        /* now return the list */
@@ -211,9 +215,10 @@
                        }
                        foreach($setup_info as $key => $ignored)
                        {
-                               if($setup_info[$key]['tables'])
+                               if ( isset($setup_info[$key]['tables'])
+                                       && 
is_array($setup_info[$key]['tables']) )
                                {
-                                       while(list($a,$table) = 
@each($setup_info[$key]['tables']))
+                                       foreach ( $setup_info[$key]['tables'] 
as $table )
                                        {
                                                //echo $table;
                                                if(in_array($table,$tables))
@@ -253,7 +258,7 @@
                        {
                                $enabled = False;
                                $appname  = $setup_info[$key]['name'];
-                               $apptitle = $setup_info[$key]['title'];
+                               $apptitle = isset($setup_info[$key]['title']) ? 
$setup_info[$key]['title'] : '';
 
                                if($DEBUG) { echo '<br>process->current(): 
Incoming status: ' . $appname . ',status: '. $setup_info[$key]['status']; }
 
@@ -294,7 +299,8 @@
                                         A manual sql script install is needed, 
but we do add the hooks
                                        */
                                        $enabled = 99;
-                                       if($setup_info[$key]['tables'][0] != '')
+                                       if ( 
isset($setup_info[$key]['tables'][0])
+                                               && 
$setup_info[$key]['tables'][0] != '' )
                                        {
                                                $enabled = False;
                                        }
@@ -547,10 +553,11 @@
 
                                /* if upgrade required, or if we are running 
again after an upgrade or dependency failure */
                                if($DEBUG) { echo '<br>process->upgrade(): 
Incoming : appname: '.$setup_info[$key]['name'] . ' status: ' . 
$setup_info[$key]['status']; }
-                               if($setup_info[$key]['status'] == 'U' ||
-                                       $setup_info[$key]['status'] == 'D' ||
-                                       $setup_info[$key]['status'] == 'V' ||
-                                       $setup_info[$key]['status'] == '') // 
TODO this is not getting set for api upgrade, sometimes ???
+                               if ( isset($setup_info[$key]['status'])
+                                       && ($setup_info[$key]['status'] == 'U'
+                                               || $setup_info[$key]['status'] 
== 'D'
+                                               || $setup_info[$key]['status'] 
== 'V'
+                                               || $setup_info[$key]['status'] 
== '' ) ) // TODO this is not getting set for api upgrade, sometimes ???
                                {
                                        $appname    = $setup_info[$key]['name'];
                                        $apptitle   = 
isset($setup_info[$key]['title']) ? $setup_info[$key]['title'] : '';

Index: class.setup_translation.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/class.setup_translation.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- class.setup_translation.inc.php     3 Sep 2006 06:15:27 -0000       1.7
+++ class.setup_translation.inc.php     1 Oct 2006 13:45:44 -0000       1.8
@@ -7,7 +7,7 @@
        * @license http://www.fsf.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage application
-       * @version $Id: class.setup_translation.inc.php,v 1.7 2006/09/03 
06:15:27 skwashd Exp $
+       * @version $Id: class.setup_translation.inc.php,v 1.8 2006/10/01 
13:45:44 skwashd Exp $
        */
 
        if (!defined('MAX_MESSAGE_ID_LENGTH'))
@@ -192,9 +192,14 @@
                                        }
                                        $raw_file = file($appfile);
 
-                                       while (list($null,$line) = 
@each($raw_file))
+                                       foreach ( $raw_file as $line ) 
                                        {
                                                
list($message_id,$app_name,$GLOBALS['phpgw_setup']->db_lang,$content) = 
explode("\t",$line);
+                                               if ( !strlen($content) )
+                                               {
+                                                       echo "ERROR: Invalid 
translation entry: '$line'\n in 
/path/to/phpgroupware/$appname/setup/phpgw_$lang.lang<br>\n";
+                                               }
+
                                                $message_id = 
$GLOBALS['phpgw_setup']->db->db_addslashes(chop(substr($message_id,0,MAX_MESSAGE_ID_LENGTH)));
                                                /* echo '<br>APPNAME:' . 
$app_name . ' PHRASE:' . $message_id; */
                                                $app_name   = 
$GLOBALS['phpgw_setup']->db->db_addslashes(chop($app_name));




reply via email to

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