Advertisement
Guest User

Untitled

a guest
Jun 30th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.37 KB | None | 0 0
  1. /*
  2.  * It is worth noting that this file is NOT displayed in any way in the production web page.
  3.  * This page is run by a CRON job every 5 minutes to keep the snapshots.txt file up to date with the snapshot list :)
  4.  */
  5. <?php
  6. $log = fopen("snapshotGetter.log", "a");
  7. $date = date("D m-d-y h:i A");
  8. fwrite($log, "*RUN ON $date == ");
  9. fclose($log);
  10. $snapshotsfile = fopen(/*"/projects/pre/snapshots.txt"*/"snapshots.txt", "wb");
  11. error_reporting(E_ALL);
  12. date_default_timezone_set('America/New_York');
  13. $curweek = date("W");
  14. for( ; $curweek != "0"; $curweek--)
  15. {
  16.     if(strpos($curweek, '0') === 0)
  17. {
  18. $name = "12w" . "$curweek" . "a";
  19. $bname = "12w" . "$curweek" . "b";
  20. $cname = "12w" . "$curweek" . "c";
  21. }
  22. else
  23. {
  24. $name = "12w0" . "$curweek" . "a";
  25. $bname = "12w0" . "$curweek" . "b";
  26. $cname = "12w0" . "$curweek" . "c";
  27. }
  28. //c
  29. $f = fopen("http://assets.minecraft.net/" . $cname . "/minecraft.jar", "r");
  30. if($f)
  31. {
  32.     echo $cname . ' is good;';
  33.     fwrite($snapshotsfile, $cname . ";");
  34. }
  35. fclose($f);
  36. //b
  37. $f = fopen("http://assets.minecraft.net/" . $bname . "/minecraft.jar", "r");
  38. if($f)
  39. {
  40.     echo $bname . ' is good;';
  41.     fwrite($snapshotsfile, $bname . ";");
  42. }
  43. fclose($f);
  44. //a
  45. $f = fopen("http://assets.minecraft.net/" . $name . "/minecraft.jar", "r");
  46. if($f)
  47. {
  48.     echo $name . ' is good;';
  49.     fwrite($snapshotsfile, $name . ";");
  50. }
  51. fclose($f);
  52. }
  53. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement