]>
git.agnieray.net Git - galette.git/blob - galette/install/steps/db_checks.php
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
6 * Galette installation, database checks 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
33 * @link http://galette.tuxfamily.org
34 * @since Available since 0.8 - 2013-01-11
37 use Galette\Core\Install
as GaletteInstall
;
38 use Galette\Core\Db
as GaletteDb
;
41 $db_connected = $install->testDbConnexion();
42 } catch (Throwable
$e) {
48 if (!isset($show_form)) {
52 if ($db_connected === true) {
54 $zdb = new GaletteDb();
57 /** FIXME: when tables already exists and DROP not allowed at this time
58 the showed error is about CREATE, whenever CREATE is allowed */
59 //We delete the table if exists, no error at this time
60 $zdb->dropTestTable();
62 $results = $zdb->grantCheck($install->getMode());
67 //test returned values
68 if ($results['create'] instanceof Exception
) {
70 'message' => _T("CREATE operation not allowed"),
71 'debug' => $results['create']->getMessage(),
75 } elseif ($results['create'] != '') {
77 'message' => _T("CREATE operation allowed"),
82 if ($results['insert'] instanceof Exception
) {
84 'message' => _T("INSERT operation not allowed"),
85 'debug' => $results['insert']->getMessage(),
89 } elseif ($results['insert'] != '') {
91 'message' => _T("INSERT operation allowed"),
96 if ($results['update'] instanceof Exception
) {
98 'message' => _T("UPDATE operation not allowed"),
99 'debug' => $results['update']->getMessage(),
103 } elseif ($results['update'] != '') {
105 'message' => _T("UPDATE operation allowed"),
110 if ($results['select'] instanceof Exception
) {
112 'message' => _T("SELECT operation not allowed"),
113 'debug' => $results['select']->getMessage(),
117 } elseif ($results['select'] != '') {
119 'message' => _T("SELECT operation allowed"),
124 if ($results['delete'] instanceof Exception
) {
126 'message' => _T("DELETE operation not allowed"),
127 'debug' => $results['delete']->getMessage(),
131 } elseif ($results['delete'] != '') {
133 'message' => _T("DELETE operation allowed"),
138 if ($results['drop'] instanceof Exception
) {
140 'message' => _T("DROP operation not allowed"),
141 'debug' => $results['drop']->getMessage(),
145 } elseif ($results['drop'] != '') {
147 'message' => _T("DROP operation allowed"),
152 if ($install->isUpgrade()) {
153 if ($results['alter'] instanceof Exception
) {
155 'message' => _T("ALTER operation not allowed"),
156 'debug' => $results['alter']->getMessage(),
160 } elseif ($results['alter'] != '') {
162 'message' => _T("ALTER operation allowed"),
173 <div
class="ui segment">
174 <div
class="content field">
175 <div
class="ui text container">
179 if ($db_connected === true && $permsdb_ok === true) {
180 if (!isset($install_plugin)) {
181 echo '<p class="ui green message">' . _T("Connection to database successfull") .
182 '<br/>' . _T("Permissions to database are OK.") . '</p>';
184 echo '<p class="ui green message">' . _T("Permissions to database are OK.") . '</p>';
188 if (!isset($install_plugin)) {
190 <h2
><?php
echo _T("Check of the database"); ?
></h2
>
194 if ($db_connected !== true) {
196 echo '<div class="ui red message">';
197 echo '<div class="ui small header">' . _T("Unable to connect to the database") . '</div>';
198 echo '<p>' . $db_connected->getMessage() . '</p>';
204 <p
><?php
echo _T("Database can't be reached. Please go back to enter the connection parameters again."); ?
></p
>
207 if (!isset($install_plugin)) {
209 <p
><?php
echo _T("Database exists and connection parameters are OK."); ?
></p
>
210 <h2
><?php
echo _T("Permissions on the base"); ?
></h2
>
214 echo '<div class="ui red message">';
216 if ($install->isInstall()) {
217 echo _T("GALETTE hasn't got enough permissions on the database to continue the installation.");
218 } elseif ($install->isUpgrade()) {
219 echo _T("GALETTE hasn't got enough permissions on the database to continue the update.");
227 foreach ($result as $r) {
230 <span
><?php
echo $r['message'] ?
></span
>
231 <span
><?php
echo $install->getValidationImage($r['res']); ?
></span
>
245 if (!isset($install_plugin)) {
247 <form action
="installer.php" method
="POST" class="ui form">
248 <div
class="ui mobile tablet computer reversed equal width grid">
249 <div
class="right aligned column">
250 <button type
="submit"<?php
if (!$conndb_ok ||
!$permsdb_ok) { echo ' disabled="disabled"'; } ?
> class="ui right labeled icon button"><i
class="angle double right icon"></i
> <?php
echo _T("Next step"); ?
></button
>
252 if ($conndb_ok && $permsdb_ok) {
255 <input type
="hidden" name
="install_dbperms_ok" value
="1"/>
260 <div
class="left aligned column">
261 <button type
="submit" id
="btnback" name
="stepback_btn" formnovalidate
class="ui labeled icon button"><i
class="angle double left icon"></i
> <?php
echo _T("Back"); ?
></button
>