Neos\Flow\Core\Migrations\Git::isGitAvailable PHP Method

isGitAvailable() public static method

Check whether the git command is available.
public static isGitAvailable ( ) : boolean
return boolean
    public static function isGitAvailable()
    {
        $result = 255;
        $output = array();
        exec('git --version', $output, $result);
        return $result === 0;
    }

Usage Example

Exemplo n.º 1
0
define('FLOW_PATH_FLOW', str_replace('//', '/', str_replace('\\', '/', realpath(__DIR__ . '/../') . '/')));
define('FLOW_PATH_ROOT', str_replace('//', '/', str_replace('\\', '/', realpath(__DIR__ . '/../../../../') . '/')));
define('FLOW_PATH_WEB', FLOW_PATH_ROOT . 'Web/');
define('FLOW_PATH_CONFIGURATION', FLOW_PATH_ROOT . 'Configuration/');
define('FLOW_PATH_DATA', FLOW_PATH_ROOT . 'Data/');
define('MAXIMUM_LINE_LENGTH', 84);
define('STYLE_DEFAULT', 0);
define('STYLE_ERROR', 31);
define('STYLE_WARNING', 33);
define('STYLE_SUCCESS', 32);
if (flagIsSet('packages-path')) {
    define('FLOW_PATH_PACKAGES', getFlagValue('packages-path'));
} else {
    define('FLOW_PATH_PACKAGES', FLOW_PATH_ROOT . 'Packages/');
}
if (\Neos\Flow\Core\Migrations\Git::isGitAvailable() === false) {
    outputLine('No executable git binary found, exiting.');
    exit(255);
}
$migrationsManager = new Manager();
$packageKey = getFlagValue('package-key');
$versionNumber = null;
if (flagIsSet('version')) {
    if (preg_match('/[0-9]{12,14}/', getFlagValue('version'), $matches) !== 1) {
        outputLine('EXCEPTION: invalid version "%s" specified, please provide the 12 or 14 digit timestamp of the version you want to target.', array(getFlagValue('version')), 0, STYLE_ERROR);
        exit(255);
    }
    $versionNumber = $matches[0];
    // see https://jira.neos.io/browse/FLOW-110
    if (strlen($versionNumber) === 12) {
        $versionNumber .= '00';