cvs: php-gcov-web(SOC06) /www .htaccess config.php index.php site.api.php tags.inc viewer.php

From: Date: Tue, 08 Aug 2006 18:23:47 +0000
Subject: cvs: php-gcov-web(SOC06) /www .htaccess config.php index.php site.api.php tags.inc viewer.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-32103@lists.php.net to get a copy of this message
pronych Tue Aug 8 18:23:47 2006 UTC Added files: (Branch: SOC06) /php-gcov-web/www .htaccess Modified files: /php-gcov-web/www config.php index.php site.api.php tags.inc viewer.php Log: Web site update that works alongside the current cron code version

http://cvs.php.net/viewvc.cgi/php-gcov-web/www/config.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/www/config.php diff -u php-gcov-web/www/config.php:1.1.2.1 php-gcov-web/www/config.php:1.1.2.2 --- php-gcov-web/www/config.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/www/config.php Tue Aug 8 18:23:47 2006 @@ -1,14 +1,38 @@ -<?php - -// Set up the key variables -$appvars = array(); // Application variables array -$appvars['site'] = array(); // Application site-specific variable array -$appvars['page'] = array(); // Application page-specific variable array - -// todo: should mytag be considered site-specific or page-specific? -//$appvars['site']['tags'] = array('PHP_4_4', 'PHP_5_1', 'PHP_5_2', 'PHP_HEAD'); -// Define the root directory of the scripts (todo: verify this is needed) -//$appvars['site']['basepath'] = '/var/www/gcov/'; - -// Define the file that contains the text for each PHP version -$appvars['site']['phpvtags'] = 'tags.inc'; +<?php + +// Set up the key variables +$appvars = array(); // Application variables array +$appvars['site'] = array(); // Application site-specific variable array +$appvars['page'] = array(); // Application page-specific variable array + +// todo: should mytag be considered site-specific or page-specific? +//$appvars['site']['tags'] = array('PHP_4_4', 'PHP_5_1', 'PHP_5_2', 'PHP_HEAD'); +// Define the root directory of the scripts (todo: verify this is needed) +//$appvars['site']['basepath'] = '/var/www/gcov/'; + +$user = 'phpgcov'; +$pass = 'phpfi'; +$dsn = 'mysql:host=localhost;dbname=phpqagcov'; + +try +{ + $mysqlconn = new PDO($dsn, $user, $pass); +} +catch(PDOException $e) +{ + echo 'Error: '.$e->getMessage().'<br />'; + exit; +} + +// Define the file that contains the text for each PHP version +$appvars['site']['phpvtags'] = 'tags.inc'; + +// Define links for the side bar (used in site.api.php) + $appvars['site']['sidebarsubitems'] = array( + 'coverage' => 'lcov', + 'compile-results' => 'compile_results', + 'graphs' => 'graph', + 'system' => 'system', + 'test-failures' => 'tests', + 'valgrind' => 'valgrind' + ); http://cvs.php.net/viewvc.cgi/php-gcov-web/www/index.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/www/index.php diff -u php-gcov-web/www/index.php:1.1.2.1 php-gcov-web/www/index.php:1.1.2.2 --- php-gcov-web/www/index.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/www/index.php Tue Aug 8 18:23:47 2006 @@ -1,112 +1,146 @@ -<?php -// Include the site API -include_once 'site.api.php'; - -// Initialize the core components -api_init($appvars); - -// Define page variables -$appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis'; -$appvars['page']['head'] = 'PHP: Test and Code Coverage Analysis'; - -// Function for displaying the tags -function show_link($tag, $link, $path, $file = NULL, $l_time = false) -{ - - if (is_null($file)) - { - $file = $link; - } - $m_time = @filemtime($path. "/$tag/$file"); - if (file_exists($path. "/$tag/$file") && ($l_time === false || $m_time > $l_time)) - { - echo '<td align="left">' - .'<a href="viewer.php?version='.$tag.'&amp;func='.$link.'">' - .date("M d Y H:i:s", $m_time).'</a></td>'; - } - else - { - echo "<td>&nbsp;N/A</td>"; - } - return $m_time; -} - -// Outputs the site header to the screen -api_showheader($appvars); - -?> -<p> -This page is dedicated to automatic PHP code coverage testing. On a regular -basis current CVS snapshots are being built and tested on this machine. -After all tests are done the results are visualized along with a code coverage -analysis. -</p> -<p> -<!-- start links --> -<table class="standard" border="1" cellspacing="0" cellpadding="4"> -<tr> -<th>TAG</th> -<th>coverage</th> -<th>run-tests</th> -<th>make log</th> -<th>running make</th> -<th>Last Make Status</th> -</tr> -<?php - -$path = $appvars['site']['basepath']; - -// Output PHP versions into a table -foreach($appvars['site']['tags'] as $tag) -{ - echo "<tr>"; - echo "<th align='left'>$tag</th>"; - show_link($tag, 'lcov', $path,'index.php'); - show_link($tag, 'run_tests', $path, 'run-tests.html.inc'); - $l_time = show_link($tag, 'make_log', $path, 'make.log'); - show_link($tag, 'make_log_new', $path, 'make.log.new', $l_time); - - // added for last make status - echo "<td>"; - $filepath = $tag.'/last_make_status.inc'; - $fh = @fopen($filepath, 'r'); - // Read file contents - $content = @fread($fh, filesize($filepath)); - if(($content === false) || ($content == '')) - { - $make_last_status = 'N\A'; - } - elseif(trim($content) == strtolower('pass')) - { - $make_last_status = 'Success'; - } - else - { - $make_last_status = 'Failed - check Compile Results'; - } - echo $make_last_status."</td>\n"; - // End additions - echo "</tr>\n"; -} -?> -</table> -<!-- end links --> -</p> -<h1>ToDo</h1> -<p> -<ul> -<li>Integrate gcov testing into PHP_4_4 (<a href='PHP_4_4-gcov-20060323.diff.txt.bz2'>patch</a>)</li> -<li>Running the tests from a cron job (5.1 takes ~25 hours, HEAD takes ~52 hours).</li> -<li>Enable all core extensions.</li> -<li>Integrate PECL extensions.</li> -<li>Integrate PEAR classes.</li> -<li>Integrate external components.</li> -</ul> -</p> -</td> -</tr> - -<?php -// Outputs the site footer to the screen -api_showfooter($appvars); - +<?php +// Include the site API +include_once 'site.api.php'; + +// Initialize the core components +api_init($appvars); + +// Define page variables +$appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis'; +$appvars['page']['head'] = 'PHP: Test and Code Coverage Analysis'; + +// Function for displaying the tags +function show_link($tag, $link, $path, $file = NULL, $l_time = false) +{ + + if (is_null($file)) + { + $file = $link; + } + $m_time = @filemtime($path. "/$tag/$file"); + if (file_exists($path. "/$tag/$file") && ($l_time === false || $m_time > $l_time)) + { + echo '<td align="left">' + .'<a href="viewer.php?version='.$tag.'&amp;func='.$link.'">' + .date("M d Y H:i:s", $m_time).'</a></td>'; + } + else + { + echo "<td>&nbsp;N/A</td>"; + } + return $m_time; +} + +$x = 0; +$phptags = array(); + +$sql = 'SELECT version_id, version_name, version_last_build_time, version_last_attempted_build_date, version_last_successful_build_date FROM versions WHERE'; + +foreach($appvars['site']['tags'] as $tag) +{ + $sql .= ' version_name = ?'; + + if($x < count($appvars['site']['tags'])-1) + { + $sql .= ' OR'; + } + + $phptags[] = $tag; + $x++; +} + +//print_r($phptags); + +$stmt = $mysqlconn->prepare($sql); + +$stmt->execute($phptags); + +// Outputs the site header to the screen + +api_showheader($appvars); + +//die( $sql ); + +?> +<p> +This page is dedicated to automatic PHP code coverage testing. On a regular +basis current CVS snapshots are being built and tested on this machine. +After all tests are done the results are visualized along with a code coverage +analysis. +</p> +<p> +<!-- start links --> +<table class="standard" border="1" cellspacing="0" cellpadding="4"> +<tr> +<th>TAG</th> +<th>Code<br />Coverage</th> +<th>Last Attempted<br />Build Date</th> +<th>Last Successful<br />Build Date</th> +<th>Last Build <br /> Time (seconds)</th> +</tr> +<?php + +$path = $appvars['site']['basepath']; + +// Output PHP versions into a table +//foreach($appvars['site']['tags'] as $tag) +while($row = $stmt->fetch(PDO::FETCH_ORI_NEXT)) +{ + list($version_id, $version_name, $version_last_build_time, $version_last_attempted_build_date, $version_last_successful_build_date) = $row; + + echo "<tr>"; + echo "<th align='left'>$version_name</th>"; + show_link($version_name, 'lcov', $path,'index.php'); + //show_link($tag, 'run_tests', $path, 'run-tests.html.inc'); + //$l_time = show_link($tag, 'make_log', $path, 'make.log'); + //show_link($tag, 'make_log_new', $path, 'make.log.new', $l_time); + echo '<td>'.$version_last_attempted_build_date.'</td>'."\n"; + echo '<td>'.$version_last_successful_build_date.'</td>'."\n"; + echo '<td>'.$version_last_build_time.'</td>'."\n"; + +/* + // added for last make status + echo "<td>"; + $filepath = $tag.'/last_make_status.inc'; + $fh = @fopen($filepath, 'r'); + // Read file contents + $content = @fread($fh, filesize($filepath)); + if(($content === false) || ($content == '')) + { + $make_last_status = 'N\A'; + } + elseif(trim($content) == strtolower('pass')) + { + $make_last_status = 'Success'; + } + else + { + $make_last_status = 'Failed - check Compile Results'; + } + echo $make_last_status."</td>\n"; +*/ + // End additions + echo "</tr>\n"; +} +?> +</table> +<!-- end links --> +</p> +<h1>ToDo</h1> +<p> +<ul> +<li>Integrate gcov testing into PHP_4_4 (<a href='PHP_4_4-gcov-20060323.diff.txt.bz2'>patch</a>)</li> +<li>Running the tests from a cron job (5.1 takes ~25 hours, HEAD takes ~52 hours).</li> +<li>Enable all core extensions.</li> +<li>Integrate PECL extensions.</li> +<li>Integrate PEAR classes.</li> +<li>Integrate external components.</li> +</ul> +</p> +</td> +</tr> + +<?php +// Outputs the site footer to the screen +api_showfooter($appvars); + http://cvs.php.net/viewvc.cgi/php-gcov-web/www/site.api.php?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-gcov-web/www/site.api.php diff -u php-gcov-web/www/site.api.php:1.1.2.1 php-gcov-web/www/site.api.php:1.1.2.2 --- php-gcov-web/www/site.api.php:1.1.2.1 Sat Jul 8 19:25:37 2006 +++ php-gcov-web/www/site.api.php Tue Aug 8 18:23:47 2006 @@ -1,235 +1,220 @@ -<?php -// Project: PHP QA GCOV Website -// File: Core API -// Desc: contains core display functions, essential for all pages to include this file - -// Include core files -include_once 'config.php'; // Includes configuration settings -include_once 'site.funcs.php'; // Includes the site functions - -// Application Initialization Function -// appsvars is passed to the script by reference -function api_init(&$appvars = array()) -{ - - $appvars['site']['mytag'] = null; - - // Load tags from a file and trim new line elements from each element - - //$appvars['site']['tags'] = array_map('rtrim',file($appvars['site']['phpvtags'])); - - // start temp -- attempt to share same tag inc file between php and bash - $filename = 'tags.inc'; - $fh = fopen($filename, 'r'); - $content = fread($fh, filesize($filename)); - fclose($fh); - - $content = trim($content); - - $elements = explode("\n", $content); - $tagarray = array(); - foreach($elements as $element) - { - $elementname = explode(' ', $element); - $appvars['site']['tags'][$elementname[0]] = $elementname[0]; - } - // end temp - - // Creates instances such as the database connection, if needed - - $appvars['page']['headtitle'] = 'PHP: Test and Code Coverage Analysis'; -} - -// Application Header Function -function api_showheader($appvars=array()) -{ - -// start content from main.inc -//$tags = array('PHP_4_4', 'PHP_5_1', 'PHP_5_2', 'PHP_HEAD'); $mytag = NULL; -if (isset($maindir)) -{ - $sub = substr(dirname($_SERVER['SCRIPT_FILENAME']), strlen($maindir) + 1); - $pos = strpos($sub, '/'); - if ($pos) - { - $mytag = substr($sub, 0, $pos); - } -} -// end content from main.inc - -/* echo '<?xml version="1.0" encoding="UTF-8"?>'."\n"; -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -*/ - -?><html> -<head> -<title><?php - // Output the header for the web browser title - if(isset($appvars['page']['title'])) - { - echo $appvars['page']['title']; - } - else - { - echo 'PHP: Test and Code Coverage Analysis'; - } -?></title> -<link rel="stylesheet" href="style.css" /> -<link rel="shortcut icon" href="favicon.ico" /> -</head> -<body bgcolor="#ffffff" text="#000000" link="#000099" alink="#0000ff" vlink="#000099"> -<?php // end content from header.inc ?> - -<!-- start header --> -<table border="0" cellspacing="0" cellpadding="0" width="100%"> -<tr bgcolor="#9999cc"> -<td rowspan="3" align="center" valign="top" width="126"><a href="http://php.net/"><img src="/images/php.gif" alt="PHP" width="120" height="67" hspace="3" vspace="0" /></a></td> -<td valign="top"><img src="/images/spacer.gif" width="1" height="17" border="0" alt="" />&nbsp;</td> -</tr> -<tr bgcolor="#9999cc"> -<td align="left" class="top" valign="middle">&nbsp;<?php - - // header title to the right of the logo - if(isset($appvars['page']['headtitle'])) - { - echo $appvars['page']['headtitle']; - } - else - { - echo 'PHP: Test and Code Coverage analysis'; - } -?></td> -</tr> -<tr bgcolor="#9999cc"> -<td align="right" valign="bottom"><img src="/images/spacer.gif" width="1" height="15" border="0" alt="" /><a href="http://php.net/downloads.php" class="header small">downloads</a> | <a href="http://qa.php.net" class="header small">QA</a> | <a href="http://php.net/docs.php" class="header small">documentation</a> | <a href="http://php.net/FAQ.php" class="header small">faq</a> | <a href="http://php.net/support.php" class="header small">getting help</a> | <a href="http://php.net/mailing-lists.php" class="header small">mailing lists</a> | <a href="http://bugs.php.net/" class="header small">reporting bugs</a> | <a href="http://php.net/sites.php" class="header small">php.net sites</a> | <a href="http://php.net/links.php" class="header small">links</a> | <a href="http://php.net/my.php" class="header small">my php.net</a>&nbsp;</td> -</tr> -<tr><td colspan="2" bgcolor="#000000" height="1"><img src="gfx/spacer.gif" width="1" height="1" border="0" alt="" /></td></tr> -<tr><td colspan="2" bgcolor="#7777cc" class="header small">&nbsp;</td></tr> -<tr><td colspan="2" bgcolor="#000000" height="1"><img src="gfx/spacer.gif" width="1" height="1" border="0" alt="" /></td></tr> - - -</table> -<!-- end header --> - -<?php // end content from header.inc ?> - -<!-- start outer --> -<table border="0" cellspacing="0" cellpadding="0"> -<tr> -<td align="left" valign="top" width="120" bgcolor="#f0f0f0"> -<?php // start content from sidebar.inc ?> - -<!-- start sidebar --> -<table class='sidebartoc' width="100%" cellpadding="2" cellspacing="0" border="0"> -<tr valign="top"><td class="sidebartoc"> -<ul id="sidebartoc"> -<li class="header home"><a href="/">PHP&nbsp;GCOV</a></li> -<?php -$cnt = count($appvars['site']['tags']); -foreach($appvars['site']['tags'] as $tag) -{ - - $cls = ''; - if (!--$cnt && isset($appvars['site']['mytag'])) - { - $cls = 'last'; - } - if ($tag == $appvars['site']['mytag']) - { - if (strlen($cls)) - { - $cls .= ' '; - } - $cls .= 'active'; - } - if (strlen($cls)) - { - $cls = " class='$cls'"; - } - - echo "<li$cls><a href='viewer.php?version=$tag&amp;func=lcov'>$tag</a></li>\n"; - - //echo "<li$cls><a href='/$tag'>$tag</a></li>\n"; -} - -if (isset($appvars['site']['mytag'])) -{ - $subitems = array( - 'coverage' => 'lcov', - //'Run Tests' => 'run_tests', - //'Make Log' => 'make_log', - //'build.sh' => 'build', - 'compile-results' => 'compile_results', - 'system' => 'system', - 'compile-failures' => 'tests', - 'valgrind' => 'valgrind' - ); - - foreach($subitems as $item => $href) - { - $cls = " class='small'"; - // was as below: - //echo "<li$cls><a href='viewer.php?version=$tag&amp;func=$href'>$item</a></li>\n"; - // changed to following: (changes by Daniel Pronych on Jun 9) - echo "<li$cls><a href='viewer.php?version={$appvars['site']['mytag']}&amp;func=$href'>$item</a></li>\n"; - } -} - -?> -</ul> -</td> -</tr> -</table> -<!-- end sidebar --> - -<?php // end content from sidebar.inc ?> - -</td> -<td bgcolor="#cccccc" background="/images/checkerboard.gif" width="1"><img src="/images/spacer.gif" width="1" height="1" border="0" alt="" /></td> -<td align="left" valign="top"> -<table cellpadding="10" cellspacing="0" width="100%"><tr><td align="left" valign="top"> - -<!-- start content --> -<?php -?> -<h1><?php - // page header that starts the content section - if(isset($appvars['page']['head'])) - { - echo $appvars['page']['head']; - } - else - { - echo 'PHP: Test and Code Coverage analysis'; - } - -?></h1> -<?php - // End header output, content begins next -} - -// Application Footer function -function api_showfooter($appvars = array()) -{ -?> - -</table> -<!-- end content --> -</td> -</tr> -</table> -<!-- end outer --> - -<table border="0" cellspacing="0" cellpadding="6" width="100%"> -<tr valign="top" bgcolor="#cccccc"> -<td><small><a href="http://php.net/copyright.php">Copyright &copy; 2005-<?php echo date("Y"); ?> The PHP Group</a><br />All rights reserved.</small></td> -<td align="right">&nbsp;</td> -</tr> -</table> -</body> -</html> -<?php - // End content footer -} +<?php +// Project: PHP QA GCOV Website +// File: Core API +// Desc: contains core display functions, essential for all pages to include this file + +// Include core files +include_once 'config.php'; // Includes configuration settings +include_once 'site.funcs.php'; // Includes the site functions + +// Application Initialization Function +// appsvars is passed to the script by reference +function api_init(&$appvars = array()) +{ + + $appvars['site']['mytag'] = null; + + // Start loading version tags + $filename = 'tags.inc'; + $fh = fopen($filename, 'r'); + $content = fread($fh, filesize($filename)); + fclose($fh); + + $content = trim($content); + + $elements = explode("\n", $content); + $tagarray = array(); + foreach($elements as $element) + { + $elementname = explode(' ', $element); + $appvars['site']['tags'][$elementname[0]] = $elementname[0]; + } + // End version tag loading + + // Creates instances such as the database connection, if needed + + $appvars['page']['headtitle'] = 'PHP: Test and Code Coverage Analysis'; +} + +// Application Header Function +function api_showheader($appvars=array()) +{ + +// start content from main.inc +//$tags = array('PHP_4_4', 'PHP_5_1', 'PHP_5_2', 'PHP_HEAD'); $mytag = NULL; +if (isset($maindir)) +{ + $sub = substr(dirname($_SERVER['SCRIPT_FILENAME']), strlen($maindir) + 1); + $pos = strpos($sub, '/'); + if ($pos) + { + $mytag = substr($sub, 0, $pos); + } +} +// end content from main.inc + +/* +echo '<?xml version="1.0" encoding="UTF-8"?>'."\n" +.'<!DOCTYPE html'."\n\t" +.'PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'."\n\t" +.'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; +*/ + +echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n"; + +?><html> +<head> +<title><?php + // Output the header for the web browser title + if(isset($appvars['page']['title'])) + { + echo $appvars['page']['title']; + } + else + { + echo 'PHP: Test and Code Coverage Analysis'; + } +?></title> +<link rel="stylesheet" href="style.css" /> +<link rel="shortcut icon" href="favicon.ico" /> +</head> +<body bgcolor="#ffffff" text="#000000" link="#000099" alink="#0000ff" vlink="#000099"> +<?php // end content from header.inc ?> + +<!-- start header --> +<table border="0" cellspacing="0" cellpadding="0" width="100%"> +<tr bgcolor="#9999cc"> +<td rowspan="3" align="center" valign="top" width="126"><a href="http://php.net/"><img src="/images/php.gif" alt="PHP" width="120" height="67" hspace="3" vspace="0" /></a></td> +<td valign="top"><img src="/images/spacer.gif" width="1" height="17" border="0" alt="" />&nbsp;</td> +</tr> +<tr bgcolor="#9999cc"> +<td align="left" class="top" valign="middle">&nbsp;<?php + + // header title to the right of the logo + if(isset($appvars['page']['headtitle'])) + { + echo $appvars['page']['headtitle']; + } + else + { + echo 'PHP: Test and Code Coverage analysis'; + } +?></td> +</tr> +<tr bgcolor="#9999cc"> +<td align="right" valign="bottom"><img src="/images/spacer.gif" width="1" height="15" border="0" alt="" /><a href="http://php.net/downloads.php" class="header small">downloads</a> | <a href="http://qa.php.net" class="header small">QA</a> | <a href="http://php.net/docs.php" class="header small">documentation</a> | <a href="http://php.net/FAQ.php" class="header small">faq</a> | <a href="http://php.net/support.php" class="header small">getting help</a> | <a href="http://php.net/mailing-lists.php" class="header small">mailing lists</a> | <a href="http://bugs.php.net/" class="header small">reporting bugs</a> | <a href="http://php.net/sites.php" class="header small">php.net sites</a> | <a href="http://php.net/links.php" class="header small">links</a> | <a href="http://php.net/my.php" class="header small">my php.net</a>&nbsp;</td> +</tr> +<tr><td colspan="2" bgcolor="#000000" height="1"><img src="gfx/spacer.gif" width="1" height="1" border="0" alt="" /></td></tr> +<tr><td colspan="2" bgcolor="#7777cc" class="header small">&nbsp;</td></tr> +<tr><td colspan="2" bgcolor="#000000" height="1"><img src="gfx/spacer.gif" width="1" height="1" border="0" alt="" /></td></tr> + +</table> +<!-- end header --> + +<?php // end content from header.inc ?> + +<!-- start outer --> +<table border="0" cellspacing="0" cellpadding="0"> +<tr> +<td align="left" valign="top" width="120" bgcolor="#f0f0f0"> +<?php // start content from sidebar.inc ?> + +<!-- start sidebar --> +<table class='sidebartoc' width="100%" cellpadding="2" cellspacing="0" border="0"> +<tr valign="top"><td class="sidebartoc"> +<ul id="sidebartoc"> +<li class="header home"><a href="/">PHP&nbsp;GCOV</a></li> +<?php +$cnt = count($appvars['site']['tags']); +foreach($appvars['site']['tags'] as $tag) +{ + + $cls = ''; + if (!--$cnt && isset($appvars['site']['mytag'])) + { + $cls = 'last'; + } + if ($tag == $appvars['site']['mytag']) + { + if (strlen($cls)) + { + $cls .= ' '; + } + $cls .= 'active'; + } + if (strlen($cls)) + { + $cls = " class='$cls'"; + } + + echo "<li$cls><a href='viewer.php?version=$tag&amp;func=lcov'>$tag</a></li>\n"; + + //echo "<li$cls><a href='/$tag'>$tag</a></li>\n"; +} + +if (isset($appvars['site']['mytag'])) +{ + + foreach($appvars['site']['sidebarsubitems'] as $item => $href) + { + $cls = " class='small'"; + echo "<li$cls><a href='viewer.php?version={$appvars['site']['mytag']}&amp;func=$href'>$item</a></li>\n"; + } +} + +?> +</ul> +</td> +</tr> +</table> +<!-- end sidebar --> + +<?php // end content from sidebar.inc ?> + +</td> +<td bgcolor="#cccccc" background="/images/checkerboard.gif" width="1"><img src="/images/spacer.gif" width="1" height="1" border="0" alt="" /></td> +<td align="left" valign="top"> +<table cellpadding="10" cellspacing="0" width="100%"><tr><td align="left" valign="top"> + +<!-- start content --> +<?php +?> +<h1><?php + // page header that starts the content section + if(isset($appvars['page']['head'])) + { + echo $appvars['page']['head']; + } + else + { + echo 'PHP: Test and Code Coverage analysis'; + } + +?></h1> +<?php + // End header output, content begins next +} + +// Application Footer function +function api_showfooter($appvars = array()) +{ +?> + +</table> +<!-- end content --> +</td> +</tr> +</table> +<!-- end outer --> + +<table border="0" cellspacing="0" cellpadding="6" width="100%"> +<tr valign="top" bgcolor="#cccccc"> +<td><small><a href="http://php.net/copyright.php">Copyright &copy; 2005-<?php echo date("Y"); ?> The PHP Group</a><br />All rights reserved.</small></td> +<td align="right">&nbsp;</td> +</tr> +</table> +</body> +</html> +<?php + // End content footer +} http://cvs.php.net/viewvc.cgi/php-gcov-web/www/tags.inc?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-gcov-web/www/tags.inc diff -u php-gcov-web/www/tags.inc:1.1.2.2 php-gcov-web/www/tags.inc:1.1.2.3 --- php-gcov-web/www/tags.inc:1.1.2.2 Wed Jul 26 04:42:21 2006 +++ php-gcov-web/www/tags.inc Tue Aug 8 18:23:47 2006 @@ -1,5 +1,4 @@ PHP_4_4 /home/quadra23/temp/PHP_4_4 /home/quadra23/temp/tmp/PHP_4_4 /var/local/gcov/www/PHP_4_4 PHP_5_1 /home/quadra23/temp/PHP_5_1 /home/quadra23/temp/tmp/PHP_5_1 /var/local/gcov/www/PHP_5_1 PHP_5_2 /home/quadra23/temp/PHP_5_2 /home/quadra23/temp/tmp/PHP_5_2 /var/local/gcov/www/PHP_5_2 -PHP_5_E /home/quadra23/temp/PHP_5_E /home/quadra23/temp/tmp/PHP_5_E /var/local/gcov/www/PHP_5_E PHP_HEAD /home/quadra23/temp/PHP_HEAD /home/quadra23/temp/tmp/PHP_HEAD /var/local/gcov/www/PHP_HEAD http://cvs.php.net/viewvc.cgi/php-gcov-web/www/viewer.php?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-gcov-web/www/viewer.php diff -u php-gcov-web/www/viewer.php:1.1.2.2 php-gcov-web/www/viewer.php:1.1.2.3 --- php-gcov-web/www/viewer.php:1.1.2.2 Wed Jul 26 04:42:21 2006 +++ php-gcov-web/www/viewer.php Tue Aug 8 18:23:47 2006 @@ -1,331 +1,370 @@ -<?php -// PHP GCOV Website -// Name: GCOV Viewer page - -// Desc: page for view PHP version information such as code coverage - -// Include the site API -include_once 'site.api.php'; - -// Initialize the core components -api_init($appvars); - -$content = ''; // Stores content collected during execution -$error = ''; // Start by assuming no error has occurred -$file = ''; - -$fn = ''; - -$incfile = ''; - -// Pull in defined variables -$file = $_REQUEST['file']; -$version = $_REQUEST['version']; - -// Define the function array -// each array element starts with the name of the command -// title: page title -// option: options include phpinc (parse file as a PHP include) text (use pre tags) -$func_array = array( - 'compile_results' => - array( - 'option' => 'phpinc', - 'pagetitle' => 'PHP: Compile Results for '.$version, - 'pagehead' => 'Compile Results' - ), - 'make_log' => - array( - 'option' => 'html', - 'pagetitle' => 'PHP: Make Log for'. $version, - 'pagehead' => 'Make Log' - ), - 'valgrind' => - array( - //'file' => 'valgrind', //todo: removing this fixes it - 'option' => 'phpinc', // or text - 'pagetitle' => 'PHP: Valgrind Report for '.$version, - 'pagehead' => 'Valgrind Report' - ), - 'tests' => - array( - 'option' => 'phpinc', - 'pagetitle' => 'PHP: Test Failures for '.$version, - 'pagehead' => 'Test Failures' - ), - 'system' => - array( - 'option' => 'phpinc', - 'pagetitle' => 'PHP: System Info', - 'pagehead' => 'System Info' - ) - ); - -if(isset($_REQUEST['func'])) -{ - $func = $_REQUEST['func']; -} -else -{ - $func = 'lcov'; -} - -// Ensure the version specified is valid (todo: more security required?) -// note: !== false is required since PHP_4.4.1 has the 0th place -if(array_search($version, $appvars['site']['tags']) !== false) -{ - $appvars['site']['mytag'] = $version; - - // todo: make functions an array or similiar - $func_element = array_search($func, $func_array); - - if($func == 'build') - // Displays the build content for this version - { - // Collect file content - $fn = $version.'/build.sh'; - // Open file handle - $fh = @fopen($fn, 'r'); - // Obtain file size - $content = @fread($fh, filesize($fn)); - @fclose($fh); - - // If the file is not readable, set up error content and header - if($content === false) - { - // Define page variables - $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; - $appvars['page']['head'] = $version.': no build file'; - $appvars['page']['headtitle'] = $version; - $content = 'There is no build file available to be read. Please try again in a few minutes.'; - } - else - { - // Define page variables - $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; - $appvars['page']['head'] = $version.': build.sh'; - $appvars['page']['headtitle'] = $version; - $content = "<pre>\n".$content - ."</pre>\n"; - - } // End of content value check - } - - else if(array_key_exists($func,$func_array)) - { - // Determine the file to use - if(isset($func_array[$func]['file'])) - { - $incfile = $func_array[$func]['file']; - } - elseif($file == '') - { - $incfile = $func; - } - else - { - $incfile = basename($file); - } - - // Determine the file path - $filepath = $version.'/'.$incfile.'.inc'; - - // Obtain file contents by the required method - if($func_array[$func]['option'] == 'phpinc') // Parse file as a PHP script - { - ob_start(); - if(file_exists($filepath)) - { - include_once $filepath; - } - $content = ob_get_clean(); - ob_end_flush(); - - if(isset($filename)) - { - $func_array[$func]['pagehead'] .= ' for \''.$filename.'\''; - } - } - else // Treat the file contents as regular text file - { - // Collect file content - $fn = $version.'/build.sh'; - // Open file handle - $fh = @fopen($filepath, 'r'); - // Read file contents - if($func_array[$func]['option'] == 'text') - $content = '<pre>'.@fread($fh, filesize($filepath)).'</pre>'; - else - $content = @fread($fh, filesize($filepath)); - - @fclose($fh); - } - - // Determine title based on success or failure - if(($content == '') || ($content === false)) - { - $appvars['page']['title'] = $func_array[$func]['pagetitle']; - $appvars['page']['head'] = $func_array[$func]['pagehead'].' Data File Not Available'; - $appvars['page']['headtitle'] = $version; - - $content = 'File could not be opened. Please try again in a few minutes, or return to the <a href="viewer.php?version='.$version.'&func='.$func.'">listing</a> page.'; - } - else - { - $appvars['page']['title'] = $func_array[$func]['pagetitle']; - $appvars['page']['head'] = $func_array[$func]['pagehead']; - $appvars['page']['headtitle'] = $version; - } - $content = str_replace($phpdir, 'replaced', $content); - } -/* - else if($func == 'compile_results') - { - if($file == '') - { - $incfile = 'compile_results'; - $appvars['page']['head'] = $version.': Compile Results'; - } - else // todo: ensure path changing is prohibited - { - $incfile = basename($file); - } - - ob_start(); - if(file_exists($version.'/gcc/'.$incfile.'.inc')) - { - include_once $version.'/gcc/'.$incfile.'.inc'; - } - $content = ob_get_clean(); - ob_end_flush(); - - // Check if the file could be opened - if($content == '') - { - // Define page variables - $appvars['page']['title'] = 'PHP: No Compile Result File Available for ' - .$version; - $appvars['page']['head'] = $version.': Unable to Locate Compile Information File'; - $appvars['page']['headtitle'] = $version; - - $content = 'There is no compile result file to open at this time. Please try again in a few iminutes.'; - } - else - { - // Define page variables - $appvars['page']['title'] = 'PHP: Compile Results for '.$version; - if($incfile != 'compile_results') - $appvars['page']['head'] = $version.': Compile Results for \''.$filename.'\''; - //$appvars['page']['head'] = $version.': Compile Errors/Warnings'; - $appvars['page']['headtitle'] = $version; - } - } -*/ - else if($func == 'run_tests') - // Displays run-tests content for this version - { - // Collect file content - $fn = $appvars['site']['basepath'].'/'.$version - .'/run-tests.html.inc'; - // Open file handle - $fh = @fopen($fn, 'r'); - // Obtain file size - $content = @fread($fh, filesize($fn)); - @fclose($fh); - - // If the file is not readable, set up error content and header - if($content === false) - { - // Define page variables - $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; - $appvars['page']['head'] = $version.': no run-tests log'; - $appvars['page']['headtitle'] = $version; - $content = 'There is no run tests log available to be read. Please try again in a few minutes.'; - } - else // If the file was readable, set up page headers - { - // Define page variables - $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; - $appvars['page']['head'] = $version.': run-tests.php report'; - $appvars['page']['headtitle'] = $version; - } // End of content value check - } -/* - else if($func == 'make_log') - // Displays the make log content for this version - { - // Collect file content - $fn = $appvars['site']['basepath'].'/'.$version - .'/make.log'; - - // Open file handle - $fh = @fopen($fn, 'r'); - // Obtain file size - $content = @fread($fh, filesize($fn)); - @fclose($fh); - - // If the file is not readable, set up error content and header - if($content === false) - { - // Define page variables - $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; - $appvars['page']['head'] = $version.': no make log'; - $appvars['page']['headtitle'] = $version; - $content = 'There is no make log available to be read. Please try again in a few minutes.'; - } - else // If the file was readable, set up page headers - { - // Define page variables - $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; - $appvars['page']['head'] = $version.': make log (finished)'; - $appvars['page']['headtitle'] = $version; - } // End of content value check - } -*/ - else if($func == 'lcov') - // Displays the lcov content for this version - { - // Define page variables - $appvars['page']['title'] = 'PHP: '. $version.' Code Coverage Report'; - $appvars['page']['head'] = $version.': Code Coverage Report'; - $appvars['page']['headtitle'] = $version; - - // Collect file content - $content = 'content for code coverage would be here.'; - - // todo: if there is no lcov content, inform user here - } - else - { - // Define page variables - $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis'; - $appvars['page']['head'] = 'PHP function not active'; - - $error .= 'The PHP version specified exists but the function specified does not appear to serve any purpose at this time.'; - } -} -else -{ - // Define page variables - $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis'; - $appvars['page']['head'] = 'PHP version not active'; - - $error .= 'The PHP version specified does not appear to exist on the website.'; -} - -// Outputs the site header to the screen -api_showheader($appvars); - -// If an error occurred the command did not exist -if($error != '') -{ - echo 'Oops! Seems we were unable to execute your command. The following are the errors the system found: <br />'.$error; -} -else -{ - echo $content; -} -?> - -<?php -// Outputs the site footer to the screen -api_showfooter($appvars); +<?php +// PHP GCOV Website +// Name: GCOV Viewer page + +// Desc: page for view PHP version information such as code coverage + +// Include the site API +include_once 'site.api.php'; + +// Initialize the core components +api_init($appvars); + +$content = ''; // Stores content collected during execution +$error = ''; // Start by assuming no error has occurred +$file = ''; + +$fn = ''; + +$incfile = ''; + +// Pull in defined variables +$file = $_REQUEST['file']; +$version = $_REQUEST['version']; + +if(isset($_REQUEST['date'])) +{ + list($year, $month, $day) = split('[^0-9]', $_REQUEST['date'], 3); + + // Ensure each variable is numeric before checking the date + if(is_numeric($month) && (is_numeric($day)) && (is_numeric($year)) + && ($year > 1909)) + { + if(checkdate($month, $day, $year)) + { + $date = $_REQUEST['date']; + } + } +} + +// Define the function array +// each array element starts with the name of the command +// title: page title +// option: options include phpinc (parse file as a PHP include) text (use pre tags) +$func_array = array( + 'compile_results' => + array( + 'option' => 'phpinc', + 'pagetitle' => 'PHP: Compile Results for '.$version, + 'pagehead' => 'Compile Results' + ), + 'php_test_log' => + array( + 'option' => 'text', + 'pagetitle' => 'PHP: Test Log for '. $version, + 'pagehead' => 'Test Log' + ), + 'valgrind' => + array( + 'option' => 'phpinc', // or text at this point + 'pagetitle' => 'PHP: Valgrind Report for '.$version, + 'pagehead' => 'Valgrind Report' + ), + 'tests' => + array( + 'option' => 'phpinc', + 'pagetitle' => 'PHP: Test Failures for '.$version, + 'pagehead' => 'Test Failures' + ), + 'system' => + array( + 'option' => 'phpinc', + 'pagetitle' => 'PHP: System Info', + 'pagehead' => 'System Info' + ) + ); + +if(isset($_REQUEST['func'])) +{ + $func = $_REQUEST['func']; +} +else +{ + $func = 'lcov'; +} + +// Accepts: date in format of YYYY_MM_DD (non-numeric separator character) +// Returns: date in textual format of this example: Jan 1 2006 +function datestring_fromdate($date) +{ + //$retstring = ''; + //if(strlen($date) > 9) + //{ + list($year, $month, $day) = split('[^0-9]', $date, 3); + + // Hour, Minute, Second, Month, Day, Year + $time = mktime(0,0,0,$month,$day,$year); + return date('M j Y', $time); + //} + //else + //{ + //$retstring = false; + //} + //return $retstring; +} + +// Ensure the version specified is valid (todo: more security required?) +// note: !== false is required since PHP_4.4.1 has the 0th place +if(array_search($version, $appvars['site']['tags']) !== false) +{ + $appvars['site']['mytag'] = $version; + + // todo: make functions an array or similiar + $func_element = array_search($func, $func_array); + + if($func == 'build') + // Displays the build content for this version + { + // Collect file content + $fn = $version.'/build.sh'; + // Open file handle + $fh = @fopen($fn, 'r'); + // Obtain file size + $content = @fread($fh, filesize($fn)); + @fclose($fh); + + // If the file is not readable, set up error content and header + if($content === false) + { + // Define page variables + $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; + $appvars['page']['head'] = $version.': no build file'; + $appvars['page']['headtitle'] = $version; + $content = 'There is no build file available to be read. Please try again in a few minutes.'; + } + else + { + // Define page variables + $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; + $appvars['page']['head'] = $version.': build.sh'; + $appvars['page']['headtitle'] = $version; + $content = "<pre>\n".$content + ."</pre>\n"; + + } // End of content value check + } + + else if(@array_key_exists($func,$func_array)) + { + // Determine the file to use + if(isset($func_array[$func]['file'])) + { + $incfile = $func_array[$func]['file']; + } + elseif($file == '') + { + $incfile = $func; + } + else + { + $incfile = basename($file); + } + + // Determine the file path + $filepath = $version.'/'.$incfile.'.inc'; + + // Obtain file contents by the required method + if($func_array[$func]['option'] == 'phpinc') // Parse file as a PHP script + { + ob_start(); + if(file_exists($filepath)) + { + include_once $filepath; + } + $content = ob_get_clean(); + ob_end_flush(); + + if(isset($filename)) + { + $func_array[$func]['pagehead'] .= ' for \''.$filename.'\''; + } + } + else // Treat the file contents as regular text file + { + // Collect file content + $fn = $version.'/build.sh'; + // Open file handle + $fh = @fopen($filepath, 'r'); + // Read file contents + if($func_array[$func]['option'] == 'text') + $content = '<pre>'.@fread($fh, filesize($filepath)).'</pre>'; + else + $content = @fread($fh, filesize($filepath)); + + @fclose($fh); + } + + // Determine title based on success or failure + if(($content == '') || ($content === false)) + { + $appvars['page']['title'] = $func_array[$func]['pagetitle']; + $appvars['page']['head'] = $func_array[$func]['pagehead'].' Data File Not Available'; + $appvars['page']['headtitle'] = $version; + + $content = 'File could not be opened. Please try again in a few minutes, or return to the <a href="viewer.php?version='.$version.'&func='.$func.'">listing</a> page.'; + } + else + { + $appvars['page']['title'] = $func_array[$func]['pagetitle']; + $appvars['page']['head'] = $func_array[$func]['pagehead']; + $appvars['page']['headtitle'] = $version; + } + + // todo: is this correct? + $content = str_replace($phpdir, 'replaced', $content); + } + else if($func == 'graph') + { + // If date is not set display all available dates + // todo: format date as the actual date instead of numbers + if(!isset($date)) + { + $file = $version.DIRECTORY_SEPARATOR.'graph.inc'; + + $dates = @file_get_contents($file); + + $temp_date = ''; + $x = 0; + + while($x < strlen($dates)) + { + //$date = ''; + if(($dates[$x] != "\n") && ($x < strlen($dates))) + { + $temp_date .= $dates[$x]; + } + else + { + $content .= '<a href="viewer.php?version='.$version.'&amp;func=graph&date='.$temp_date.'">'.datestring_fromdate($temp_date).'</a>'.'<br />'; + $temp_date = ''; + } + $x++; + } + + if($dates === false) + { + $content = 'No graphs currently exist for this version.'; + } + + else + { + $content = 'Choose a date to view the associated graphs:<br />'.$content; + } + + $appvars['page']['title'] = 'PHP: '.$version.' Graphs'; + $appvars['page']['head'] = 'Graphs'; + $appvars['page']['headtitle'] = $version; + + } + else // Display the graphs for the specified PHP version and date + { + $datestring = datestring_fromdate($date); + // todo: if graphs don't exist display something else like a not found + if($datestring === false) + { + + $appvars['page']['title'] = 'PHP: '.$version.' Graphs Not Found For '.$datestring; + $appvars['page']['head'] = 'Graphs Not Found For '.$datestring; + $appvars['page']['headtitle'] = $version; + + $content = 'No graphs could be located for this PHP version for the specified date.'; + + } + else + { + $appvars['page']['title'] = 'PHP: '.$version.' Graphs For '.$datestring; + $appvars['page']['head'] = 'Graphs For '.$datestring; + $appvars['page']['headtitle'] = $version; + + $date = basename($date); // ensure a path is not specified here + $content .= '<p>The following images show the changes in number of compile errors, compile warnings, memory leaks and test failures over the past week up to the date of '.$datestring.'.</p>'; + + if(file_exists($version.'/graphs/'.'errors_'.$date.'.png')) + $content .= '<img src="'.$version.'/graphs/'.'errors_'.$date.'.png" />&nbsp;'; + if(file_exists($version.'/graphs/'.'failures_'.$date.'.png')) + $content .= '<img src="'.$version.'/graphs/'.'failures_'.$date.'.png" /><br />'; + if(file_exists($version.'/graphs/'.'memleaks_'.$date.'.png')) + $content .= '<img src="'.$version.'/graphs/'.'memleaks_'.$date.'.png" />&nbsp;'; + if(file_exists($version.'/graphs/'.'warnings_'.$date.'.png')) + $content .= '<img src="'.$version.'/graphs/'.'warnings_'.$date.'.png" /><br />'; + } + } + } + + else if($func == 'run_tests') + // Displays run-tests content for this version + { + // Collect file content + $fn = $appvars['site']['basepath'].'/'.$version + .'/run-tests.html.inc'; + // Open file handle + $fh = @fopen($fn, 'r'); + // Obtain file size + $content = @fread($fh, filesize($fn)); + @fclose($fh); + + // If the file is not readable, set up error content and header + if($content === false) + { + // Define page variables + $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; + $appvars['page']['head'] = $version.': no run-tests log'; + $appvars['page']['headtitle'] = $version; + $content = 'There is no run tests log available to be read. Please try again in a few minutes.'; + } + else // If the file was readable, set up page headers + { + // Define page variables + $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis of '.$version; + $appvars['page']['head'] = $version.': run-tests.php report'; + $appvars['page']['headtitle'] = $version; + } // End of content value check + } + else if($func == 'lcov') + // Displays the lcov content for this version + { + // Define page variables + $appvars['page']['title'] = 'PHP: '. $version.' Code Coverage Report'; + $appvars['page']['head'] = $version.': Code Coverage Report'; + $appvars['page']['headtitle'] = $version; + + // Collect file content + $content = 'content for code coverage would be here.'; + + // todo: if there is no lcov content, inform user here + } + else + { + // Define page variables + $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis'; + $appvars['page']['head'] = 'PHP function not active'; + + $error .= 'The PHP version specified exists but the function specified does not appear to serve any purpose at this time.'; + } +} +else +{ + // Define page variables + $appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis'; + $appvars['page']['head'] = 'PHP version not active'; + + $error .= 'The PHP version specified does not appear to exist on the website.'; +} + +// Outputs the site header to the screen +api_showheader($appvars); + +// If an error occurred the command did not exist +if($error != '') +{ + echo 'Oops! Seems we were unable to execute your command. The following are the errors the system found: <br />'.$error; +} +else +{ + echo $content; +} +?> + +<?php +// Outputs the site footer to the screen +api_showfooter($appvars); http://cvs.php.net/viewvc.cgi/php-gcov-web/www/.htaccess?view=markup&rev=1.1 Index: php-gcov-web/www/.htaccess +++ php-gcov-web/www/.htaccess
« previous php.mirrors (#32103) next »