chuk-shirley
8/4/2016 - 7:49 PM

pre_activate_no_output.php

<?php                                                                                          

call_user_func(function () {
    $phpBinary        = '/usr/local/zendsvr6/bin/php-cli';
    $baseDirectory    = getenv('ZS_APPLICATION_BASE_DIR');
    $migrationLogFile = getenv('ZS_MIGRATION_LOG_FILE');
    var_dump($migrationLogFile);
  //foreach (['migrations:migrate', 'orm:generate-proxies', 'app:clear-cache'] as $operation) {
    foreach (['migrations:migrate', 'app:clear-cache'] as $operation) {
        $command = sprintf(
            '%s %s %s >> %s',
            escapeshellarg($phpBinary),
            escapeshellarg($baseDirectory . '/cli.php'),
            $operation,
            escapeshellarg($migrationLogFile)
        );

        exec($command, $output, $exitCode);

        if ($exitCode) {
            throw new \UnexpectedValueException(sprintf(
                'Error while executing "%s". The program exited with "%s" and following output: %s',
                $command,
                $exitCode,
                $output
            ));
        }
    }
});
<?php                                                                                          

call_user_func(function () {
    $phpBinary        = '/usr/local/zendsvr6/bin/php-cli';
    $baseDirectory    = getenv('ZS_APPLICATION_BASE_DIR');
    $migrationLogFile = getenv('ZS_MIGRATION_LOG_FILE');

  //foreach (['migrations:migrate', 'orm:generate-proxies', 'app:clear-cache'] as $operation) {
    foreach (['migrations:migrate', 'app:clear-cache'] as $operation) {
        $command = sprintf(
            '%s %s %s >> %s',
            escapeshellarg($phpBinary),
            escapeshellarg($baseDirectory . '/cli.php'),
            $operation,
            escapeshellarg($migrationLogFile)
        );

        exec($command, $output, $exitCode);

        if ($exitCode) {
            throw new \UnexpectedValueException(sprintf(
                'Error while executing "%s". The program exited with "%s" and following output: %s',
                $command,
                $exitCode,
                $output
            ));
        }
    }
});