From d8dbad882a59e41d10bdcf03bed44d2a14b2f442 Mon Sep 17 00:00:00 2001 From: Sobak Date: Sun, 3 Aug 2014 06:55:52 +0200 Subject: [PATCH] Remove division into "critical" and "old" files. Leave just outdated files * "old files" stats were generated incorrectly * "old files" made "critical files" count incorrect * there was no way to display "old files" list * this approach is compatible with PhD OE --- include/lib_revcheck.inc.php | 18 ++++-------------- scripts/gen_picture_info.php | 14 +++++--------- www/revcheck.php | 23 ++++++++--------------- 3 files changed, 17 insertions(+), 38 deletions(-) diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php index 1cf40ae..0495ecf 100644 --- a/include/lib_revcheck.inc.php +++ b/include/lib_revcheck.inc.php @@ -19,10 +19,6 @@ +----------------------------------------------------------------------+ */ -// A file is criticaly "outdated' if -define("ALERT_SIZE", 3); // translation is 3 or more kB smaller than the en one -define("ALERT_DATE", -30); // translation is 30 or more days older than the en one - // Return an array of directory containing outdated files function get_dirs($idx, $lang) { $sql = 'SELECT @@ -214,11 +210,8 @@ function get_translators_stats($idx, $lang, $status) { if ($status == 'uptodate') { $sql .= 'a.revision = b.revision'; } - elseif ($status == 'old') { - $sql .= 'b.revision != a.revision AND b.size - a.size < ' . ALERT_SIZE . ' AND (b.mdate - a.mdate) / 86400 < ' . ALERT_DATE; - } - elseif ($status == 'critical') { - $sql .= 'b.revision != a.revision AND (b.size - a.size >= ' . (1024 * ALERT_SIZE) . ' OR (b.mdate - a.mdate) / 86400 >= ' . ALERT_DATE . ')'; + elseif ($status == 'outdated') { + $sql .= 'b.revision != a.revision'; } $sql .= ' GROUP BY a.maintainer'; @@ -269,11 +262,8 @@ function get_stats($idx, $lang, $status) { if ($status == 'uptodate') { $sql .= 'a.revision = b.revision'; } - elseif ($status == 'old') { - $sql .= 'b.revision != a.revision AND b.size - a.size < ' . ALERT_SIZE . ' AND (b.mdate - a.mdate) / 86400 < ' . ALERT_DATE . ' AND a.size IS NOT NULL'; - } - elseif ($status == 'critical') { - $sql .= 'b.revision != a.revision AND (b.size - a.size >= ' . (1024 * ALERT_SIZE) . ' OR (b.mdate - a.mdate) / 86400 >= ' . ALERT_DATE . ') AND a.revision != "n/a" AND a.size IS NOT NULL'; + elseif ($status == 'outdated') { + $sql .= 'b.revision != a.revision AND a.revision != "n/a" AND a.size IS NOT NULL'; } elseif ($status == 'norev') { $sql .= '(a.revision IS NULL OR a.revision = "n/a") AND a.size IS NOT NULL'; diff --git a/scripts/gen_picture_info.php b/scripts/gen_picture_info.php index 70bafa0..1f4345b 100644 --- a/scripts/gen_picture_info.php +++ b/scripts/gen_picture_info.php @@ -32,11 +32,8 @@ function generate_image($lang, $idx) { $up_to_date = get_stats($idx, $lang, 'uptodate'); $up_to_date = $up_to_date[0]; // - $critical = @get_stats($idx, $lang, 'critical'); - $critical = $critical[0]; - // - $old = @get_stats($idx, $lang, 'old'); - $old = $old[0]; + $outdated = @get_stats($idx, $lang, 'outdated'); + $outdated = $outdated[0]; // $missing = get_stats($idx, $lang, 'notrans'); $missing = $missing[0]; @@ -46,8 +43,7 @@ function generate_image($lang, $idx) { $data = array( $up_to_date, - $critical, - $old, + $outdated, $missing, $no_tag ); @@ -60,7 +56,7 @@ function generate_image($lang, $idx) { $percent[] = round($value * 100 / $total); } - $legend = array($percent[0] . '%% up to date ('.$up_to_date.')', $percent[1] . '%% critical ('.$critical.')', $percent[2] . '%% old ('.$old.')', $percent[3] . '%% missing ('.$missing.')', $percent[4] . '%% without EN-Revision ('.$no_tag.')'); + $legend = array($percent[0] . '%% up to date ('.$up_to_date.')', $percent[1] . '%% outdated ('.$outdated.')', $percent[2] . '%% missing ('.$missing.')', $percent[3] . '%% without EN-Revision ('.$no_tag.')'); $title = 'Details for '.$LANGUAGES[$lang].' PHP Manual'; $graph = new PieGraph(530,300); @@ -84,7 +80,7 @@ function generate_image($lang, $idx) { $graph->AddText($t1); $p1 = new PiePlot3D($data); - $p1->SetSliceColors(array("#68d888", "#ff6347", "#eee8aa", "#dcdcdc", "#f4a460")); + $p1->SetSliceColors(array("#68d888", "#ff6347", "#dcdcdc", "#f4a460")); if ($total_files_lang != $up_to_date) { $p1->ExplodeAll(); } diff --git a/www/revcheck.php b/www/revcheck.php index e690bfe..e709246 100644 --- a/www/revcheck.php +++ b/www/revcheck.php @@ -52,16 +52,14 @@ switch($tool) { } else { $uptodate = get_translators_stats($dbhandle, $lang, 'uptodate'); - $old = get_translators_stats($dbhandle, $lang, 'old'); - $critical = get_translators_stats($dbhandle, $lang, 'critical'); + $outdated = get_translators_stats($dbhandle, $lang, 'outdated'); $wip = get_translators_stats($dbhandle, $lang, 'wip'); foreach($translators as $nick =>$data) { - $files_w[$nick] = array('uptodate' => '', 'old' =>'', 'critical' => '', 'norev' => '', 'wip' => ''); + $files_w[$nick] = array('uptodate' => '', 'outdated' => '', 'norev' => '', 'wip' => ''); $files_w[$nick]['uptodate'] = isset($uptodate[$nick]) ? $uptodate[$nick] : ''; $files_w[$nick]['wip'] = isset($wip[$nick]) ? $wip[$nick] : ''; - $files_w[$nick]['old'] = isset($old[$nick]) ? $old[$nick] : ''; - $files_w[$nick]['critical'] = isset($critical[$nick]) ? $critical[$nick] : ''; + $files_w[$nick]['outdated'] = isset($outdated[$nick]) ? $outdated[$nick] : ''; } echo << upto-
date -old -cri-
tical +out-
dated wip sum @@ -87,8 +84,7 @@ TRANSLATORS_HEAD; ''.$nick.'', ''.(($data['svn'] == 'yes') ? '✓' : ' ').'', '' , @$files_w[$nick]['uptodate'], '', - '' , @$files_w[$nick]['old'], '', - '' , $files_w[$nick]['critical'], '', + '' , $files_w[$nick]['outdated'], '', '', $files_w[$nick]['wip'], '', '' , @array_sum($files_w[$nick]), '', ''; @@ -187,8 +183,7 @@ TRANSLATORS_HEAD; case 'filesummary': $file_types = array( array (REV_UPTODATE, 'Up to date files'), - array (REV_OLD, 'Old files'), - array (REV_CRITICAL, 'Critical files'), + array (REV_OUTDATED, 'Outdated files'), array (REV_WIP, 'Work in progress'), array (REV_NOREV, 'Files without revision number'), array (REV_NOTRANS, 'Files available for translation') @@ -196,8 +191,7 @@ TRANSLATORS_HEAD; $file_summary_array = array( REV_UPTODATE => array(0,0), - REV_CRITICAL => array(0,0), - REV_OLD => array(0,0), + REV_OUTDATED => array(0,0), REV_NOREV => array(0,0), REV_NOTRANS => array(0,0), REV_CREDIT => array(0,0), @@ -205,9 +199,8 @@ TRANSLATORS_HEAD; ); $file_summary_array[REV_WIP] = get_stats($dbhandle, $lang, 'wip'); - $file_summary_array[REV_CRITICAL] = get_stats($dbhandle, $lang, 'critical'); + $file_summary_array[REV_OUTDATED] = get_stats($dbhandle, $lang, 'outdated'); $file_summary_array[REV_UPTODATE] = get_stats($dbhandle, $lang, 'uptodate'); - $file_summary_array[REV_OLD] = get_stats($dbhandle, $lang, 'old'); $file_summary_array[REV_NOREV] = get_stats($dbhandle, $lang, 'norev'); $file_summary_array[REV_NOTRANS] = get_stats($dbhandle, $lang, 'notrans');