| @@ 242-263 (lines=22) @@ | ||
| 239 | * |
|
| 240 | * @return [type] [description] |
|
| 241 | */ |
|
| 242 | public function actionDeployApplication($id, $idPage) |
|
| 243 | { |
|
| 244 | $application = $this->repository->find($id); |
|
| 245 | ||
| 246 | $deployScript = $this->settings->get('Deploy script', 'deployModule')->getValue(); |
|
| 247 | ||
| 248 | foreach($application->getServers() as $server) { |
|
| 249 | $commandString = sprintf($deployScript, |
|
| 250 | $application->getPath(), |
|
| 251 | $server->getPath() . $application->getName(), |
|
| 252 | $server->getIp() |
|
| 253 | ); |
|
| 254 | ||
| 255 | $output = shell_exec($commandString); |
|
| 256 | $this->flashMessage($server->getName() . ' ' . $output, 'info'); |
|
| 257 | } |
|
| 258 | ||
| 259 | $this->flashMessage('Application has been deployed.', 'success'); |
|
| 260 | $this->forward('default', array( |
|
| 261 | 'idPage' => $this->actualPage->getId() |
|
| 262 | )); |
|
| 263 | } |
|
| 264 | ||
| 265 | /** |
|
| 266 | * |
|
| @@ 272-292 (lines=21) @@ | ||
| 269 | * |
|
| 270 | * @return [type] [description] |
|
| 271 | */ |
|
| 272 | public function actionDeployDatabase($id, $idPage) |
|
| 273 | { |
|
| 274 | $application = $this->repository->find($id); |
|
| 275 | ||
| 276 | $deployScript = $this->settings->get('Deploy database script', 'deployModule')->getValue(); |
|
| 277 | ||
| 278 | foreach($application->getServers() as $server) { |
|
| 279 | $commandString = sprintf($deployScript, |
|
| 280 | $application->getDatabase(), |
|
| 281 | $server->getIp() |
|
| 282 | ); |
|
| 283 | ||
| 284 | $output = shell_exec($commandString); |
|
| 285 | $this->flashMessage($server->getName() . ' ' . $output, 'info'); |
|
| 286 | } |
|
| 287 | ||
| 288 | $this->flashMessage('Database has been deployed on all servers.', 'success'); |
|
| 289 | $this->forward('default', array( |
|
| 290 | 'idPage' => $this->actualPage->getId() |
|
| 291 | )); |
|
| 292 | } |
|
| 293 | } |
|
| 294 | ||