remove runtime-coverage -- when we want coverage, we enable it at the PHP runtime level
This commit is contained in:
parent
d749784e95
commit
3c78b5685e
3 changed files with 0 additions and 73 deletions
|
@ -22,7 +22,6 @@ _d("DATABASE_DSN", null); // string PDO database connection details
|
|||
_d("DATABASE_TIMEOUT", 10000);// int Time to wait for each statement to complete
|
||||
_d("CACHE_DSN", null); // string cache connection details
|
||||
_d("DEBUG", false); // boolean print various debugging details
|
||||
_d("COVERAGE", false); // boolean activate xdebug coverage monitor
|
||||
_d("CACHE_HTTP", false); // boolean output explicit HTTP caching headers
|
||||
_d("COOKIE_PREFIX", 'shm'); // string if you run multiple galleries with non-shared logins, give them different prefixes
|
||||
_d("SPEED_HAX", false); // boolean do some questionable things in the name of performance
|
||||
|
|
|
@ -322,42 +322,6 @@ function transload(string $url, string $mfile): ?array
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the active contents of a .php file
|
||||
*/
|
||||
function manual_include(string $fname): ?string
|
||||
{
|
||||
static $included = [];
|
||||
|
||||
if (!file_exists($fname)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (in_array($fname, $included)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$included[] = $fname;
|
||||
|
||||
print "$fname\n";
|
||||
|
||||
$text = file_get_contents($fname);
|
||||
|
||||
// we want one continuous file
|
||||
$text = str_replace('<'.'?php', '', $text);
|
||||
$text = str_replace('?'.'>', '', $text);
|
||||
|
||||
// most requires are built-in, but we want /lib separately
|
||||
$text = str_replace('require_', '// require_', $text);
|
||||
$text = str_replace('// require_once "lib', 'require_once "lib', $text);
|
||||
|
||||
// @include_once is used for user-creatable config files
|
||||
$text = preg_replace('/@include_once "(.*)";/e', "manual_include('$1')", $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
function path_to_tags(string $path): string
|
||||
{
|
||||
$matches = [];
|
||||
|
@ -562,11 +526,6 @@ date and you should plan on moving elsewhere.
|
|||
$tracer_enabled = constant('TRACE_FILE')!==null;
|
||||
$_tracer = new EventTracer();
|
||||
|
||||
if (COVERAGE) {
|
||||
_start_coverage();
|
||||
register_shutdown_function("_end_coverage");
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI == 'phpdbg') {
|
||||
|
@ -666,36 +625,6 @@ function _get_query(): string
|
|||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* Code coverage *
|
||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
function _start_coverage(): void
|
||||
{
|
||||
if (function_exists("xdebug_start_code_coverage")) {
|
||||
#xdebug_start_code_coverage(XDEBUG_CC_UNUSED|XDEBUG_CC_DEAD_CODE);
|
||||
xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
|
||||
}
|
||||
}
|
||||
|
||||
function _end_coverage(): void
|
||||
{
|
||||
if (function_exists("xdebug_get_code_coverage")) {
|
||||
// Absolute path is necessary because working directory
|
||||
// inside register_shutdown_function is unpredictable.
|
||||
$absolute_path = dirname(dirname(__FILE__)) . "/data/coverage";
|
||||
if (!file_exists($absolute_path)) {
|
||||
mkdir($absolute_path);
|
||||
}
|
||||
$n = 0;
|
||||
$t = time();
|
||||
while (file_exists("$absolute_path/$t.$n.log")) {
|
||||
$n++;
|
||||
}
|
||||
file_put_contents("$absolute_path/$t.$n.log", gzdeflate(serialize(xdebug_get_code_coverage())));
|
||||
}
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* HTML Generation *
|
||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
|
|
@ -6,7 +6,6 @@ define("DATABASE_DSN", null);
|
|||
define("DATABASE_TIMEOUT", 10000);
|
||||
define("CACHE_DSN", null);
|
||||
define("DEBUG", false);
|
||||
define("COVERAGE", false);
|
||||
define("CACHE_HTTP", false);
|
||||
define("COOKIE_PREFIX", 'shm');
|
||||
define("SPEED_HAX", false);
|
||||
|
|
Reference in a new issue