You are here

function hacked_cvs_executable_get_version in Hacked! 6.2

Same name and namespace in other branches
  1. 6 hacked.module \hacked_cvs_executable_get_version()
  2. 7.2 hacked.module \hacked_cvs_executable_get_version()

Returns the version of the installed cvs executable on this machine

File

./hacked.module, line 271
The Hacked! module, shows which project have been changed since download.

Code

function hacked_cvs_executable_get_version() {
  $cvs_cmd = hacked_cvs_get_command();

  // Run exec looking for the command:
  $output_lines = array();
  $return_value;
  exec("{$cvs_cmd} --version", $output_lines, $return_value);
  if ($return_value === 0) {

    // We executed correctly, go looking for the version line:
    $version = 'Concurrent Versions System (CVS)';
    if (is_array($output_lines)) {
      foreach ($output_lines as $line) {
        if (strpos($line, 'CVS')) {
          $version = $line;
          break;
        }
      }
    }
    return $version;
  }
  else {
    return FALSE;
  }
}