private function checkOptional()
{
$stats = array();
// check PHP 5.2
$stats['PHP 5.2'] = $this->checkPHP($this->config->php52, '5.2');
// check PHP 5.3
$stats['PHP 5.3'] = $this->checkPHP($this->config->php53, '5.3');
// check PHP 5.4
$stats['PHP 5.4'] = $this->checkPHP($this->config->php54, '5.4');
// check PHP 5.5
$stats['PHP 5.5'] = $this->checkPHP($this->config->php55, '5.5');
// check PHP 5.6
$stats['PHP 5.6'] = $this->checkPHP($this->config->php56, '5.6');
// check PHP 7.0
$stats['PHP 7.0'] = $this->checkPHP($this->config->php70, '7.0');
// check PHP 7.1
$stats['PHP 7.1'] = $this->checkPHP($this->config->php71, '7.1');
// check PHP 7.2
$stats['PHP 7.2'] = $this->checkPHP($this->config->php72, '7.2');
// git
$res = trim(shell_exec('git --version 2>&1'));
if (preg_match('/git version ([0-9\\.]+)/', $res, $r)) {
//
$stats['git']['installed'] = 'Yes';
$stats['git']['version'] = $r[1];
} else {
$stats['git']['installed'] = 'No';
$stats['git']['optional'] = 'Yes';
}
// hg
$res = trim(shell_exec('hg --version 2>&1'));
if (preg_match('/Mercurial Distributed SCM \\(version ([0-9\\.]+)\\)/', $res, $r)) {
//
$stats['hg']['installed'] = 'Yes';
$stats['hg']['version'] = $r[1];
} else {
$stats['hg']['installed'] = 'No';
$stats['hg']['optional'] = 'Yes';
}
// svn
$res = trim(shell_exec('svn --version 2>&1'));
if (preg_match('/svn, version ([0-9\\.]+) /', $res, $r)) {
//
$stats['svn']['installed'] = 'Yes';
$stats['svn']['version'] = $r[1];
} else {
$stats['svn']['installed'] = 'No';
$stats['svn']['optional'] = 'Yes';
}
// bazaar
$res = trim(shell_exec('bzr --version 2>&1'));
if (preg_match('/Bazaar \\(bzr\\) ([0-9\\.]+) /', $res, $r)) {
//
$stats['bzr']['installed'] = 'Yes';
$stats['bzr']['version'] = $r[1];
} else {
$stats['bzr']['installed'] = 'No';
$stats['bzr']['optional'] = 'Yes';
}
// composer
$res = trim(shell_exec('composer -V 2>&1'));
// remove colors from shell syntax
$res = preg_replace('/\\e\\[[\\d;]*m/', '', $res);
if (preg_match('/Composer version ([0-9\\.a-z@_\\(\\)\\-]+) /', $res, $r)) {
//
$stats['composer']['installed'] = 'Yes';
$stats['composer']['version'] = $r[1];
} else {
$stats['composer']['installed'] = 'No';
}
// wget
$res = explode("\n", shell_exec('wget -V 2>&1'));
$res = $res[0];
if ($res !== '') {
//
$stats['wget']['installed'] = 'Yes';
$stats['wget']['version'] = $res;
} else {
$stats['wget']['installed'] = 'No';
}
// zip
$res = shell_exec('zip -v 2>&1');
if (preg_match('/not found/is', $res)) {
$stats['zip']['installed'] = 'No';
} elseif (preg_match('/Zip\\s+([0-9\\.]+)/is', $res, $r)) {
$stats['zip']['installed'] = 'Yes';
$stats['zip']['version'] = $r[1];
} else {
$stats['zip']['error'] = $res;
}
return $stats;
}