1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Installer;
13
14 use ICanBoogie\Errors;
15
16 17 18
19 class PDODriversRequirement extends Requirement
20 {
21 public function __construct()
22 {
23 $this->title = t('requirement.pdo_drivers.title');
24 $this->description = t('requirement.pdo_drivers.description', array('action' => new TellMeMore('database'),));
25 }
26
27 public function __invoke(Errors $errors)
28 {
29 $drivers = \PDO::getAvailableDrivers();
30 $drivers = array_combine($drivers, $drivers);
31
32 if (empty($drivers['mysql']))
33 {
34 $errors['pdo_drivers'] = t('requirement.pdo_drivers.error.missing', array('name' => 'MySQL'));
35 }
36
37 if (empty($drivers['sqlite']))
38 {
39 $errors['pdo_drivers'] = t('requirement.pdo_drivers.error.missing', array('name' => 'SQLite'));
40 }
41 }
42 }