_exec('id', $output); $uid = $this->egrep('/uid=[0-9]+/', isset($output[0]) ? $output[0] : ''); $uid = $this->egrep('/[0-9]+/', $uid); return $uid; } public function getGid() { $output = null; $return = $this->_exec('id', $output); $uid = $this->egrep('/gid=[0-9]+/', isset($output[0]) ? $output[0] : ''); $uid = $this->egrep('/[0-9]+/', $uid); return $uid; } public function getGitVersion() { $output = null; $return = $this->_exec('git --version', $output); return $this->egrep('/[0-9.]+/', isset($output[0]) ? $output[0] : ''); } public function getComposerVersion() { $output = null; $return = $this->_exec('composer --version', $output); return $this->egrep('/[0-9.]+/', isset($output[0]) ? $output[0] : ''); } public function getDrushVersion() { $output = null; $return = $this->_exec('drush --version', $output); return $this->egrep('/[0-9.]+/', isset($output[0]) ? $output[0] : ''); } public function getDrushConsoleVersion() { $output = null; $return = $this->_exec('drush-console --version', $output); return $this->egrep('/[0-9.]+/', isset($output[0]) ? $output[0] : ''); } public function getNodeVersion() { $output = null; $return = $this->_exec('node --version', $output); return $this->egrep('/[0-9.]+/', isset($output[0]) ? $output[0] : ''); } public function getNpmVersion() { $output = null; $return = $this->_exec('npm --version', $output); return $this->egrep('/[0-9.]+/', isset($output[0]) ? $output[0] : ''); } public function getTldSuffix() { return getenv('TLD_SUFFIX'); } /********************************************************************************* * * Interface required functions * *********************************************************************************/ public function getName($default = 'PHP') { if (defined('HHVM_VERSION')) { return 'HHVM'; } return $default; } public function getVersion() { if (defined('HHVM_VERSION')) { return HHVM_VERSION . ' php-'.str_replace('-hhvm', '', phpversion()); } else { return phpversion(); } } /********************************************************************************* * * Private functions * *********************************************************************************/ /** * Executes shell commands on the PHP-FPM Host * * @param string $cmd Command * @param string $output Reference to output * @return integer */ private function _exec($cmd, &$output = '') { // Clean output $output = ''; exec($cmd, $output, $exit_code); return $exit_code; } }