Skip to content

Commit

Permalink
Remove backported revcheck compatibility (#176)
Browse files Browse the repository at this point in the history
includes `chmonly` and some `reserved.xml`  as tracked files for translation. Changes counting on translators table.
  • Loading branch information
alfsb authored Nov 14, 2024
1 parent bee795d commit b457f42
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 70 deletions.
8 changes: 4 additions & 4 deletions scripts/revcheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ function print_html_header( RevcheckData $data )
<body>
<div id="header" style="background-color: #9999CC;">
<h1 style="margin: 0; padding: 0.5em;">Status of the translated PHP Manual</h1>
<p style="font-size: small; margin: 0; padding: 1em;">Generated: $date / Language: $lang</p>
<h1 style="margin: 0; padding: 0.5em;">Status of the PHP Manual $lang translation</h1>
<p style="margin: 0; padding: 0 1em 1em 1em;">Generated: $date</p>
</div>
HTML;
}
Expand Down Expand Up @@ -133,9 +133,9 @@ function print_html_translators( RevcheckData $data )
<th colspan=4>Files maintained</th>
</tr>
<tr>
<th>upto-<br/>date</th> <!-- STATUS_COUNT_MISMATCH <th>ok</th> -->
<th>ok</th>
<th>old</th>
<th>wip</th> <!-- STATUS_COUNT_MISMATCH <th>misc</th> -->
<th>misc</th>
<th>sum</th>
</tr>
HTML;
Expand Down
7 changes: 0 additions & 7 deletions scripts/translation/lib/RevcheckIgnore.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ public static function ignore( $filename ) : bool
if ( $filename == "reference/datetime/timezones.xml" )
return true;

if ( IGNORE_EXTENSIONS_XML )
if ( str_ends_with( $filename , '/extensions.xml') ) // track/count backport
return true;
if ( IGNORE_CHMONLY_DIR )
if ( str_starts_with( $filename , 'chmonly/') ) // track/count backport
return true;

// Only in translations

if ( $filename == "translation.xml" )
Expand Down
20 changes: 4 additions & 16 deletions scripts/translation/lib/RevcheckRun.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,29 +182,17 @@ private function addData( RevcheckFileInfo $info , RevtagInfo|null $revtag = nul

$translator = $this->revData->getTranslator( $revtag->maintainer );

switch( $info->status ) // counts
switch( $info->status )
{
case RevcheckStatus::TranslatedOk: // ready and synced
case RevcheckStatus::TranslatedOk:
$translator->countOk++;
break;
case RevcheckStatus::TranslatedOld: // ready and outdated
case RevcheckStatus::TranslatedOld:
$translator->countOld++;
break;
// STATUS_COUNT_MISMATCH count correct
// default: // all other cases
// $translator->countOther++;

// STATUS_COUNT_MISMATCH backported behaviour
case RevcheckStatus::RevTagProblem: // STATUS_COUNT_MISMATCH backported behaviour
$translator->countOld++; // RevTagProblem into Old (generated diff link fails)
break;
case RevcheckStatus::NotInEnTree: // STATUS_COUNT_MISMATCH backported behaviour
break; // Not counted, but files are listed anyways...
default:
if ( $revtag->status != "ready" ); // STATUS_COUNT_MISMATCH backported behaviour
$translator->countOther++; // The exception of all cases, and also not ready.
$translator->countOther++;
break;
// STATUS_COUNT_MISMATCH backported behaviour
}

switch( $info->status ) // adds,dels
Expand Down
43 changes: 0 additions & 43 deletions scripts/translation/lib/backport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,11 @@

// Constants

const IGNORE_CHMONLY_DIR = true;
const IGNORE_EXTENSIONS_XML = true;
const STATUS_COUNT_MISMATCH = true;
const LOOSE_SKIP_REVCHECK = true;
const FIXED_SKIP_REVCHECK = true;

// Documentation

/* # IGNORE_CHMONLY_DIR
The chmonly/ dir contains files that appears to be
translatable. See recent efforts to re-enabling
CHM build: https://github.com/php/doc-base/pull/163
*/

/* # IGNORE_EXTENSIONS_XML
The actual revcheck ignores any files called extensions.xml,
but are at least two of files with this name.
- appendices/migration56/extensions.xml (translatable)
- install/windows/legacy/extensions.xml (deleted on en/, exists untracked on translations)
*/

/* # STATUS_COUNT_MISMATCH
The actual revcheck counts "outdated" files in two different ways;
- Only TranslatedOld:
https://github.com/php/doc-base/blob/747c53bf8ec72f27ac1a83ba91bcc390eea2e46a/scripts/revcheck.php#L603
- TranslatedOld + RevTagProblem:
https://github.com/php/doc-base/blob/747c53bf8ec72f27ac1a83ba91bcc390eea2e46a/scripts/revcheck.php#L134
This causes a mismatchs between translators totals and file summary.
To make the mismatch smaller, the "wip" column in Translators was
changed to "misc", and so any status other than "ok" and "old"
was added here.
Also, NotInEnTree is missing on first case, and files
in this situation goes uncounted.
Also, RevTagProblem is counted towards as Old, but files
are show in revtag missing/problem list, and is
impossible to generate diffs with invalid hashes... */

assert( STATUS_COUNT_MISMATCH || ! STATUS_COUNT_MISMATCH );

/* # LOOSE_SKIP_REVCHECK
Consider the output of: git show f80105b4fc1196bd8d5fecb98d686b580b1ff65d
Expand Down

0 comments on commit b457f42

Please sign in to comment.