Browse Source

trunk->1.0: merged coverager

* [184] fix tplcov
 * [176] leaked by outfilename (efree by zend_mm tho) 
 * [175] remove double Content-Language 
 * [174] avoid double slash 
 * [173] make dir ended with dir sep 
 * [172] DIRECTORY_SEPARATOR for coverager config example 


git-svn-id: svn://svn.lighttpd.net/xcache/branches/1.0@240 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.0
Xuefer 15 years ago
parent
commit
d90f15bd63
  1. 1
      coverager.c
  2. 8
      coverager/config.php.example
  3. 6
      coverager/coverager.php
  4. 2
      coverager/coverager.tpl.php

1
coverager.c

@ -233,6 +233,7 @@ void xc_coverager_request_shutdown(TSRMLS_D) /* {{{ */
xc_coverager_save_cov(ZSTR_S(s), outfilename, *pcov TSRMLS_CC);
zend_hash_move_forward(XG(coverages));
}
efree(outfilename);
}
zend_hash_destroy(XG(coverages));

8
coverager/config.php.example

@ -12,7 +12,13 @@ $usecache = false;
function ob_filter_path_nicer($o)
{
$o = str_replace("/home/", "{H}/", $o);
$sep = DIRECTORY_SEPARATOR;
$o = str_replace($_SERVER['DOCUMENT_ROOT'], "{DOCROOT}$sep", $o);
$xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
$o = str_replace($xcachedir . $sep, "{XCache}$sep", $o);
if ($sep == '/') {
$o = str_replace("/home/", "{H}/", $o);
}
return $o;
}

6
coverager/coverager.php

@ -57,7 +57,9 @@ class XcacheCoverageViewer
$this->path = isset($_GET['path']) ? $_GET['path'] : '';
$this->path = preg_replace('!\.{2,}!', '.', $this->path);
$this->path = preg_replace('![\\\\/]{2,}!', '/', $this->path);
$qsep = preg_quote(DIRECTORY_SEPARATOR, '!');
$this->path = preg_replace("![\\\\$qsep]{2,}!", DIRECTORY_SEPARATOR, $this->path);
$this->path = preg_replace("!$qsep$!", '', $this->path);
if ($this->path == '/') {
$this->path = '';
}
@ -113,7 +115,7 @@ class XcacheCoverageViewer
list($tplfile, $tpllines, $tplcov) = $this->loadTplCov($fileinfo['cov'], substr($this->outpath, $this->datadir_len));
if ($tplfile) {
$tplcov = sprint_cov($tplinfo['tplcov'], $tpllines);
$tplcov = sprint_cov($tplcov, $tpllines);
unset($tpllines);
}
}

2
coverager/coverager.tpl.php

@ -1,7 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<?php
echo <<<HEAD
<meta http-equiv="Content-Type" content="text/html; charset=$this->charset" />
@ -60,6 +59,7 @@ function dir_row($info, $srcdir)
{
global $cycle;
if ($info['files'] || $info['todos']) {
$srcdir .= DIRECTORY_SEPARATOR;
$c = $cycle->next();
$srcdir_html = htmlspecialchars($srcdir);
$todos = number_format($info['todos']);

Loading…
Cancel
Save