@@ -142,13 +142,20 @@ public function test_versions() {
142
142
$ this ->html_table_row ( 'MySQL Version ' , $ this ->mysqli_version , '- ' , 'Not available, needs credentials. ' , 'warning ' );
143
143
}
144
144
145
- //Test if the server is connected to the server by attempt to find the IP(v4) of www.google.fr
146
- if (gethostbyname ('www.google.fr ' ) != 'www.google.fr ' ) {
147
- $ this ->html_table_row ('Internet connection ' , 'No ' , 'Yes ' , 'Yes ' , 'success ' );
148
- }else {
149
- $ this ->html_table_row ('Internet connection ' , 'No ' , 'Yes ' , 'No ' , 'error ' );
145
+ // Test if the server is connected to the server by attempt to find the IP(v4) of www.google.fr
146
+ if ( gethostbyname ('www.google.fr ' ) != 'www.google.fr ' ) {
147
+ $ this ->html_table_row ('Internet connectivity (Google) ' , 'No ' , 'Yes ' , 'Yes ' , 'success ' );
148
+ } else {
149
+ $ this ->html_table_row ('Internet connectivity (Google) ' , 'No ' , 'Yes ' , 'No ' , 'error ' );
150
150
}
151
151
152
+ // Test if the command 'git' exists, so it tests if Git is installed
153
+ if ($ this ->_command_exists ('git ' ) == 1 ) {
154
+ $ this ->html_table_row ('GIT is installed? ' , 'No ' , 'Yes ' , 'Yes ' );
155
+ } else {
156
+ $ this ->html_table_row ('GIT is installed? ' , 'No ' , 'Yes ' , 'No ' , 'error ' );
157
+ }
158
+ }
152
159
153
160
public function test_php_extensions () {
154
161
$ this ->html_table_open ( 'PHP Extensions ' , '' , 'Required ' , 'Recommended ' ,'Current ' );
@@ -1104,6 +1111,39 @@ function _check_request_wordpress() {
1104
1111
}
1105
1112
}
1106
1113
}
1114
+
1115
+ /**
1116
+ * Determines if a command exists on the current environment
1117
+ * Source: https://stackoverflow.com/questions/12424787/how-to-check-if-a-shell-command-exists-from-php
1118
+ *
1119
+ * @param string $command The command to check
1120
+ * @return bool True if the command has been found ; otherwise, false.
1121
+ */
1122
+ private function _command_exists ($ command ) {
1123
+ $ whereIsCommand = (PHP_OS == 'WINNT ' ) ? 'where ' : 'which ' ;
1124
+
1125
+ $ process = proc_open (
1126
+ "$ whereIsCommand $ command " ,
1127
+ array (
1128
+ 0 => array ("pipe " , "r " ), //STDIN
1129
+ 1 => array ("pipe " , "w " ), //STDOUT
1130
+ 2 => array ("pipe " , "w " ), //STDERR
1131
+ ),
1132
+ $ pipes
1133
+ );
1134
+
1135
+ if ($ process !== false ) {
1136
+ $ stdout = stream_get_contents ($ pipes [1 ]);
1137
+ $ stderr = stream_get_contents ($ pipes [2 ]);
1138
+ fclose ($ pipes [1 ]);
1139
+ fclose ($ pipes [2 ]);
1140
+ proc_close ($ process );
1141
+
1142
+ return $ stdout != '' ;
1143
+ }
1144
+
1145
+ return false ;
1146
+ }
1107
1147
}
1108
1148
1109
1149
// Init render
0 commit comments