mirror of
https://github.com/php/web-doc.git
synced 2025-08-13 14:40:31 +00:00
Links that are not working have been fixed.
Lost wip's have been restored.
This commit is contained in:
@ -23,19 +23,17 @@
|
|||||||
// Return an array of directory containing outdated files
|
// Return an array of directory containing outdated files
|
||||||
function get_dirs($idx, $lang) {
|
function get_dirs($idx, $lang) {
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
b.path AS dir,
|
d.path AS dir
|
||||||
a.name AS name
|
|
||||||
FROM
|
FROM
|
||||||
translated a,
|
translated a,
|
||||||
dirs b
|
dirs d
|
||||||
WHERE
|
WHERE
|
||||||
a.lang = '$lang'
|
a.lang = '$lang'
|
||||||
AND a.id = b.id
|
AND a.id = d.id
|
||||||
AND (a.syncStatus = 'TranslatedOld'
|
AND (a.syncStatus = 'TranslatedOld'
|
||||||
OR a.syncStatus = 'TranslatedCritial'
|
|
||||||
OR a.syncStatus = 'TranslatedWip')
|
OR a.syncStatus = 'TranslatedWip')
|
||||||
ORDER BY
|
ORDER BY
|
||||||
b.id";
|
d.id";
|
||||||
|
|
||||||
$result = $idx->query($sql);
|
$result = $idx->query($sql);
|
||||||
|
|
||||||
@ -53,9 +51,8 @@ function get_outdated_files($idx, $lang, $filter = null, $value = null)
|
|||||||
$sql = "SELECT a.status, a.name AS file, a.maintainer, c.revision AS en_rev, a.revision AS trans_rev, b.path AS dir
|
$sql = "SELECT a.status, a.name AS file, a.maintainer, c.revision AS en_rev, a.revision AS trans_rev, b.path AS dir
|
||||||
FROM translated a, dirs b, enfiles c
|
FROM translated a, dirs b, enfiles c
|
||||||
WHERE a.lang = '$lang'
|
WHERE a.lang = '$lang'
|
||||||
AND c.name = a.name AND c.id = a.id AND b.id = a.id
|
AND c.name = a.name AND b.id = a.id AND b.id = c.id
|
||||||
AND (a.syncStatus = 'TranslatedOld'
|
AND (a.syncStatus = 'TranslatedOld'
|
||||||
OR a.syncStatus = 'TranslatedCritial'
|
|
||||||
OR a.syncStatus = 'TranslatedWip')";
|
OR a.syncStatus = 'TranslatedWip')";
|
||||||
|
|
||||||
if ($filter == 'dir') {
|
if ($filter == 'dir') {
|
||||||
@ -217,26 +214,21 @@ function get_translators($idx, $lang)
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function get_stats($idx, $lang, $status) {
|
function get_stats($idx, $lang, $status) {
|
||||||
|
$sql = "SELECT COUNT(a.name) AS total, SUM(b.size) AS size
|
||||||
|
FROM translated a, enfiles b
|
||||||
|
WHERE a.lang = '$lang' AND a.id = b.id AND a.name = b.name AND ";
|
||||||
if ($status == 'wip') {
|
if ($status == 'wip') {
|
||||||
$sql = "SELECT COUNT(name) AS total, SUM(size) AS size
|
$sql .= "a.syncStatus = 'TranslatedWip'";
|
||||||
FROM wip
|
|
||||||
WHERE lang = '$lang' ";
|
|
||||||
} elseif ($status == 'notrans') {
|
} elseif ($status == 'notrans') {
|
||||||
$sql = "SELECT COUNT(name) AS total, SUM(size) AS size
|
$sql = "SELECT COUNT(name) AS total, SUM(size) AS size
|
||||||
FROM Untranslated
|
FROM Untranslated
|
||||||
WHERE lang = '$lang'";
|
WHERE lang = '$lang'";
|
||||||
} elseif ($status == 'uptodate') {
|
} elseif ($status == 'uptodate') {
|
||||||
$sql = "SELECT COUNT(name) AS total, SUM(size) AS size
|
$sql .= "a.syncStatus = 'TranslatedOk'";
|
||||||
FROM translated
|
|
||||||
WHERE lang = '$lang' AND syncStatus = 'TranslatedOk'";
|
|
||||||
} elseif ($status == 'outdated') {
|
} elseif ($status == 'outdated') {
|
||||||
$sql = "SELECT COUNT(name) AS total, SUM(size) AS size
|
$sql .= "syncStatus = 'TranslatedOld'";
|
||||||
FROM translated
|
|
||||||
WHERE lang = '$lang' AND syncStatus = 'TranslatedOld'";
|
|
||||||
} elseif ($status == 'norev') {
|
} elseif ($status == 'norev') {
|
||||||
$sql = "SELECT COUNT(name) AS total, SUM(size) AS size
|
$sql .= "syncStatus = 'RevTagProblem'";
|
||||||
FROM translated
|
|
||||||
WHERE lang = '$lang' AND syncStatus = 'RevTagProblem'";
|
|
||||||
} else { //notinen
|
} else { //notinen
|
||||||
$sql = "SELECT COUNT(name) AS total, SUM(size) AS size
|
$sql = "SELECT COUNT(name) AS total, SUM(size) AS size
|
||||||
FROM notinen WHERE lang = '$lang'";
|
FROM notinen WHERE lang = '$lang'";
|
||||||
|
@ -113,7 +113,7 @@ TRANSLATORS_HEAD;
|
|||||||
$last_dir = $miss['dir'];
|
$last_dir = $miss['dir'];
|
||||||
}
|
}
|
||||||
$key = $miss['dir'] == '' ? "/" : $miss['dir']."/". $miss['file'];
|
$key = $miss['dir'] == '' ? "/" : $miss['dir']."/". $miss['file'];
|
||||||
echo "<tr><td><a href='/gitweb/?p=doc/en.git;a=blob;f=$key;hb={$miss['revision']}'>{$miss['file']}</a></td><td>{$miss['revision']}</td><td>{$miss['size']}</td></tr>";
|
echo "<tr><td><a href='https://github.com/php/doc-en/blob/{$miss['revision']}/$key'>{$miss['file']}</a></td><td>{$miss['revision']}</td><td>{$miss['size']}</td></tr>";
|
||||||
$total_size += $miss['size'];
|
$total_size += $miss['size'];
|
||||||
// flush every 200 kbytes
|
// flush every 200 kbytes
|
||||||
if (($total_size % 200) == 0)
|
if (($total_size % 200) == 0)
|
||||||
@ -186,40 +186,33 @@ TRANSLATORS_HEAD;
|
|||||||
$files_wip = get_stats($dbhandle, $lang, 'wip');
|
$files_wip = get_stats($dbhandle, $lang, 'wip');
|
||||||
$files_notinen = get_stats($dbhandle, $lang, 'notinen');
|
$files_notinen = get_stats($dbhandle, $lang, 'notinen');
|
||||||
|
|
||||||
|
$files_norev[1] = $files_norev[1] > 0 ? $files_norev[1] : 0;
|
||||||
|
$files_wip[1] = $files_wip[1] > 0 ? $files_wip[1] : 0;
|
||||||
|
$files_notinen[1] = $files_notinen[1] > 0 ? $files_notinen[1] : 0;
|
||||||
|
|
||||||
echo '<table border="0" cellpadding="4" cellspacing="1" style="text-align:center;">';
|
echo '<table border="0" cellpadding="4" cellspacing="1" style="text-align:center;">';
|
||||||
echo '<tr><th>File status type</th><th>Number of files</th><th>Percent of files</th><th>Size of files (kB)</th><th>Percent of size</th></tr>';
|
echo '<tr><th>File status type</th><th>Number of files</th><th>Percent of files</th><th>Size of files (kB)</th><th>Percent of size</th></tr>';
|
||||||
|
|
||||||
$percent[0] = 0;
|
$percent[0] = 0;
|
||||||
$percent[1] = 0;
|
$percent[1] = 0;
|
||||||
#$percent[0] = count_en_files($dbhandle);
|
$count = count_en_files($dbhandle);
|
||||||
|
|
||||||
$percent[0] += $files_uptodate[0];
|
|
||||||
$percent[0] += $files_outdated[0];
|
|
||||||
$percent[0] += $files_norev[0];
|
|
||||||
$percent[0] += $files_notrans[0];
|
|
||||||
$percent[0] += $files_wip[0];
|
|
||||||
$percent[0] += $files_notinen[0];
|
|
||||||
|
|
||||||
$percent[1] += $files_uptodate[1];
|
$percent[1] += $files_uptodate[1];
|
||||||
$percent[1] += $files_outdated[1];
|
$percent[1] += $files_outdated[1];
|
||||||
$percent[1] += $files_norev[1];
|
$percent[1] += $files_norev[1];
|
||||||
$percent[1] += $files_notrans[1];
|
$percent[1] += $files_notrans[1];
|
||||||
$percent[1] += $files_wip[1];
|
$percent[1] += $files_wip[1];
|
||||||
$percent[1] += $files_notinen[1];
|
|
||||||
|
|
||||||
|
$num_uptodate_percent = number_format($files_uptodate[0] * 100 / $count, 2 );
|
||||||
$num_uptodate_percent = number_format($files_uptodate[0] * 100 / $percent[0], 2 );
|
$num_outdated_percent = number_format($files_outdated[0] * 100 / $count, 2 );
|
||||||
$num_outdated_percent = number_format($files_outdated[0] * 100 / $percent[0], 2 );
|
$num_wip_percent = number_format($files_wip[0] * 100 / $count, 2 );
|
||||||
$num_wip_percent = number_format($files_wip[0] * 100 / $percent[0], 2 );
|
$num_norev_percent = number_format($files_norev[0] * 100 / $count, 2 );
|
||||||
$num_norev_percent = number_format($files_norev[0] * 100 / $percent[0], 2 );
|
$num_notrans_percent = number_format($files_notrans[0] * 100 / $count, 2 );
|
||||||
$num_notinen_percent = number_format($files_notinen[0] * 100 / $percent[0], 2 );
|
|
||||||
$num_notrans_percent = number_format($files_notrans[0] * 100 / $percent[0], 2 );
|
|
||||||
|
|
||||||
$size_uptodate_percent = number_format($files_uptodate[1] * 100 / $percent[1], 2 );
|
$size_uptodate_percent = number_format($files_uptodate[1] * 100 / $percent[1], 2 );
|
||||||
$size_outdated_percent = number_format($files_outdated[1] * 100 / $percent[1], 2 );
|
$size_outdated_percent = number_format($files_outdated[1] * 100 / $percent[1], 2 );
|
||||||
$size_wip_percent = number_format($files_wip[1] * 100 / $percent[1], 2 );
|
$size_wip_percent = number_format($files_wip[1] * 100 / $percent[1], 2 );
|
||||||
$size_norev_percent = number_format($files_norev[1] * 100 / $percent[1], 2 );
|
$size_norev_percent = number_format($files_norev[1] * 100 / $percent[1], 2 );
|
||||||
$size_notinen_percent = number_format($files_notinen[1] * 100 / $percent[1], 2 );
|
|
||||||
$size_notrans_percent = number_format($files_notrans[1] * 100 / $percent[1], 2 );
|
$size_notrans_percent = number_format($files_notrans[1] * 100 / $percent[1], 2 );
|
||||||
print <<<HTML
|
print <<<HTML
|
||||||
<tr>
|
<tr>
|
||||||
@ -244,14 +237,14 @@ TRANSLATORS_HEAD;
|
|||||||
<td>Files without revision number</td>
|
<td>Files without revision number</td>
|
||||||
<td>{$files_norev[0]}</td>
|
<td>{$files_norev[0]}</td>
|
||||||
<td>{$num_norev_percent}%</td>
|
<td>{$num_norev_percent}%</td>
|
||||||
<td>{$files_norev[1]}</td>
|
<td>$files_norev[1]</td>
|
||||||
<td>{$size_norev_percent}%</td>
|
<td>{$size_norev_percent}%</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td>Not in EN tree</td>
|
<td>Not in EN tree</td>
|
||||||
<td>{$files_notinen[0]}</td>
|
<td>{$files_notinen[0]}</td>
|
||||||
<td>{$num_notinen_percent}%</td>
|
<td>0.00%</td>
|
||||||
<td>{$files_notinen[1]}</td>
|
<td>{$files_notinen[1]}</td>
|
||||||
<td>{$size_notinen_percent}%</td>
|
<td>0.00%</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<td>Files available for translation </td>
|
<td>Files available for translation </td>
|
||||||
<td>{$files_notrans[0]}</td>
|
<td>{$files_notrans[0]}</td>
|
||||||
@ -260,7 +253,7 @@ TRANSLATORS_HEAD;
|
|||||||
<td>{$size_notrans_percent}%</td>
|
<td>{$size_notrans_percent}%</td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th>Files total</th>
|
<th>Files total</th>
|
||||||
<th>{$percent[0]}</th>
|
<th>$count</th>
|
||||||
<th>100%</th>
|
<th>100%</th>
|
||||||
<th>{$percent[1]}</th
|
<th>{$percent[1]}</th
|
||||||
><th>100%</th>
|
><th>100%</th>
|
||||||
@ -362,15 +355,17 @@ END_OF_MULTILINE;
|
|||||||
if ($r['name'] == '/')
|
if ($r['name'] == '/')
|
||||||
$key = $r['file'];
|
$key = $r['file'];
|
||||||
|
|
||||||
//text
|
// GitHub web diff -- May not work with very old commits
|
||||||
$d1 = "/gitweb/?p=doc/en.git;a=blobdiff_plain;f=$key;hb={$r['en_rev']};hpb={$r['trans_rev']};";
|
$kh = hash( 'sha256' , $key );
|
||||||
//html
|
$d1 = "https://github.com/php/doc-en/compare/{$r['trans_rev']}..{$r['en_rev']}#diff-{$kh}";
|
||||||
$d2 = "/gitweb/?p=doc/en.git;a=blobdiff;f=$key;hb={$r['en_rev']};hpb={$r['trans_rev']};";
|
//plaintext -- Always work
|
||||||
|
$d2 = "?p=plain&lang={$lang}&hbp={$r['trans_rev']}&f=$key";
|
||||||
|
|
||||||
$h1 = "<a href='/gitweb/?p=doc/en.git;a=blob;f=$key;hb={$r['en_rev']}'>{$r['en_rev']}</a>";
|
$h1 = "<a href='https://github.com/php/doc-en/blob/{$r['en_rev']}/$key'>{$r['en_rev']}</a>";
|
||||||
$h2 = "<a href='/gitweb/?p=doc/en.git;a=blob;f=$key;hb={$r['trans_rev']}'>{$r['trans_rev']}</a>";
|
|
||||||
|
|
||||||
$nm = "<a href='$d1'>{$r['file']}</a> <a href='$d2'>(html)</a>";
|
$h2 = "<a href='https://github.com/php/doc-en/blob/{$r['trans_rev']}/$key'>{$r['trans_rev']}</a>";
|
||||||
|
|
||||||
|
$nm = "<a href='$d2'>{$r['file']}</a> <a href='$d1'>[diff]</a>";
|
||||||
|
|
||||||
// Write out the line for the current file (get file name shorter)
|
// Write out the line for the current file (get file name shorter)
|
||||||
echo '<tr>'.
|
echo '<tr>'.
|
||||||
@ -385,6 +380,19 @@ END_OF_MULTILINE;
|
|||||||
echo gen_date($DBLANG);
|
echo gen_date($DBLANG);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'plain':
|
||||||
|
if (isset($_GET['f'])) {
|
||||||
|
$gitfile = $_GET['f'];
|
||||||
|
if (isset($_GET['hbp'])) $h2 = $_GET['hbp'];
|
||||||
|
$cwd = getcwd();
|
||||||
|
chdir( GIT_DIR . 'en' );
|
||||||
|
$file = `git diff {$h2} -- {$gitfile}`;
|
||||||
|
echo "<pre>", htmlspecialchars($file, ENT_QUOTES, 'UTF-8'), "</pre>";
|
||||||
|
chdir( $cwd );
|
||||||
|
}
|
||||||
|
echo gen_date($DBLANG);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'graph':
|
case 'graph':
|
||||||
$path = "images/revcheck/info_revcheck_php_$lang.png";
|
$path = "images/revcheck/info_revcheck_php_$lang.png";
|
||||||
if (is_readable($path)) {
|
if (is_readable($path)) {
|
||||||
|
Reference in New Issue
Block a user