12345678910111213141516171819202122232425262728293031323334 |
- <?php
- declare(strict_types=1);
- class IndexController extends ControllerBase
- {
- public function indexAction()
- {
- if(!$this->request->isPost()) exit();
- if(isset($_POST['payload']) && $_POST['payload']){
- $payload = json_decode($_POST['payload'],true);
- $name = $payload['repository']['name'];
- if(is_dir('/home/www/'.$name)){
- system('cd /home/www/'.$name.';git pull',$return);
- }else{
- $repo = $payload['repository']['ssh_url'];
- system('cd /home/www;git clone '.$repo.';git pull',$return);
- }
- return '请求成功';
- }
- return '请求错误';
- }
- public function show404Action(){
- return 'UNKNOWN REQUEST';
- }
- }
|