For Programmers: Free Programming Magazines  


Home > Archive > PHP Mirrors > December 2006 > cvs: php-gcov-web /www site.api.php stats.php viewer.php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: php-gcov-web /www site.api.php stats.php viewer.php
Nuno Lopes

2006-12-29, 7:02 pm

nlopess Fri Dec 29 23:01:04 2006 UTC

Added files:
/php-gcov-web/www stats.php

Modified files:
/php-gcov-web/www site.api.php viewer.php
Log:
add a simple stats page (not ready for remote builds..)

http://cvs.php.net/viewvc.cgi/php-g...9&diff_format=u
Index: php-gcov-web/www/site.api.php
diff -u php-gcov-web/www/site.api.php:1.8 php-gcov-web/www/site.api.php:1.9
--- php-gcov-web/www/site.api.php:1.8 Fri Dec 29 20:53:17 2006
+++ php-gcov-web/www/site.api.php Fri Dec 29 23:01:04 2006
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: site.api.php,v 1.8 2006/12/29 20:53:17 nlopess Exp $ */
+/* $Id: site.api.php,v 1.9 2006/12/29 23:01:04 nlopess Exp $ */

// File: Core Site API File
// Desc: contains core display functions, it is essential for all pages to include this file.
@@ -61,7 +61,6 @@
function time_diff($time, $abs=false)
{
if ($abs) {
- date_default_timezone_set('UTC');
$time = time() - $time;
}

http://cvs.php.net/viewvc.cgi/php-g...6&diff_format=u
Index: php-gcov-web/www/viewer.php
diff -u php-gcov-web/www/viewer.php:1.5 php-gcov-web/www/viewer.php:1.6
--- php-gcov-web/www/viewer.php:1.5 Thu Dec 21 23:19:03 2006
+++ php-gcov-web/www/viewer.php Fri Dec 29 23:01:04 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: viewer.php,v 1.5 2006/12/21 23:19:03 nlopess Exp $ */
+/* $Id: viewer.php,v 1.6 2006/12/29 23:01:04 nlopess Exp $ */

// Name: GCOV Viewer page
// Desc: page for view PHP version information such as code coverage
@@ -78,6 +78,11 @@
'pagetitle' => 'PHP: Skipped tests for '.$version,
'pagehead' => 'Skipped Tests'
),
+ 'stats' =>
+ array(
+ 'pagetitle' => "Overview of $version",
+ 'pagehead' => "Overview of $version"
+ ),
'system' =>
array(
'pagetitle' => 'PHP: System Info',
@@ -98,7 +103,7 @@
if(isset($_REQUEST['func'])) {
$func = $_REQUEST['func'];
} else {
- $func = isset($username) ? 'system' : 'menu';
+ $func = 'stats';
}
$appvars['site']['func'] = $func;

@@ -211,9 +216,6 @@
$appvars['page']['head'] .= " (builder: $username)";
}

- } elseif ($func === 'menu') {
- $content = 'Please choose one function from the menu on the left.';
-
} else {
// Define page variables
$appvars['page']['title'] = 'PHP: Test and Code Coverage Analysis';

http://cvs.php.net/viewvc.cgi/php-g...=markup&rev=1.1
Index: php-gcov-web/www/stats.php
+++ php-gcov-web/www/stats.php
<?php
/*
+----------------------------------------------------------------------+
| PHP QA GCOV Website |
+----------------------------------------------------------------------+
| Copyright (c) 2005-2006 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Nuno Lopes <nlopess@php.net> |
+----------------------------------------------------------------------+
*/

/* $Id $ */

if (!defined('IN_GCOV_CODE')) exit;

$stmt = $mysqlconn->prepare('SELECT * FROM versions WHERE version_name=?');
$stmt->execute(array($version));
$data = $stmt->fetch();

$buildtime = time_diff($data['version_last_build_time
']);

if ($data['version_last_attempted_build_dat
e'] === $data['version_last_successful_build_dat
e']) {
$buildstatus = '<font color="green"><b>OK</b></font>';
} else {
$buildstatus = '<font color="red"><b>FAILED!</b></font> Please check the <a href="/viewer.php?version='.$version.'&func=compile_results">compile errors</a>';
}


$stmt = $mysqlconn->prepare('SELECT * FROM local_builds NATURAL JOIN versions WHERE version_name=? ORDER BY build_id DESC LIMIT 1');
$stmt->execute(array($version));
$data = $stmt->fetch();

$c_errors = $data['build_numerrors'];
$c_warns = $data['build_numwarnings'];
$coverage = $data['build_percent_code_coverage'];
$test_failures = $data['build_numfailures'];
$valgrind = $data['build_numleaks'];


$content = <<< HTML
<p>
<b>Build Status:</b> $buildstatus<br/>
<b>Last Build Time:</b> $buildtime
</p>
<p>
HTML;

if ($c_errors) {
$content .= "<b>Compile Errors:</b> $c_errors<br/>";
}

$content .= <<< HTML
<b>Compile Warnings:</b> $c_warns<br/>
HTML;

if ($coverage != -1) {
$content .= "<b>Code Coverage:</b> $coverage%<br/>";
}

$content .= <<< HTML
<b>Test Failures:</b> $test_failures<br/>
<b>Valgrind Reports:</b> $valgrind<br/>
</p>
HTML;
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com