forked from bensochar/Web-2.0-Touch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
manifest.php
28 lines (25 loc) · 887 Bytes
/
manifest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?
$ignore = Array();
$ignore[] = "./build.number";
$ignore[] = "./build.xml";
$ignore[] = "./cache.manifest";
$ignore[] = "./config.xml";
$ignore[] = "./license.txt";
$ignore[] = "./readme.md";
$ignore[] = "./index.appcache";
$hash = "";
$data = "CACHE MANIFEST\n# Version 1.0 Build: XXX\n";
// read all files and their hashes
$dir = new RecursiveDirectoryIterator(".");
foreach(new RecursiveIteratorIterator($dir) as $file) {
if (substr($file, 0, 3) == './.') continue;
if (substr($file, 0, 7) == './BUILD') continue;
if (in_array($file, $ignore)) continue;
if ($file->IsFile() && $file != "./manifest.php" && substr($file->getFileName(), 0, 1) != ".") $data .= $file."\n";
$hash .= md5_file($file);
}
$data .= "\n# hash: ".md5($hash);
// if any file changed, then manifest should be reloaded
file_put_contents("index.appcache", $data);
//print($data."# hash: ".md5($hash));
?>