com web/doc: Remove division into "critical" and "old" files. Leave just outdated files: include/lib_revcheck.inc.php scripts/ge n_picture_info.php
www/revcheck.php
| From: | sobak@php.net | Date: | Sun, 03 Aug 2014 04:55:52 +0000 |
| Subject: | com web/doc: Remove division into "critical" and "old" files. Leave just outdated files: include/lib_revcheck.inc.php scripts/ge n_picture_info.php www/revcheck.php |
||
| Groups: | php.doc.web | ||
| Request: | Send a blank email to doc-web+get-2410@lists.php.net to get a copy of this message | ||
Commit: d8dbad882a59e41d10bdcf03bed44d2a14b2f442
Author: Sobak <msobaczewski@gmail.com> Sun, 3 Aug 2014 06:55:52 +0200
Parents: 9b51b5166460576a41b2790b453818653fc6555f
Branches: master
Link: http://git.php.net/?p=web/doc.git;a=commitdiff;h=d8dbad882a59e41d10bdcf03bed44d2a14b2f442
Log:
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
Changed paths:
M include/lib_revcheck.inc.php
M scripts/gen_picture_info.php
M www/revcheck.php
Diff:
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 <<<TRANSLATORS_HEAD
@@ -74,8 +72,7 @@ switch($tool) {
</tr>
<tr>
<th>upto-<br>date</th>
-<th>old</th>
-<th>cri-<br>tical</th>
+<th>out-<br>dated</th>
<th>wip</th>
<th>sum</th>
</tr>
@@ -87,8 +84,7 @@ TRANSLATORS_HEAD;
'<td><a
href="/revcheck.php?p=files&user='.$nick.'&lang='.$lang.'">'.$nick.'</a></td>',
'<td>'.(($data['svn'] == 'yes') ? '✓' :
' ').'</td>',
'<td>' , @$files_w[$nick]['uptodate'], '</td>',
- '<td>' , @$files_w[$nick]['old'], '</td>',
- '<td>' , $files_w[$nick]['critical'], '</td>',
+ '<td>' , $files_w[$nick]['outdated'], '</td>',
'<td>', $files_w[$nick]['wip'], '</td>',
'<th>' , @array_sum($files_w[$nick]), '</th>',
'</tr>';
@@ -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');