ServerScript.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. function CreateDirAndCheck($dir)
  3. {
  4. if(!is_dir($dir))
  5. {
  6. mkdir($dir,0700,true);
  7. }
  8. else
  9. {
  10. echo $dir."已经存在~~~~\n";
  11. }
  12. }
  13. $Protocol = $_GET["Protocol"];
  14. //HSP_INIT,//初始化服务器的数据
  15. if($Protocol == 0)
  16. {
  17. $Bucket = $_GET["Bucket"];
  18. $PatchVersionLogName = $_GET["PatchVersionLogName"];
  19. $ServerVersionName = $_GET["ServerVersionName"];
  20. $VersionLock = $_GET["VersionLock"];
  21. $Platform = $_GET["Platform"];
  22. $PatchVersionLogName = "../".$Bucket."/".$Platform."/".$PatchVersionLogName;
  23. $ServerVersionName = "../".$Bucket."/".$Platform."/".$ServerVersionName;
  24. $VersionLock = "../".$Bucket."/".$Platform."/".$VersionLock;
  25. $Patch = "../".$Bucket."/".$Platform."/Version/Patch";
  26. CreateDirAndCheck($PatchVersionLogName);
  27. CreateDirAndCheck($ServerVersionName);
  28. CreateDirAndCheck($VersionLock);
  29. CreateDirAndCheck($Patch);
  30. }
  31. //HSP_CHECK_LOCK,//检测锁
  32. else if($Protocol == 1)
  33. {
  34. $VersionLockPath = "../".$_GET["VersionLockPath"];
  35. if(!file_exists($VersionLockPath))
  36. {
  37. file_put_contents($VersionLockPath,"false");
  38. echo "false";
  39. }
  40. else
  41. {
  42. echo file_get_contents($VersionLockPath);
  43. }
  44. }
  45. // HSP_LOCK,//上锁
  46. else if($Protocol == 2)
  47. {
  48. $VersionLockPath = "../".$_GET["VersionLockPath"];
  49. if(!file_exists($VersionLockPath))
  50. {
  51. file_put_contents($VersionLockPath,"true");
  52. }
  53. file_put_contents($VersionLockPath,"true");
  54. echo "false";
  55. }
  56. // HSP_UNLOCK,//解锁
  57. else if($Protocol == 3)
  58. {
  59. $VersionLockPath = "../".$_GET["VersionLockPath"];
  60. if(!file_exists($VersionLockPath))
  61. {
  62. file_put_contents($VersionLockPath,"false");
  63. }
  64. file_put_contents($VersionLockPath,"false");
  65. echo "false";
  66. }