Explorar o código

Add files via upload

Capitan Cloud hai 1 ano
pai
achega
1eab3b3aee

+ 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-8.2";
+  $cachedScript = "test.php";

+ 16 - 0
Private/routes/cachedcrc/source.php

@@ -0,0 +1,16 @@
+<?php
+
+  require("config.inc");
+
+  if (!empty($cachedScript)) {
+    if (!is_readable(__DIR__.DIRECTORY_SEPARATOR.$cachedScript)) {
+      echo("Wrong &lt;source&gt; parameter: ".$cachedScript."<br>");
+      exit(1);  
+    }
+  } 
+
+  $cmdstr = $phpExecName." source.php -- ".$cachedScript;
+  //__DIR__.DIRECTORY_SEPARATOR.$cachedScript;
+
+  passthru($cmdstr);
+ 

+ 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>");

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

@@ -0,0 +1,32 @@
+<?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(trim($cachedres)."<br>");
+    echo(PHP_EOL . "good: php cache result verified." . PHP_EOL);   
+  } else {
+    echo("<br>" . PHP_EOL . "attention, php cache result is uncoherent!" . PHP_EOL);   
+  }
+