Posted By

saturngod on 03/15/10


Tagged

cache mainfest


Versions (?)

Build dynamic cache file for offline


 / Published in: PHP
 

  1. <?php
  2. $dir = new RecursiveDirectoryIterator(".");
  3. $hashes = "";
  4.  
  5. header('Content-Type: text/cache-manifest');
  6. echo "CACHE MANIFEST\n";
  7.  
  8. foreach(new RecursiveIteratorIterator($dir) as $file) {
  9. if ($file->IsFile() &&
  10. $file != "./manifest.php" &&
  11. substr($file->getFilename(), 0, 1) != "." &&
  12. substr($file, 0, 9) != "./archive" &&
  13. strpos($file, "/.svn") === false) {
  14. echo $file . "\n";
  15. $hashes .= md5_file($file);
  16. }
  17. }
  18. echo "# Hash: " . md5($hashes) . "\n";
  19. ?>

Report this snippet  

You need to login to post a comment.