testcached.php 933 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. require("_config.inc");
  3. chdir(APP_PRIVATE_PATH . DIRECTORY_SEPARATOR . "routes" . DIRECTORY_SEPARATOR . "cachedcrc");
  4. $source = $cachedScript;
  5. $cachedSource = "_cachedsource.php -- " . $source;
  6. //$phpcmdopts = "--php-ini $APP_PUBLIC_PATH/php.ini";
  7. //if (!exec("$phpExecName $source $phpcmdopts", $out)) {
  8. if (!exec("$phpExecName $source", $out1)) {
  9. echo "An hanexpected error happened!".PHP_EOL;
  10. exit(1);
  11. }
  12. //$cachedres = system("$phpExecName $cachedSource");
  13. $cachedres = exec("$phpExecName $cachedSource", $out2);
  14. foreach($out1 as $line) {
  15. echo($line)."<br>";
  16. }
  17. if (hash("sha256", trim($out1[count($out1)-1]), false) === trim($cachedres)) {
  18. echo_ifdebug(true, trim($cachedres)."<br>");
  19. echo_ifdebug(true, PHP_EOL . "CHECKING_CACHE_VALIDITY: ok!" . PHP_EOL);
  20. } else {
  21. echo_ifdebug(true, "<br>" . PHP_EOL . "CHECKING_CACHE_VALIDITY: uncoherent!" . PHP_EOL);
  22. }