1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace crocodicstudio\crudbooster\commands; |
4
|
|
|
|
5
|
|
|
class RequirementChecker |
6
|
|
|
{ |
7
|
|
|
|
8
|
|
|
private $console; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* ConsolePrinter constructor. |
12
|
|
|
* |
13
|
|
|
* @param $console |
14
|
|
|
*/ |
15
|
|
|
public function __construct(Command $console) |
|
|
|
|
16
|
|
|
{ |
17
|
|
|
$this->console = $console; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
private $requirements = true; |
21
|
|
|
|
22
|
|
|
function check() |
23
|
|
|
{ |
24
|
|
|
$this->console->info('System Requirements Checking:'); |
25
|
|
|
$this->checkLaravelVersion(); |
26
|
|
|
$this->checkPHPversion(); |
27
|
|
|
$this->chechExtension('mbstring'); |
28
|
|
|
$this->chechExtension('openssl'); |
29
|
|
|
$this->chechExtension('pdo'); |
30
|
|
|
$this->chechExtension('tokenizer'); |
31
|
|
|
$this->chechExtension('xml'); |
32
|
|
|
$this->chechExtension('gd'); |
33
|
|
|
$this->chechExtension('fileinfo'); |
34
|
|
|
$this->checkWritableFolders(); |
35
|
|
|
|
36
|
|
|
return $this->requirements; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
private function checkPHPversion() |
40
|
|
|
{ |
41
|
|
|
if (version_compare(phpversion(), '5.6.0', '>=')) { |
42
|
|
|
$this->console->info('PHP Version (>= 5.6.*): [Good]'); |
43
|
|
|
return; |
44
|
|
|
} |
45
|
|
|
$this->console->info('PHP Version (>= 5.6.*): [Bad] Yours: '.phpversion()); |
46
|
|
|
$this->requirements = false; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
private function checkLaravelVersion() |
50
|
|
|
{ |
51
|
|
|
$laravel = app(); |
52
|
|
|
if ($laravel::VERSION >= 5.3) { |
|
|
|
|
53
|
|
|
$this->console->info('Laravel Version (>= 5.3.*): [Good]'); |
54
|
|
|
return; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
$this->console->info('Laravel Version (>= 5.3.*): [Bad]'); |
58
|
|
|
$this->requirements = false; |
59
|
|
|
|
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
private function checkWritableFolders() |
63
|
|
|
{ |
64
|
|
|
if (is_writable(base_path('public'))) { |
65
|
|
|
$this->console->info('public dir is writable: [Good]'); |
66
|
|
|
return true; |
67
|
|
|
} |
68
|
|
|
$this->console->info('public dir is writable: [Bad]'); |
69
|
|
|
return $this->requirements = false; |
70
|
|
|
|
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param $extension |
75
|
|
|
* @return true |
76
|
|
|
*/ |
77
|
|
|
private function chechExtension($extension) |
78
|
|
|
{ |
79
|
|
|
if (! extension_loaded($extension)) { |
80
|
|
|
$this->console->info($extension.' extension: [Bad]'); |
81
|
|
|
return $this->requirements = false; |
|
|
|
|
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
$this->console->info($extension.' extension: [Good]'); |
85
|
|
|
return true; |
86
|
|
|
} |
87
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths