Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / appcache / resources / modified-manifest.php
1 <?php
2 require_once '../../resources/portabilityLayer.php';
3
4 # This manifest references itself with a command to bump a counter, so
5 # that a subsequent fetch of the same manifest URL returns a file that
6 # is not byte-for-byte identical, which will cause caching to fail.
7
8 $tmpFile = sys_get_temp_dir() . "/" . "appcache_modified_manifest_counter";
9
10 function getCount($file)
11 {
12     if (!file_exists($file)) {
13         file_put_contents($file, "0");
14         return "0";
15     }
16     return file_get_contents($file);
17 }
18
19 function stepCounter($file)
20 {
21     if (file_exists($file)) {
22         $value = getCount($file);
23         file_put_contents($file, ++$value);
24     }
25 }
26
27 if ("step" == $_GET['command'])
28     stepCounter($tmpFile);
29
30 header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
31 header("Cache-Control: no-cache, must-revalidate");
32 header("Pragma: no-cache");
33 header("Content-Type: text/cache-manifest");
34
35 print("CACHE MANIFEST\n");
36 print("# version " . getCount($tmpFile) . "\n");
37 print("CACHE:\n");
38 print("modified-manifest.php?command=step\n");
39 ?>