Created
August 4, 2016 19:49
-
-
Save chukShirley/0627dc1006787c6af91035c730308846 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
)); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
)); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment