Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Git WebHook 自动更新代码 */
- /* 成功条件:1. php 的运行用户(一般是www-data)需要 sudo 免密码 2. git 需要记住密码 */
- define( 'PASSWORD', 'S!^C1bPyyCYf8EnG' );
- $requestBody = file_get_contents( "php://input" );
- $content = json_decode( $requestBody, true );
- /* 验证密码 */
- if ( $content['password'] != PASSWORD ) return false;
- $web_path = '/mnt/www/yeelight.com/translation';
- $res = shell_exec( "cd {$web_path} && sudo git pull origin master" );
- exit( $res );
Add Comment
Please, Sign In to add comment