Açıklama Yok

IndexController.php 766B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. declare(strict_types=1);
  3. class IndexController extends ControllerBase
  4. {
  5. public function indexAction()
  6. {
  7. if(!$this->request->isPost()) exit();
  8. if(isset($_POST['payload']) && $_POST['payload']){
  9. $payload = json_decode($_POST['payload'],true);
  10. $name = $payload['repository']['name'];
  11. if(is_dir('/home/www/'.$name)){
  12. system('cd /home/www/'.$name.';git pull',$return);
  13. }else{
  14. $repo = $payload['repository']['ssh_url'];
  15. system('cd /home/www;git clone '.$repo.';git pull',$return);
  16. }
  17. return '请求成功';
  18. }
  19. return '请求错误';
  20. }
  21. public function show404Action(){
  22. return 'UNKNOWN REQUEST';
  23. }
  24. }