Guest User

Untitled

a guest
Jul 16th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2. /* Git WebHook 自动更新代码 */
  3. /* 成功条件:1. php 的运行用户(一般是www-data)需要 sudo 免密码 2. git 需要记住密码 */
  4.  
  5. define( 'PASSWORD', 'S!^C1bPyyCYf8EnG' );
  6.  
  7. $requestBody = file_get_contents( "php://input" );
  8. $content = json_decode( $requestBody, true );
  9.  
  10. /* 验证密码 */
  11. if ( $content['password'] != PASSWORD ) return false;
  12.  
  13. $web_path = '/mnt/www/yeelight.com/translation';
  14. $res = shell_exec( "cd {$web_path} && sudo git pull origin master" );
  15.  
  16. exit( $res );
Add Comment
Please, Sign In to add comment