]> git.agnieray.net Git - galette.git/blob - galette/webroot/compat_test.php
Chekc PHP version before trying to load 3rd party deps
[galette.git] / galette / webroot / compat_test.php
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 /**
6 * Compatibility tests
7 *
8 * PHP version 5
9 *
10 * Copyright © 2013-2023 The Galette Team
11 *
12 * This file is part of Galette (http://galette.tuxfamily.org).
13 *
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.
18 *
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.
23 *
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/>.
26 *
27 * @category Main
28 * @package Galette
29 *
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2013-2023 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.7.4dev - 2013-02-03
35 */
36
37 define('GALETTE_ROOT', __DIR__ . '/../');
38 require_once GALETTE_ROOT . 'config/versions.inc.php';
39 require_once GALETTE_ROOT . 'config/paths.inc.php';
40
41 $phpok = !version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<');
42 $php_message = PHP_VERSION;
43 if (!$phpok) {
44 $php_message .= sprintf(' (%s minimum required)', GALETTE_PHP_MIN);
45 } else {
46 require_once GALETTE_ROOT . '/vendor/autoload.php';
47 $cm = new Galette\Core\CheckModules(false);
48 $cm->doCheck(false); //do not load with translations!
49 }
50 ?>
51 <html>
52 <head>
53 <title>Galette compatibility tests</title>
54 <link rel="stylesheet" type="text/css" href="./assets/css/galette-main.bundle.min.css" />
55 <link rel="stylesheet" type="text/css" href="./themes/default/ui/semantic.min.css" />
56 <link rel="shortcut icon" href="./themes/default/images/favicon.png" />
57 </head>
58 <body class="pushable">
59 <div class="pusher">
60 <div id="main" class="ui container">
61 <div class="ui basic segment">
62 <div class="ui basic center aligned fitted segment">
63 <img class="icon" alt="[ Galette ]" src="./themes/default/images/galette.png"/>
64 </div>
65 <h1 class="ui block center aligned header">Compatibility tests</h1>
66 <div class="ui segment">
67 <div id="main" class="text ui container">
68 <?php
69 if (!$phpok
70 || !isset($cm)
71 || !$cm->isValid()
72 ) {
73 echo '<p class="ui red center aligned message">Something is wrong :(</p>';
74 } else {
75 echo '<p class="ui green center aligned message">Everything is OK :)</p>';
76 }
77 ?>
78 <ul class="leaders">
79 <li>
80 <span>PHP <strong class="<?php echo ($phpok) ? 'Ok' : 'Missing'; ?>"><?php echo $php_message; ?></strong></span>
81 <span><i class="ui <?php echo ($phpok) ? 'green check' : 'red times'; ?> icon"></i></span>
82 </li>
83 <?php
84 if (isset($cm)) {
85 echo $cm->toHtml(false);
86 }
87 ?>
88 </ul>
89 <?php
90 if ($phpok && isset($cm) && $cm->isValid()) {
91 echo '<p class="ui center aligned message">You can now <a href="./installer.php">install Galette</a></p>';
92 }
93 ?>
94 </div>
95 </div>
96 </div>
97 </div>
98 </div>
99 </body>
100 </html>