• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?php
2require_once '../../resources/portabilityLayer.php';
3
4$tmpFile = sys_get_temp_dir() . "/" . "fail_on_update_state";
5
6function setState($newState, $file)
7{
8    file_put_contents($file, $newState);
9}
10
11function 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
22header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
23header("Cache-Control: no-cache, must-revalidate");
24header("Pragma: no-cache");
25
26if ($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