Home | History | Annotate | Download | only in resources
      1 <?php
      2 require_once '../../resources/portabilityLayer.php';
      3 
      4 $tmpFile = sys_get_temp_dir() . "/" . "fail_on_update_state";
      5 
      6 function setState($newState, $file)
      7 {
      8     file_put_contents($file, $newState);
      9 }
     10 
     11 function getState($file)
     12 {
     13     if (!file_exists($file)) {
     14         return "Uninitialized";
     15     }
     16     return file_get_contents($file);
     17 }
     18 
     19 $command = $_GET['command'];
     20 $state = getState($tmpFile);
     21 
     22 header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
     23 header("Cache-Control: no-cache, must-revalidate");
     24 header("Pragma: no-cache");
     25 
     26 if ($command == "reset") {
     27     unlink($tmpFile);
     28 } else if ($command == "delete") {
     29     setState("Deleted", $tmpFile);
     30 } else if ($state == "Uninitialized") {
     31     header("Content-Type: text/cache-manifest");
     32     print("CACHE MANIFEST\n");
     33     print("fail-on-update-2.html\n");
     34     print("NETWORK:\n");
     35     print("fail-on-update.php?command=\n");
     36 } else if ($state == "Deleted") {
     37     header('HTTP/1.0 404 Not Found');
     38 }
     39 ?>
     40