[git] web/qa.git branch master updated. f86cd45

From: Date: Sun, 04 Mar 2012 14:02:37 +0000
Subject: [git] web/qa.git branch master updated. f86cd45
Groups: php.qa 
Request: Send a blank email to php-qa+get-66123@lists.php.net to get a copy of this message
The branch, master on web/qa.git has been updated via f86cd454b3a03c71fe95bb5aa4dcaff785b3ff1e (commit) from 9a75747f853a3be54cfd6bd0ac6d63b3be9da4c4 (commit) http://git.php.net/?p=web/qa.git;a=log;h=f86cd454b3a03c71fe95bb5aa4dcaff785b3ff1e;hp=9a75747f853a3be54cfd6bd0ac6d63b3be9da4c4 Summary of changes: .gitignore | 1 + reports/index.php | 13 +++++++---- reports/parserfunc.php | 4 +++ reports/reportsfunctions.php | 48 ++++++++++++++++++++++++----------------- 4 files changed, 41 insertions(+), 25 deletions(-) -- Log ---------------------------------------- commit f86cd454b3a03c71fe95bb5aa4dcaff785b3ff1e Author: Olivier Doucet <odoucet@php.net> Date: Sun Mar 4 14:53:06 2012 +0100 add cache on reports index use datetime instead of date for last report date (more accurate) diff --git a/.gitignore b/.gitignore index f981b00..8322433 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ reports/db/*.sqlite +reports/db/*.cache diff --git a/reports/index.php b/reports/index.php index 37bd579..ba7492f 100644 --- a/reports/index.php +++ b/reports/index.php @@ -50,7 +50,7 @@ if (isset($_GET['version'])) { } $failedTestsArray = array(); $query = 'SELECT test_name,COUNT(failed.id) as cpt,COUNT(DISTINCT diff) as variations, - date(date) as date FROM failed,reports WHERE failed.id_report = reports.id + datetime(date) as date FROM failed,reports WHERE failed.id_report = reports.id GROUP BY test_name ORDER BY cpt DESC LIMIT ' . $limit; $q = @$database->query($query); if (!$q) die("Error querying DB: ".$database->lastErrorMsg()); @@ -94,15 +94,14 @@ if (!$getVersion) { </thead> <tbody> <?php - uksort($reportsPerVersion, 'version_compare'); - +$maxReportDate = 0; foreach ($reportsPerVersion as $version => $line) { if (version_compare($version, '5.3.8', '<')) { continue; } - + if ($maxReportDate < strtotime($line['lastReport'])) $maxReportDate = strtotime($line['lastReport']); echo '<tr>'; echo '<td><a href="./?version='.$version.'">'.$version.'</a></td>'; echo '<td align="right">'.$line['nbReports'].'</td>'; @@ -139,7 +138,10 @@ foreach ($reportsPerVersion as $version => $line) { <tbody> <?php $i = 0; + $maxReportDate = 0; foreach ($failedTestsArray as $line) { + if ($maxReportDate < strtotime($line['date'])) $maxReportDate = strtotime($line['date']); + echo ' <tr '; if ($i % 2) echo 'style="background-color: #ffcc66" '; echo '><td>'.$line['test_name'].'</td>'; @@ -169,7 +171,8 @@ foreach ($reportsPerVersion as $version => $line) { </div> <?php -$SITE_UPDATE = date('D M d H:i:s Y T', filemtime(__FILE__))."<br />". +// Last update = date of last report in this very page +$SITE_UPDATE = date('D M d H:i:s Y T', $maxReportDate)."<br />". "Generated in ".round((microtime(true)-$startTime)*1000)." ms"; common_footer(); diff --git a/reports/parserfunc.php b/reports/parserfunc.php index ffa4288..b7babbc 100644 --- a/reports/parserfunc.php +++ b/reports/parserfunc.php @@ -107,6 +107,10 @@ function insertToDb_phpmaketest($array, $QA_RELEASES = array()) } $dbi->close(); + + // remove cache + if (file_exists($dbFile.'.cache')) + unlink($dbFile.'.cache'); } return true; } diff --git a/reports/reportsfunctions.php b/reports/reportsfunctions.php index fcb8000..ef9b65b 100644 --- a/reports/reportsfunctions.php +++ b/reports/reportsfunctions.php @@ -134,26 +134,34 @@ function get_summary_data($mode = QA_REPORT_FILTER_ALL) foreach ($it as $version => $database_file) { - $database = new SQLite3($database_file, SQLITE3_OPEN_READONLY); - //retrieve data - $query = $database->query( - "SELECT COUNT(*) AS nbReports, MAX(date) AS lastReport FROM reports" - ); - if (!$query) - die("An error occured when reading summary data from $version DB file."); - $row = $query->fetchArray(SQLITE3_ASSOC); - $data[$version] = $row; - - $query = $database->query( - "select count(distinct test_name) as nbFailingTests, count(*) as nbFailures from failed" - ); - if (!$query) - die("An error occured when reading failingTest data from $version DB file."); - $row = $query->fetchArray(SQLITE3_ASSOC); - $data[$version]['nbFailingTests'] = $row['nbFailingTests']; - $data[$version]['nbFailures'] = $row['nbFailures']; - - $database->close(); + if (!file_exists($database_file.'.cache') || + !($dataSerialize = unserialize(file_get_contents($database_file.'.cache')))) { + + $database = new SQLite3($database_file, SQLITE3_OPEN_READONLY); + //retrieve data + $query = $database->query( + "SELECT COUNT(*) AS nbReports, MAX(date) AS lastReport FROM reports" + ); + if (!$query) + die("An error occured when reading summary data from $version DB file."); + $row = $query->fetchArray(SQLITE3_ASSOC); + $data[$version] = $row; + + $query = $database->query( + "select count(distinct test_name) as nbFailingTests, count(*) as nbFailures from failed" + ); + if (!$query) + die("An error occured when reading failingTest data from $version DB file."); + $row = $query->fetchArray(SQLITE3_ASSOC); + $data[$version]['nbFailingTests'] = $row['nbFailingTests']; + $data[$version]['nbFailures'] = $row['nbFailures']; + + $database->close(); + // write cache data + file_put_contents($database_file.'.cache', serialize($data[$version])); + } else { + $data[$version] = $dataSerialize; + } } return $data; } Thank you for your contribution.

« previous php.qa (#66123) next »