webman
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Git.php 929B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * This file is part of webman.
  4. *
  5. * Licensed under The MIT License
  6. * For full copyright and license information, please see the MIT-LICENSE.txt
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @author walkor<walkor@workerman.net>
  10. * @copyright walkor<walkor@workerman.net>
  11. * @link http://www.workerman.net/
  12. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  13. */
  14. namespace process;
  15. use Workerman\Timer;
  16. class Git
  17. {
  18. //window git 自动更新代码
  19. public function __construct()
  20. {
  21. Timer::add(10, [$this, 'pull']);
  22. }
  23. public function pull()
  24. {
  25. try {
  26. var_dump(shell_exec('cd ' . dirname(__DIR__) . ' && git pull'));
  27. } catch (\Exception $e) {
  28. return tojson(10000, $e->getMessage());
  29. } catch (\Throwable $e) {
  30. return tojson(10000, $e->getMessage());
  31. }
  32. }
  33. }