TEst pull via sh

This commit is contained in:
2018-06-27 19:47:49 +02:00
parent 1e751e8eae
commit c8b5cc37cf
3 changed files with 68 additions and 38 deletions

1
helper/shell-gitpull.sh Normal file
View File

@ -0,0 +1 @@
cd .. && git pull origin master

View File

@ -24,6 +24,16 @@ return [
], ],
], ],
], ],
'srcpull' => [
'type' => Literal::class,
'options' => [
'route' => '/pull',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'pull',
],
],
],
'contact' => [ 'contact' => [
'type' => Literal::class, 'type' => Literal::class,
'options' => [ 'options' => [

View File

@ -16,7 +16,26 @@ use PHPMailer\PHPMailer\Exception;
class IndexController extends AbstractActionController class IndexController extends AbstractActionController
{ {
public function indexAction() public function indexAction()
{ $view = new ViewModel(); {
$view = new ViewModel();
$view->setTerminal(true);
return $view;
}
public function pullAction()
{
$view = new JsonModel();
$old_path = getcwd();
var_dump($old_path);
var_dump($old_path.'/helper');
chdir($old_path.'/helper' );
//make sure to make the shell file executeable first before running the shell_exec function
$output = shell_exec('./shell-gitpull.sh');
var_dump($output);
echo $output;
die;
$view->setTerminal(true); $view->setTerminal(true);
return $view; return $view;
} }