mailRe: [Galette-devel] [bug #18819] Modification du port de la base de donnéesà l'installation


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Loïs Taulelle on October 18, 2011 - 20:57:
Le 18/10/2011 17:15, Johan Cwiklinski a écrit :

URL:
  <http://gna.org/bugs/?18819>

Summary: Modification du port de la base de données à l'installation


Details:

Ce n'est pas possible actuellement.


J'ai fait un tour dans le brol Zend et j'ai vu que 'port' est une option
possible, dans includes/Zend-1.11.9/Zend/Db/Adapter/Abstract.php

section "Constructor"
     * Some options are used on a case-by-case basis by adapters:
     *
     * port           => (string) The port of the database


Je propose ce patch rapide (en PJ) et incomplet (je n'ai fait ue
l'installeur), à checker.

je ne suis pas sur de ma syntaxe pour (install/index.php):

 * la déclaration/affectation du port par défaut, lignes 410/411 :

<option value="mysql"<?php if ( isset($_POST['install_dbtype']) &&
$_POST['install_dbtype'] == 'mysql' ) {echo ' selected="selected"';}
$dbport == '3306'; ?>>Mysql</option>

 * l'utilisation de cette nouvelle variable dans l'inputbox, ligne 420 :
<input type="text" name="install_dbport" id="install_dbport"
value="<?php echo
(isset($_POST['install_dbport']))?$_POST['install_dbport']:'$dbport'; ?>"/>

Ça semble une bonne base de travail ? (je commite pas, c'est incomplet
et non-fonctionnel)

A+, Loïs
-- 
Quand karma faché, karma toujours faire comme ça.
Index: classes/galette-zend_db.class.php
===================================================================
--- classes/galette-zend_db.class.php   (révision 1454)
+++ classes/galette-zend_db.class.php   (copie de travail)
@@ -79,6 +79,7 @@
                 $_type,
                 array(
                     'host'     => HOST_DB,
+                    'port'     => PORT_DB,
                     'username' => USER_DB,
                     'password' => PWD_DB,
                     'dbname'   => NAME_DB
@@ -159,6 +160,7 @@
                 $_type,
                 array(
                     'host'     => $host,
+                    'port'     => $port,
                     'username' => $user,
                     'password' => $pass,
                     'dbname'   => $db
Index: install/index.php
===================================================================
--- install/index.php   (révision 1454)
+++ install/index.php   (copie de travail)
@@ -76,6 +76,7 @@
 if ( $error_detected == ''
     && isset($_POST['install_dbtype'])
     && isset($_POST['install_dbhost'])
+    && isset($_POST['install_dbport'])
     && isset($_POST['install_dbuser'])
     && isset($_POST['install_dbpass'])
     && isset($_POST['install_dbname'])
@@ -87,6 +88,9 @@
     if ( $_POST['install_dbhost'] == '' ) {
         $error_detected .= '<li>' . _T("No host") . '</li>';
     }
+    if ( $_POST['install_dbport'] == '' ) {
+        $error_detected .= '<li>' . _T("No port") . '</li>';
+    }
     if ( $_POST['install_dbuser'] == '' ) {
         $error_detected .= '<li>' . _T("No user name") . '</li>';
     }
@@ -104,6 +108,7 @@
             define('USER_DB', $_POST['install_dbuser']);
             define('PWD_DB', $_POST['install_dbpass']);
             define('HOST_DB', $_POST['install_dbhost']);
+            define('PORT_DB', $_POST['install_dbport']);
             define('NAME_DB', $_POST['install_dbname']);
 
             $zdb = new GaletteZendDb();
@@ -402,8 +407,8 @@
                     <p>
                         <label class="bline" for="install_dbtype"><?php echo 
_T("Database type:"); ?></label>
                         <select name="install_dbtype" id="install_dbtype">
-                            <option value="mysql"<?php if ( 
isset($_POST['install_dbtype']) && $_POST['install_dbtype'] == 'mysql' ) 
{echo ' selected="selected"';} ?>>Mysql</option>
-                            <option value="pgsql"<?php if ( 
isset($_POST['install_dbtype']) && $_POST['install_dbtype'] == 'pgsql' ) 
{echo ' selected="selected"';} ?>>Postgresql</option>
+                            <option value="mysql"<?php if ( 
isset($_POST['install_dbtype']) && $_POST['install_dbtype'] == 'mysql' ) 
{echo ' selected="selected"';} $dbport == '3306'; ?>>Mysql</option>
+                            <option value="pgsql"<?php if ( 
isset($_POST['install_dbtype']) && $_POST['install_dbtype'] == 'pgsql' ) 
{echo ' selected="selected"';} $dbport == '5432'; ?>>Postgresql</option>
                         </select>
                     </p>
                     <p>
@@ -411,6 +416,11 @@
                         <input type="text" name="install_dbhost" 
id="install_dbhost" value="<?php echo 
(isset($_POST['install_dbhost']))?$_POST['install_dbhost']:'localhost'; ?>"/>
                     </p>
                     <p>
+                        <label class="bline" for="install_dbport"><?php echo 
_T("Port:"); ?></label>
+                        <input type="text" name="install_dbport" 
id="install_dbport" value="<?php echo 
(isset($_POST['install_dbport']))?$_POST['install_dbport']:'$dbport'; ?>"/>
+                    </p>
+
+                    <p>
                         <label class="bline" for="install_dbuser"><?php echo 
_T("User:"); ?></label>
                         <input type="text" name="install_dbuser" 
id="install_dbuser" value="<?php if(isset($_POST['install_dbuser'])) echo 
$_POST['install_dbuser']; ?>"/>
                     </p>
@@ -456,6 +466,7 @@
         $_POST['install_dbuser'],
         $_POST['install_dbpass'],
         $_POST['install_dbhost'],
+        $_POST['install_dbport'],
         $_POST['install_dbname']);
 
     if ( $test === true ) {
@@ -479,6 +490,7 @@
                     <input type="hidden" name="install_dbko" value="1"/>
                     <input type="hidden" name="install_dbtype" value="<?php 
echo $_POST['install_dbtype']; ?>"/>
                     <input type="hidden" name="install_dbhost" value="<?php 
echo $_POST['install_dbhost']; ?>"/>
+                    <input type="hidden" name="install_dbport" value="<?php 
echo $_POST['install_dbport']; ?>"/>
                     <input type="hidden" name="install_dbuser" value="<?php 
echo $_POST['install_dbuser']; ?>"/>
                     <input type="hidden" name="install_dbpass" value="<?php 
echo $_POST['install_dbpass']; ?>"/>
                     <input type="hidden" name="install_dbname" value="<?php 
echo $_POST['install_dbname']; ?>"/>
@@ -496,6 +508,7 @@
                     <input type="hidden" name="install_permsok" value="1"/>
                     <input type="hidden" name="install_dbtype" value="<?php 
echo $_POST['install_dbtype']; ?>"/>
                     <input type="hidden" name="install_dbhost" value="<?php 
echo $_POST['install_dbhost']; ?>"/>
+                    <input type="hidden" name="install_dbport" value="<?php 
echo $_POST['install_dbport']; ?>"/>
                     <input type="hidden" name="install_dbuser" value="<?php 
echo $_POST['install_dbuser']; ?>"/>
                     <input type="hidden" name="install_dbpass" value="<?php 
echo $_POST['install_dbpass']; ?>"/>
                     <input type="hidden" name="install_dbname" value="<?php 
echo $_POST['install_dbname']; ?>"/>
@@ -597,6 +610,7 @@
                     <input type="hidden" name="install_permsok" value="1"/>
                     <input type="hidden" name="install_dbtype" value="<?php 
echo $_POST['install_dbtype']; ?>"/>
                     <input type="hidden" name="install_dbhost" value="<?php 
echo $_POST['install_dbhost']; ?>"/>
+                    <input type="hidden" name="install_dbport" value="<?php 
echo $_POST['install_dbport']; ?>"/>
                     <input type="hidden" name="install_dbuser" value="<?php 
echo $_POST['install_dbuser']; ?>"/>
                     <input type="hidden" name="install_dbpass" value="<?php 
echo $_POST['install_dbpass']; ?>"/>
                     <input type="hidden" name="install_dbname" value="<?php 
echo $_POST['install_dbname']; ?>"/>
@@ -616,6 +630,7 @@
                     <input type="hidden" name="install_permsok" value="1"/>
                     <input type="hidden" name="install_dbtype" value="<?php 
echo $_POST['install_dbtype']; ?>"/>
                     <input type="hidden" name="install_dbhost" value="<?php 
echo $_POST['install_dbhost']; ?>"/>
+                    <input type="hidden" name="install_dbport" value="<?php 
echo $_POST['install_dbport']; ?>"/>
                     <input type="hidden" name="install_dbuser" value="<?php 
echo $_POST['install_dbuser']; ?>"/>
                     <input type="hidden" name="install_dbpass" value="<?php 
echo $_POST['install_dbpass']; ?>"/>
                     <input type="hidden" name="install_dbname" value="<?php 
echo $_POST['install_dbname']; ?>"/>
@@ -815,6 +830,7 @@
                     <input type="hidden" name="install_permsok" value="1"/>
                     <input type="hidden" name="install_dbtype" value="<?php 
echo $_POST['install_dbtype']; ?>"/>
                     <input type="hidden" name="install_dbhost" value="<?php 
echo $_POST['install_dbhost']; ?>"/>
+                    <input type="hidden" name="install_dbport" value="<?php 
echo $_POST['install_dbport']; ?>"/>
                     <input type="hidden" name="install_dbuser" value="<?php 
echo $_POST['install_dbuser']; ?>"/>
                     <input type="hidden" name="install_dbpass" value="<?php 
echo $_POST['install_dbpass']; ?>"/>
                     <input type="hidden" name="install_dbname" value="<?php 
echo $_POST['install_dbname']; ?>"/>
@@ -836,6 +852,7 @@
                     <input type="hidden" name="install_permsok" value="1"/>
                     <input type="hidden" name="install_dbtype" value="<?php 
echo $_POST['install_dbtype']; ?>"/>
                     <input type="hidden" name="install_dbhost" value="<?php 
echo $_POST['install_dbhost']; ?>"/>
+                    <input type="hidden" name="install_dbport" value="<?php 
echo $_POST['install_dbport']; ?>"/>
                     <input type="hidden" name="install_dbuser" value="<?php 
echo $_POST['install_dbuser']; ?>"/>
                     <input type="hidden" name="install_dbpass" value="<?php 
echo $_POST['install_dbpass']; ?>"/>
                     <input type="hidden" name="install_dbname" value="<?php 
echo $_POST['install_dbname']; ?>"/>
@@ -882,6 +899,7 @@
                     <input type="hidden" name="install_permsok" value="1"/>
                     <input type="hidden" name="install_dbtype" value="<?php 
echo $_POST['install_dbtype']; ?>"/>
                     <input type="hidden" name="install_dbhost" value="<?php 
echo $_POST['install_dbhost']; ?>"/>
+                    <input type="hidden" name="install_dbport" value="<?php 
echo $_POST['install_dbport']; ?>"/>
                     <input type="hidden" name="install_dbuser" value="<?php 
echo $_POST['install_dbuser']; ?>"/>
                     <input type="hidden" name="install_dbpass" value="<?php 
echo $_POST['install_dbpass']; ?>"/>
                     <input type="hidden" name="install_dbname" value="<?php 
echo $_POST['install_dbname']; ?>"/>
@@ -914,6 +932,7 @@
         $data = '<?php
 define("TYPE_DB", "' . $_POST['install_dbtype'] . '");
 define("HOST_DB", "' . $_POST['install_dbhost'] . '");
+define("PORT_DB", "' . $_POST['install_dbport'] . '");
 define("USER_DB", "' . $_POST['install_dbuser'] . '");
 define("PWD_DB", "' . $_POST['install_dbpass'] . '");
 define("NAME_DB", "' . $_POST['install_dbname'] . '");
@@ -999,6 +1018,7 @@
                     <input type="hidden" name="install_permsok" value="1"/>
                     <input type="hidden" name="install_dbtype" value="<?php 
echo $_POST['install_dbtype']; ?>"/>
                     <input type="hidden" name="install_dbhost" value="<?php 
echo $_POST['install_dbhost']; ?>"/>
+                    <input type="hidden" name="install_dbport" value="<?php 
echo $_POST['install_dbport']; ?>"/>
                     <input type="hidden" name="install_dbuser" value="<?php 
echo $_POST['install_dbuser']; ?>"/>
                     <input type="hidden" name="install_dbpass" value="<?php 
echo $_POST['install_dbpass']; ?>"/>
                     <input type="hidden" name="install_dbname" value="<?php 
echo $_POST['install_dbname']; ?>"/>
@@ -1028,6 +1048,7 @@
                     <input type="hidden" name="install_permsok" value="1"/>
                     <input type="hidden" name="install_dbtype" value="<?php 
echo $_POST["install_dbtype"]; ?>"/>
                     <input type="hidden" name="install_dbhost" value="<?php 
echo $_POST["install_dbhost"]; ?>"/>
+                    <input type="hidden" name="install_dbport" value="<?php 
echo $_POST["install_dbport"]; ?>"/>
                     <input type="hidden" name="install_dbuser" value="<?php 
echo $_POST["install_dbuser"]; ?>"/>
                     <input type="hidden" name="install_dbpass" value="<?php 
echo $_POST["install_dbpass"]; ?>"/>
                     <input type="hidden" name="install_dbname" value="<?php 
echo $_POST["install_dbname"]; ?>"/>

Related Messages


Powered by MHonArc, Updated Tue Oct 18 21:20:07 2011