-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathOROPostDeployHook.php
More file actions
43 lines (38 loc) · 1.31 KB
/
OROPostDeployHook.php
File metadata and controls
43 lines (38 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
class OROPostDeployHook implements Hooks_DeployerInterface
{
public function preDeployer(Deployer &$deployer)
{
//TODO : if enabled
$this->runBashCommand($deployer, $bashCMD);
}
/**
* @param Deployer $deployer
*/
public function postDeployer(Deployer &$deployer)
{
NedStars_Log::message('Running Post Deploy commands:');
$bashCMD[] = "composer.phar install --prefer-dist 2>1 > /dev/null";
$bashCMD[] = "app/console oro:migration:load --force --env=prod 2>1 > /dev/null";
$bashCMD[] = "app/console oro:migration:data:load --env=prod 2>1 > /dev/null";
$bashCMD[] = "app/console cache:clear --env=prod 2>1 > /dev/null";
$bashCMD[] = "app/console cache:warmup --env=prod 2>1 > /dev/null";
$this->runBashCommand($deployer, $bashCMD);
}
/**
* @param Deployer $deployer
* @param array $bashCMD
* @return $this
*/
protected function runBashCommand(Deployer &$deployer, array $bashCMD)
{
$path = (string)$deployer->getConfig()->paths->web_live_path;
foreach ($bashCMD as $_bashCMD) {
$output = array();
$return = 0;
$command = "cd {$path} && $(which php) {$_bashCMD}";
exec($command, $output, $return);
}
return $this;
}
}