Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| tao_install_checks_DatabaseDrivers | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
| check | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2002-2008 (original work) Public Research Centre Henri Tudor & University of Luxembourg |
| 19 | * (under the project TAO & TAO2); |
| 20 | * 2008-2010 (update and modification) Deutsche Institut für Internationale Pädagogische Forschung |
| 21 | * (under the project TAO-TRANSFER); |
| 22 | * 2009-2012 (update and modification) Public Research Centre Henri Tudor |
| 23 | * (under the project TAO-SUSTAIN & TAO-DEV); |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | class tao_install_checks_DatabaseDrivers extends common_configuration_Component |
| 28 | { |
| 29 | public function check() |
| 30 | { |
| 31 | |
| 32 | // One of these drivers must be found. |
| 33 | $drivers = [ |
| 34 | 'pdo_mysql', |
| 35 | 'pdo_pgsql', |
| 36 | 'pdo_sqlsrv', |
| 37 | 'pdo_oci', |
| 38 | ]; |
| 39 | |
| 40 | foreach ($drivers as $d) { |
| 41 | $dbCheck = common_configuration_ComponentFactory::buildPHPDatabaseDriver($d); |
| 42 | $dbReport = $dbCheck->check(); |
| 43 | |
| 44 | if ($dbReport->getStatus() == common_configuration_Report::VALID) { |
| 45 | return new common_configuration_Report( |
| 46 | $dbReport->getStatus(), |
| 47 | "A suitable database driver is available.", |
| 48 | $this |
| 49 | ); |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | return new common_configuration_Report( |
| 54 | common_configuration_Report::INVALID, |
| 55 | "No suitable database driver detected. Drivers supported by TAO are: " |
| 56 | . implode(', ', $drivers) . '.', |
| 57 | $this |
| 58 | ); |
| 59 | } |
| 60 | } |