mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-18 05:41:24 +02:00
even more testing
This commit is contained in:
@@ -20,6 +20,11 @@ if (is_file($configFile)) {
|
||||
$config = array();
|
||||
}
|
||||
|
||||
// Make CIMAGE_DEBUG false by default, if not already defined
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
define("CIMAGE_DEBUG", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -5,6 +5,24 @@
|
||||
* config-file imgtest_config.php.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Change to true to enable debug mode which logs additional information
|
||||
* to file. Only use for test and development. You must create the logfile
|
||||
* and make it writable by the webserver or log entries will silently fail.
|
||||
*
|
||||
* CIMAGE_DEBUG will be false by default, if its not defined.
|
||||
*/
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
//define("CIMAGE_DEBUG", false);
|
||||
define("CIMAGE_DEBUG", true);
|
||||
define("CIMAGE_DEBUG_FILE", "/tmp/cimage");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return array(
|
||||
|
||||
/**
|
||||
@@ -61,7 +79,7 @@ return array(
|
||||
* Default values:
|
||||
* fast_track_allow: false
|
||||
*/
|
||||
//'fast_track_allow' => true,
|
||||
'fast_track_allow' => true,
|
||||
|
||||
|
||||
|
||||
|
@@ -43,12 +43,6 @@ define("CIMAGE_VERSION", "v0.7.13 (2016-08-08)");
|
||||
// For CRemoteImage
|
||||
define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION);
|
||||
|
||||
// Change to true to enable debug mode which logs additional information
|
||||
// to file. Only use for test and development.
|
||||
define("CIMAGE_DEBUG", true);
|
||||
define("CIMAGE_DEBUG_FILE", "/tmp/cimage");
|
||||
//define("CIMAGE_DEBUG", false);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -68,10 +62,11 @@ function trace($msg)
|
||||
{
|
||||
$file = CIMAGE_DEBUG_FILE;
|
||||
if (!is_writable($file)) {
|
||||
die("Using trace without a writable logfile. Create the file '$file' and make it writable for the web server.");
|
||||
return;
|
||||
}
|
||||
|
||||
$details = ":" . (string) round((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6) . "ms";
|
||||
$timer = number_format((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6);
|
||||
$details = "{$timer}ms";
|
||||
$details .= ":" . round(memory_get_peak_usage()/1024/1024, 3) . "MB";
|
||||
$details .= ":" . count(get_included_files());
|
||||
file_put_contents($file, "$details:$msg\n", FILE_APPEND);
|
||||
@@ -4316,6 +4311,11 @@ if (is_file($configFile)) {
|
||||
$config = array();
|
||||
}
|
||||
|
||||
// Make CIMAGE_DEBUG false by default, if not already defined
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
define("CIMAGE_DEBUG", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -13,12 +13,17 @@ if (is_file($configFile) && is_readable($configFile)) {
|
||||
$config = require $configFile;
|
||||
} elseif (!isset($config)) {
|
||||
$config = array(
|
||||
"debug" => false,
|
||||
"fast_track_allow" => true,
|
||||
"autoloader" => __DIR__ . "/../autoload.php",
|
||||
"cache_path" => __DIR__ . "/../cache/",
|
||||
);
|
||||
}
|
||||
|
||||
// Make CIMAGE_DEBUG false by default, if not already defined
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
define("CIMAGE_DEBUG", false);
|
||||
}
|
||||
|
||||
// Debug mode needs additional functions
|
||||
if (CIMAGE_DEBUG) {
|
||||
require $config["autoloader"];
|
||||
@@ -37,6 +42,9 @@ $query = $_GET;
|
||||
// Do not use cache when no-cache is active
|
||||
$useCache = !(array_key_exists("no-cache", $query) || array_key_exists("nc", $query));
|
||||
|
||||
// Only use cache if enabled by configuration
|
||||
$useCache = $useCache && isset($config["fast_track_allow"]) && $config["fast_track_allow"] === true;
|
||||
|
||||
// Remove parts from querystring that should not be part of filename
|
||||
$clear = array("nc", "no-cache");
|
||||
foreach ($clear as $value) {
|
||||
|
1
webroot/imgf_config.php
Symbolic link
1
webroot/imgf_config.php
Symbolic link
@@ -0,0 +1 @@
|
||||
img_config.php
|
@@ -43,12 +43,6 @@ define("CIMAGE_VERSION", "v0.7.13 (2016-08-08)");
|
||||
// For CRemoteImage
|
||||
define("CIMAGE_USER_AGENT", "CImage/" . CIMAGE_VERSION);
|
||||
|
||||
// Change to true to enable debug mode which logs additional information
|
||||
// to file. Only use for test and development.
|
||||
define("CIMAGE_DEBUG", true);
|
||||
define("CIMAGE_DEBUG_FILE", "/tmp/cimage");
|
||||
//define("CIMAGE_DEBUG", false);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -68,10 +62,11 @@ function trace($msg)
|
||||
{
|
||||
$file = CIMAGE_DEBUG_FILE;
|
||||
if (!is_writable($file)) {
|
||||
die("Using trace without a writable logfile. Create the file '$file' and make it writable for the web server.");
|
||||
return;
|
||||
}
|
||||
|
||||
$details = ":" . (string) round((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6) . "ms";
|
||||
$timer = number_format((microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]), 6);
|
||||
$details = "{$timer}ms";
|
||||
$details .= ":" . round(memory_get_peak_usage()/1024/1024, 3) . "MB";
|
||||
$details .= ":" . count(get_included_files());
|
||||
file_put_contents($file, "$details:$msg\n", FILE_APPEND);
|
||||
@@ -4316,6 +4311,11 @@ if (is_file($configFile)) {
|
||||
$config = array();
|
||||
}
|
||||
|
||||
// Make CIMAGE_DEBUG false by default, if not already defined
|
||||
if (!defined("CIMAGE_DEBUG")) {
|
||||
define("CIMAGE_DEBUG", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user