]>
git.agnieray.net Git - galette.git/blob - galette/install/steps/db.php
9d730f9e9b2c887572acfd177aaac622c5328090
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
6 * Galette installation, database step
10 * Copyright © 2013-2014 The Galette Team
12 * This file is part of Galette (http://galette.tuxfamily.org).
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2013-2014 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
34 * @link http://galette.tuxfamily.org
35 * @since Available since 0.8 - 2013-01-09
38 use Galette\Core\Install
as GaletteInstall
;
39 use Galette\Core\Db
as GaletteDb
;
41 < h2
>< ?php
echo _T ( "Database" ); ?
></ h2
>
44 if ( $install -> getMode () === GaletteInstall
:: INSTALL
) {
45 echo _T ( "If it hadn't been made, create a database and a user for Galette." );
47 if ( $install -> isUpgrade ()) {
48 echo _T ( "Enter connection data for the existing database." );
49 $install -> loadExistingConfig ( $_POST , $error_detected );
51 if ( file_exists ( GALETTE_CONFIG_PATH
. 'config.inc.php' )) {
52 echo '<div id="warningbox">' . _T ( "It seems that you have already installed Galette once.<br/>All existing data will be removed if you keep going on using existing database!" ) . "</div>" ;
56 //define default database port
57 $default_dbport = GaletteDb
:: MYSQL_DEFAULT_PORT
;
58 if (! isset ( $_POST [ 'install_dbtype' ]) ||
$_POST [ 'install_dbtype' ] == 'mysql' ) {
59 $default_dbport = GaletteDb
:: MYSQL_DEFAULT_PORT
;
60 } elseif ( $_POST [ 'install_dbtype' ] == 'pgsql' ) {
61 $default_dbport = GaletteDb
:: PGSQL_DEFAULT_PORT
;
64 < ?php
echo _T ( "The needed permissions are CREATE, DROP, DELETE, UPDATE, SELECT and INSERT." ); ?
></ p
>
65 < form action
= "installer.php" method
= "post" >
66 < fieldset
class = "cssform" >
67 < legend
class = "ui-state-active ui-corner-top" >< ?php
echo _T ( "Database" ); ?
></ legend
>
69 < label
class = "bline" for = "install_dbtype" >< ?php
echo _T ( "Database type:" ); ?
></ label
>
70 < select name
= "install_dbtype" id
= "install_dbtype" >
71 < option value
= "mysql" < ?php
if ( $install -> getDbType () === GaletteDb
:: MYSQL
) { echo ' selected="selected"' ;} ?
>> Mysql
</ option
>
72 < option value
= "pgsql" < ?php
if ( $install -> getDbType () === GaletteDb
:: PGSQL
) { echo ' selected="selected"' ;} ?
>> Postgresql
</ option
>
75 < div id
= "install_dbconfig" >
77 < label
class = "bline" for = "install_dbhost" >< ?php
echo _T ( "Host:" ); ?
></ label
>
78 < input type
= "text" name
= "install_dbhost" id
= "install_dbhost" value
= "<?php echo ( $install ->getDbHost() !== null)? $install ->getDbHost():'localhost'; ?>" required
/>
81 < label
class = "bline" for = "install_dbport" >< ?php
echo _T ( "Port:" ); ?
></ label
>
82 < input type
= "text" name
= "install_dbport" id
= "install_dbport" value
= "<?php echo ( $install ->getDbPort() !== null)? $install ->getDbPort(): $default_dbport ; ?>" required
/>
85 < label
class = "bline" for = "install_dbuser" >< ?php
echo _T ( "User:" ); ?
></ label
>
86 < input type
= "text" name
= "install_dbuser" id
= "install_dbuser" value
= "<?php echo $install ->getDbUser(); ?>" required
/>
89 < label
class = "bline" for = "install_dbpass" >< ?php
echo _T ( "Password:" ); ?
></ label
>
90 < input type
= "password" name
= "install_dbpass" id
= "install_dbpass" value
= "" required
/>
93 < label
class = "bline" for = "install_dbname" >< ?php
echo _T ( "Database:" ); ?
></ label
>
94 < input type
= "text" name
= "install_dbname" id
= "install_dbname" value
= "<?php echo $install ->getDbName(); ?>" required
/>
97 < label
class = "bline" for = "install_dbprefix" >< ?php
echo _T ( "Table prefix:" ); ?
></ label
>
98 < input type
= "text" name
= "install_dbprefix" id
= "install_dbprefix" value
= "<?php echo ( $install ->getTablesPrefix() !== null)? $install ->getTablesPrefix():'galette_'; ?>" required
/>
101 if ( $install -> isUpgrade ()) {
102 echo '<div id="warningbox">' .
103 _T ( "(Indicate the CURRENT prefix of your Galette tables)" ) .
111 < input id
= "next_btn" type
= "submit" value
= "<?php echo _T(" Next step
"); ?>" />
112 < input type
= "submit" id
= "btnback" name
= "stepback_btn" value
= "<?php echo _T(" Back
"); ?>" formnovalidate
/>
115 < script type
= "text/javascript" >
117 $
( '#install_dbtype' ). change ( function (){
118 var _db
= $
( this
). val ();
120 if ( _db
=== 'pgsql' ) {
121 _port
= < ?php
echo GaletteDb
:: PGSQL_DEFAULT_PORT
; ?
>;
122 } else if ( _db
=== 'mysql' ) {
123 _port
= < ?php
echo GaletteDb
:: MYSQL_DEFAULT_PORT
; ?
>;
125 $
( '#install_dbport' ). val ( _port
);