]> git.agnieray.net Git - galette.git/blob - galette/lib/Galette/Core/PluginInstall.php
Scrutinizer Auto-Fixes (#59)
[galette.git] / galette / lib / Galette / Core / PluginInstall.php
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 /**
6 * Galette plugin installation
7 *
8 * PHP version 5
9 *
10 * Copyright © 2017 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 Core
28 * @package Galette
29 *
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2017 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 * @version SVN: $Id$
34 * @link http://galette.tuxfamily.org
35 * @since Available since 0.9dev - 2017-01-08
36 */
37
38 namespace Galette\Core;
39
40 use \Analog\Analog;
41 use Laminas\Db\Adapter\Adapter;
42
43 /**
44 * Galette plugin installation
45 *
46 * @category Core
47 * @name Install
48 * @package Galette
49 * @author Johan Cwiklinski <johan@x-tnd.be>
50 * @copyright 2017 The Galette Team
51 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
52 * @link http://galette.tuxfamily.org
53 * @since Available since 0.9dev - 2017-01-08
54 */
55 class PluginInstall extends Install
56 {
57 private $versions_mapper = [];
58
59 /**
60 * Main constructor
61 */
62 public function __construct()
63 {
64 parent::__construct();
65 $this->atTypeStep();
66 }
67
68 /**
69 * Test database connection
70 *
71 * @return true|array true if connection was successfull,
72 * an array with some infos otherwise
73 */
74 public function testDbConnexion()
75 {
76 //installing plugin, DB connection is already ok
77 return true;
78 }
79
80 /**
81 * Go back to previous step
82 *
83 * @return void
84 */
85 public function atPreviousStep()
86 {
87 if ($this->_step > 0) {
88 if ($this->_step - 1 !== self::STEP_DB_INSTALL
89 && $this->_step !== self::STEP_END
90 ) {
91 if ($this->_step === self::STEP_DB_INSTALL) {
92 $this->_step = self::STEP_DB_CHECKS;
93 } else {
94 if ($this->_step === self::STEP_DB_UPGRADE) {
95 $this->setInstalledVersion(null);
96 }
97 $this->_step = $this->_step - 1;
98 }
99 } else {
100 $msg = null;
101 if ($this->_step === self::STEP_END) {
102 $msg = 'Ok man, install is finished already!';
103 } else {
104 $msg = 'It is forbidden to rerun database install!';
105 }
106 Analog::log($msg, Analog::WARNING);
107 }
108 }
109 }
110
111 /**
112 * Initialize Galette relevant objects
113 *
114 * @param I18n $i18n I18n
115 * @param Db $zdb Database instance
116 * @param Login $login Loged in instance
117 *
118 * @return boolean
119 */
120 public function initObjects(I18n $i18n, Db $zdb, Login $login)
121 {
122 return false;
123 }
124 }