Bläddra i källkod

Add files via upload

Capitan Cloud 1 år sedan
förälder
incheckning
5b9f171dea

+ 11 - 0
Private/routes/cachedcrc/_cachedsource.php

@@ -0,0 +1,11 @@
+<?php
+
+  ob_start();
+
+  require("test.php");
+
+  $output = ob_get_clean();
+
+  echo($output) . "<br>" . PHP_EOL;
+
+  echo(hash("sha256", $output, false));

+ 4 - 0
Private/routes/cachedcrc/_config.inc

@@ -0,0 +1,4 @@
+<?php
+
+  $phpExecName = "php";
+  $cachedScript = "test.php";

+ 10 - 0
Private/routes/cachedcrc/test.php

@@ -0,0 +1,10 @@
+<?php
+
+echo("<html>");
+echo("<head>");
+echo("   <link href='/css/style.css' type='text/css' rel='stylesheet'></link>");
+echo("</head>");
+echo("<body>");
+echo("<img src='/res/logot.png' alt='5mode logo'>");
+echo("</body>");
+echo("</html>");

+ 31 - 0
Private/routes/cachedcrc/testcached.php

@@ -0,0 +1,31 @@
+<?php
+
+  require("_config.inc");
+
+  chdir(APP_PRIVATE_PATH . DIRECTORY_SEPARATOR . "routes" . DIRECTORY_SEPARATOR . "cachedcrc"); 
+
+  $source = $cachedScript;
+
+  $cachedSource = "_cachedsource.php -- " . $source;
+
+  //$phpcmdopts = "--php-ini $APP_PUBLIC_PATH/php.ini";
+
+  //if (!exec("$phpExecName $source $phpcmdopts", $out)) {
+  if (!exec("$phpExecName $source", $out1)) {
+    echo "An hanexpected error happened!".PHP_EOL;
+    exit(1);  
+  } 
+
+  //$cachedres = system("$phpExecName $cachedSource");
+  $cachedres = exec("$phpExecName $cachedSource", $out2);
+
+  foreach($out1 as $line) {
+    echo($line)."<br>";
+  }
+
+  if (hash("sha256", trim($out1[count($out1)-1]), false) === trim($cachedres)) {
+    echo_ifdebug(true, trim($cachedres)."<br>");
+    echo_ifdebug(true, PHP_EOL . "CHECKING_CACHE_VALIDITY: ok!" . PHP_EOL);
+  } else {
+    echo_ifdebug(true, "<br>" . PHP_EOL . "CHECKING_CACHE_VALIDITY: uncoherent!" . PHP_EOL);
+  }