diff --git a/.gitignore b/.gitignore
index 528fe4b73..afc9e7141 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
# Files generated by the configure script
.manual.xml
+.revcheck.json
install-unix.xml
install-win.xml
manual.xml
diff --git a/scripts/revcheck.php b/scripts/revcheck.php
index aba286215..c091775a2 100644
--- a/scripts/revcheck.php
+++ b/scripts/revcheck.php
@@ -20,6 +20,8 @@
+----------------------------------------------------------------------+
*/
+require_once __DIR__ . '/translation/lib/all.php';
+
if ( $argc != 2 )
{
print <<revData;
-$gitData = []; // filename lang hash
-
-$intro = "No intro available for the {$lang} translation of the manual.";
-
-$oldfiles = []; //path, name, size
-
-$enFiles = populateFileTree( 'en' );
-$trFiles = populateFileTree( $lang );
-captureGitValues( 'en' , $gitData );
-
-computeSyncStatus( $enFiles , $trFiles , $gitData , $lang );
-$translators = computeTranslatorStatus( $lang, $enFiles, $trFiles );
-
-print_html_all( $enFiles , $trFiles , $translators, $lang );
-
-// Model
-class OldFilesInfo
-{
- public $path;
- public $name;
- public $size;
-
- public function getKey()
- {
- return trim( $this->path . '/' . $this->name , '/' );
- }
-}
-
-class FileStatusEnum
-{
- const Untranslated = 'Untranslated';
- const RevTagProblem = 'RevTagProblem';
- const TranslatedWip = 'TranslatedWip';
- const TranslatedOk = 'TranslatedOk';
- const TranslatedOld = 'TranslatedOld';
- const NotInEnTree = 'NotInEnTree';
-}
-
-class FileStatusInfo
-{
- public $path;
- public $name;
- public $size;
- public $hash;
- public $skip;
- public $days;
- public $adds;
- public $dels;
- public $syncStatus;
- public $maintainer;
- public $completion;
- public $credits;
-
- public function getKey()
- {
- return trim( $this->path . '/' . $this->name , '/' );
- }
-}
-
-class TranslatorInfo
-{
- public $name;
- public $email;
- public $nick;
- public $vcs;
-
- public $files_uptodate;
- public $files_outdated;
- public $files_wip;
- public $files_sum;
- public $files_other;
-
- public function __construct() {
- $this->files_uptodate = 0;
- $this->files_outdated = 0;
- $this->files_wip = 0;
- $this->files_sum = 0;
- $this->files_other = 0;
- }
-
- public static function getKey( $fileStatus ) {
- switch ( $fileStatus ) {
- case FileStatusEnum::RevTagProblem:
- case FileStatusEnum::TranslatedOld:
- return "files_outdated";
- break;
- case FileStatusEnum::TranslatedWip:
- return "files_wip";
- break;
- case FileStatusEnum::TranslatedOk:
- return "files_uptodate";
- break;
- default:
- return "files_other";
- }
- }
-}
-
-function populateFileTree( $lang )
-{
- $dir = new \DirectoryIterator( $lang );
- if ( $dir === false )
- {
- print "$lang is not a directory.\n";
- exit;
- }
- $cwd = getcwd();
- $ret = array();
- chdir( $lang );
- populateFileTreeRecurse( $lang , "." , $ret );
- chdir( $cwd );
- return $ret;
-}
-
-function populateFileTreeRecurse( $lang , $path , & $output )
-{
- global $oldfiles;
- $dir = new DirectoryIterator( $path );
- if ( $dir === false )
- {
- print "$path is not a directory.\n";
- exit;
- }
- $todoPaths = [];
- $trimPath = ltrim( $path , "./");
- foreach( $dir as $entry )
- {
- $filename = $entry->getFilename();
- if ( $filename[0] == '.' )
- continue;
- if ( substr( $filename , 0 , 9 ) == "entities." )
- continue;
- if ( $entry->isDir() )
- {
- $todoPaths[] = $path . '/' . $entry->getFilename();
- continue;
- }
- if ( $entry->isFile() )
- {
- $ignoredFileNames = [
- 'README.md',
- 'translation.xml',
- 'readme.first',
- 'license.xml',
- 'extensions.xml',
- 'versions.xml',
- 'book.developer.xml',
- 'contributors.ent',
- 'contributors.xml',
- 'README',
- 'DO_NOT_TRANSLATE',
- 'rsusi.txt',
- 'missing-ids.xml',
- ];
-
- $ignoredDirectories = [
- 'chmonly',
- ];
-
- $ignoredFullPaths = [
- 'appendices/reserved.constants.xml',
- 'appendices/extensions.xml',
- 'reference/datetime/timezones.xml',
- ];
-
- if(
- in_array($trimPath, $ignoredDirectories, true)
- || in_array($filename, $ignoredFileNames, true)
- || (strpos($filename, 'entities.') === 0)
- || !in_array(substr($filename, -3), ['xml','ent'], true)
- || (substr($filename, -13) === 'PHPEditBackup')
- || (in_array($trimPath . '/' .$filename, $ignoredFullPaths, true))
- ) {
- continue;
- }
- $file = new FileStatusInfo;
- $file->path = $trimPath;
- $file->name = $filename;
- $file->size = filesize( $path . '/' . $filename );
- $file->syncStatus = null;
- if ( $lang != 'en' )
- {
- parseRevisionTag( $entry->getPathname() , $file );
- $path_en = '../en/' . $trimPath . '/' . $filename;
- if( !is_file($path_en) ) //notinen
- {
- $oldfile = new OldFilesInfo;
- $oldfile->path = $trimPath;
- $oldfile->name = $filename;
- $oldfile->size = $file->size < 1024 ? 1 : floor( $file->size / 1024 );
- $oldfiles[ $oldfile->getKey() ] = $oldfile;
- } else {
- $output[ $file->getKey() ] = $file;
- }
- } else {
- $output[ $file->getKey() ] = $file;
- }
- }
- }
- sort( $todoPaths );
- foreach( $todoPaths as $path )
- populateFileTreeRecurse( $lang , $path , $output );
-}
-
-function parseRevisionTag( $filename , FileStatusInfo $file )
-{
- $fp = fopen( $filename , "r" );
- $contents = fread( $fp , 1024 );
- fclose( $fp );
-
- // No match before the preg
- $match = array ();
-
- $regex = "''U";
- if (preg_match ($regex , $contents , $match )) {
- $file->hash = trim( $match[1] );
- $file->maintainer = trim( $match[2] );
- $file->completion = trim( $match[3] );
- }
- if ( $file->hash == null or strlen( $file->hash ) != 40 or
- $file->maintainer == null or
- $file->completion == null )
- $file->syncStatus = FileStatusEnum::RevTagProblem;
-
- $regex = "//U";
- $match = array();
- preg_match ( $regex , $contents , $match );
- if ( count( $match ) == 2 )
- $file->credits = str_replace( ' ' , '' , trim( $match[1] ) );
- else
- $file->credits = '';
-}
-
-function captureGitValues( $lang , & $output )
-{
- $cwd = getcwd();
- chdir( $lang );
- $fp = popen( "git --no-pager log --name-only" , "r" );
- $hash = $additions = $deletions = $filename = null;
- $skip = false;
- while ( ( $line = fgets( $fp ) ) !== false )
- {
- if ( substr( $line , 0 , 7 ) == "commit " )
- {
- $hash = trim( substr( $line , 7 ) );
- $skip = false;
- continue;
- }
- if ( strpos( $line , 'Date:' ) === 0 )
- continue;
- if ( trim( $line ) == "" )
- continue;
- if ( substr( $line , 0 , 4 ) == ' ' )
- {
- if ( stristr( $line, '[skip-revcheck]' ) !== false )
- $skip = true;
- continue;
- }
- if ( strpos( $line , ': ' ) > 0 )
- continue;
- $filename = trim( $line );
- if ( isset( $output[$filename][$lang] ) )
- continue;
-
- $output[$filename][$lang]['hash'] = $hash;
- $output[$filename][$lang]['skip'] = $skip;
- }
- pclose( $fp );
- chdir( $cwd );
-}
-
-function computeSyncStatus( $enFiles , $trFiles , $gitData , $lang )
-{
- foreach( $trFiles as $filename => $trFile )
- {
- // notinen
- $path_en = 'en/' . $trFile->path . '/' . $trFile->name;
- if( !is_file($path_en) )
- {
- $trFile->syncStatus = FileStatusEnum::NotInEnTree;
- continue;
- }
-
- }
- foreach( $enFiles as $filename => $enFile )
- {
- if ( isset( $gitData[ $filename ]['en'] ) )
- {
- $enFile->hash = $gitData[ $filename ]['en']['hash'];
- $enFile->skip = $gitData[ $filename ]['en']['skip'];
- }
- else
- print "Warn: No hash for en/$filename ";
-
- $trFile = isset( $trFiles[ $filename ] ) ? $trFiles[ $filename ] : null;
-
- if ( $trFile == null ) // Untranslated
- {
- $enFile->syncStatus = FileStatusEnum::Untranslated;
- continue;
- }
- if ( $trFile->syncStatus == FileStatusEnum::RevTagProblem )
- continue;
-
- // TranslatedOk
- // TranslatedOld
- if ( strlen( $trFile->hash ) == 40 )
- {
- if ( $enFile->hash == $trFile->hash )
- $trFile->syncStatus = FileStatusEnum::TranslatedOk;
- else
- {
- $trFile->syncStatus = FileStatusEnum::TranslatedOld;
-
- $cwd = getcwd();
- chdir( 'en' );
- //adds,dels
- $subject = `git diff --numstat $trFile->hash -- {$filename}`;
- if ( $subject )
- {
- preg_match('/(\d+)\s+(\d+)/', $subject, $matches);
- if ($matches)
- [, $enFile->adds, $enFile->dels] = $matches;
- }
- //days
- $days = `git show --no-patch --format='%ct' $enFile->hash -- {$filename}`;
- if ( $days != "" )
- $enFile->days = floor( ( time() - $days ) / 86400 );
- chdir( $cwd );
-
- if ( $enFile->skip )
- {
- $cwd = getcwd();
- chdir( 'en' );
- $hashes = explode ( "\n" , `git log -2 --format=%H -- {$filename}` );
- chdir( $cwd );
- if ( $hashes[1] == $trFile->hash )
- $trFile->syncStatus = FileStatusEnum::TranslatedOk;
- }
- }
- }
- // TranslatedWip
- if ( $trFile->completion != null && $trFile->completion != "ready" )
- $trFile->syncStatus = FileStatusEnum::TranslatedWip;
- }
-}
-
-function parse_attr_string ( $tags_attrs ) {
- $tag_attrs_processed = array();
-
- foreach($tags_attrs as $attrib_list) {
- preg_match_all("!(.+)=\\s*([\"'])\\s*(.+)\\2!U", $attrib_list, $attribs);
-
- $attrib_array = array();
- foreach ($attribs[1] as $num => $attrname) {
- $attrib_array[trim($attrname)] = trim($attribs[3][$num]);
- }
-
- $tag_attrs_processed[] = $attrib_array;
- }
-
- return $tag_attrs_processed;
-}
-
-function computeTranslatorStatus( $lang, $enFiles, $trFiles ) {
- global $intro;
- $translation_xml = getcwd() . "/" . $lang . "/translation.xml";
- if (!file_exists($translation_xml)) {
- return [];
- }
-
- $txml = join("", file($translation_xml));
- $txml = preg_replace("/\\s+/", " ", $txml);
-
- preg_match("!(.+) !s", $txml, $match);
- $intro = trim($match[1]);
-
- preg_match("!<\?xml(.+)\?>!U", $txml, $match);
- $xmlinfo = parse_attr_string($match);
- $output_charset = $xmlinfo[1]["encoding"];
-
- $pattern = "!!U";
- preg_match_all($pattern, $txml, $matches);
- $translators = parse_attr_string($matches[1]);
-
- $translatorInfos = [];
- $unknownInfo = new TranslatorInfo();
- $unknownInfo->nick = "unknown";
- $translatorInfos["unknown"] = $unknownInfo;
-
- foreach ($translators as $key => $translator) {
- $info = new TranslatorInfo();
- $info->name = $translator["name"];
- $info->email = $translator["email"];
- $info->nick = $translator["nick"];
- $info->vcs = $translator["vcs"] ?? "";
-
- $translatorInfos[$info->nick] = $info;
- }
-
- foreach( $enFiles as $key => $enFile ) {
- $info_exists = false;
- if (array_key_exists($enFile->getKey(), $trFiles)) {
- $trFile = $trFiles[$enFile->getKey()];
- $statusKey = TranslatorInfo::getKey($trFile->syncStatus);
- if (array_key_exists($trFile->maintainer, $translatorInfos)) {
- $translatorInfos[$trFile->maintainer]->$statusKey++;
- $translatorInfos[$trFile->maintainer]->files_sum++;
- $info_exists = true;
- }
- }
- if (!$info_exists) {
- $translatorInfos["unknown"]->$statusKey++;
- $translatorInfos["unknown"]->files_sum++;
- }
- }
-
- return $translatorInfos;
-}
+print_html_all( $data );
// Output
-function print_html_all( $enFiles , $trFiles , $translators , $lang )
+function print_html_all( RevcheckData $data )
{
- print_html_header( $lang );
- print_html_translators($translators , $enFiles, $trFiles);
- print_html_files( $enFiles , $trFiles , $lang );
- print_html_notinen();
- print_html_misstags( $enFiles, $trFiles, $lang );
- print_html_untranslated( $enFiles );
+ print_html_header( $data );
+ print_html_translators( $data );
+ print_html_oldwip( $data );
+ print_html_notinen( $data );
+ print_html_revtag( $data );
+ print_html_untranslated( $data );
print_html_footer();
}
-function print_html_header( $lang )
+function print_html_header( RevcheckData $data )
{
- $date = date("r");
+ $lang = $data->lang;
+ $date = $data->date;
print <<
@@ -512,35 +94,34 @@ function print_html_header( $lang )
Status of the translated PHP Manual
Generated: $date / Language: $lang
-
HTML;
}
-
-function print_html_menu($href)
+function print_html_menu( string $href )
{
print <<
Introduction
| Translators
| File summary
| Outdated Files
| Not in EN tree
-| Missing revision numbers
+| Missing or invalid revtag
| Untranslated files
HTML;
}
-function print_html_translators( $translators , $enFiles, $trFiles )
+function print_html_translators( RevcheckData $data )
{
- global $intro, $oldfiles, $files_misstags, $notinen_count, $files_untranslated;
- if (count($translators) === 0) return;
+ $translators = $data->translators;
+ if ( count( $translators ) == 0 )
+ return;
+
print_html_menu("intro");
print <<
- $intro
+ {$data->intro}
@@ -552,83 +133,36 @@ function print_html_translators( $translators , $enFiles, $trFiles )
Files maintained
- upto- date
+ upto- date
old
- wip
+ wip
sum
HTML;
- $files_uptodate = 0;
- $files_outdated = 0;
- $files_wip = 0;
- $files_sum = 0;
- foreach( $translators as $key => $person )
+ foreach( $translators as $person )
{
- if ($person->nick === "unknown") continue;
+ // Unknown or untracked on translations.xml
+ if ( $person->name == "" && $person->email == "" && $person->vcs == "" )
+ continue;
- $files_uptodate += $person->files_uptodate;
- $files_outdated += $person->files_outdated;
- $files_wip += $person->files_wip;
- $files_sum += $person->files_sum;
- print <<countOk + $person->countOld + $person->countOther;
+ print <<
{$person->name}
{$person->email}
{$person->nick}
{$person->vcs}
-
- {$person->files_uptodate}
- {$person->files_outdated}
- {$person->files_wip}
- {$person->files_sum}
+ {$person->countOk}
+ {$person->countOld}
+ {$person->countOther}
+ {$personSum}
-
HTML;
-
}
print "
\n";
-//FILE SUMMARY
- $count = 0;
- $files_outdated = 0;
- $files_sum = 0;
- $files_uptodate = 0;
- $files_misstags = 0;
- $files_wip = 0;
- foreach( $trFiles as $key => $tr )
- {
- if ( $tr->syncStatus == FileStatusEnum::TranslatedOld )
- $files_outdated++;
- if ( $tr->syncStatus == FileStatusEnum::TranslatedOk )
- $files_uptodate++;
- if ( $tr->syncStatus == FileStatusEnum::RevTagProblem )
- $files_misstags++;
- if ( $tr->syncStatus == FileStatusEnum::TranslatedWip )
- $files_wip++;
- }
- $files_untranslated = 0;
- foreach( $enFiles as $key => $en )
- {
- if ( $en->syncStatus == FileStatusEnum::Untranslated ) {
- $files_untranslated++;
- }
- $count++;
- }
- $notinen_count = 0;
- foreach( $oldfiles as $key => $en )
- {
- if ( $key == "{$en->path}/{$en->name}" ) {
- $notinen_count++;
- }
- }
- $files_uptodate_percent = number_format($files_uptodate * 100 / $count, 2 );
- $files_outdated_percent = number_format($files_outdated * 100 / $count, 2 );
- $files_wip_percent = number_format($files_wip * 100 / $count, 2 );
- $files_untranslated_percent = number_format($files_untranslated * 100 / $count, 2 );
- $notinen_count_percent = number_format($notinen_count * 100 / $count, 2 );
- $files_misstags_percent = number_format($files_misstags * 100 / $count, 2 );
print_html_menu("filesummary");
print <<
@@ -637,150 +171,59 @@ function print_html_translators( $translators , $enFiles, $trFiles )
Number of files
Percent of files
-
- Up to date files
- $files_uptodate
- $files_uptodate_percent%
-
-
- Outdated files
- $files_outdated
- $files_outdated_percent%
-
-
- Work in progress
- $files_wip
- $files_wip_percent%
-
-
- Files without revision number
- $files_misstags
- $files_misstags_percent%
-
-
- Not in EN tree
- $notinen_count
- $notinen_count_percent%
-
-
- Files available for translation
- $files_untranslated
- $files_untranslated_percent%
-
-
- Files total
- $count
- 100%
-
HTML;
-}
-function print_html_misstags( $enFiles, $trFiles, $lang )
-{
- print_html_menu("misstags");
+ $filesTotal = 0;
+ foreach ( $data->fileSummary as $count )
+ $filesTotal += $count;
- GLOBAL $files_misstags;
- if ($files_misstags == 0)
+ foreach( RevcheckStatus::cases() as $key )
{
- echo 'Good, all files contain revision numbers.
';
- } else {
+ $label = "";
+ $count = $data->fileSummary[ $key->value ];
+ $perc = number_format( $count / $filesTotal * 100 , 2 ) . "%";
+ switch( $key )
+ {
+ case RevcheckStatus::TranslatedOk: $label = "Up to date files"; break;
+ case RevcheckStatus::TranslatedOld: $label = "Outdated files"; break;
+ case RevcheckStatus::TranslatedWip: $label = "Work in progress"; break;
+ case RevcheckStatus::RevTagProblem: $label = "Revision tag missing/problem"; break;
+ case RevcheckStatus::NotInEnTree: $label = "Not in EN tree"; break;
+ case RevcheckStatus::Untranslated: $label = "Available for translation"; break;
+ }
+
print <<
- Files without EN-Revision number ($files_misstags files)
- Commit hash
- Sizes in kB
+ $label
+ $count
+ $perc
-en $lang diff
HTML;
-
- $last_path = null;
- asort($trFiles);
- foreach ($trFiles as $key => $tr)
- {
- if ( $tr->syncStatus != FileStatusEnum::RevTagProblem )
- continue;
-
- $en = $enFiles[ $key ];
-
- if ( $last_path != $tr->path )
- {
- $path = $tr->path == '' ? '/' : $tr->path;
- echo "$path ";
- $last_path = $tr->path;
- }
- $diff = intval($en->size - $tr->size);
- echo "{$tr->name} {$en->hash} {$en->size} {$tr->size} $diff ";
- }
- echo '';
}
-}
-function print_html_untranslated($enFiles)
-{
- global $files_untranslated;
- $exists = false;
- if (!$files_untranslated) return;
- print_html_menu("untranslated");
print <<
-
- Untranslated files ($files_untranslated files):
- Commit hash
- kb
-
+
+ Files total
+ $filesTotal
+ 100%
+
+
HTML;
+}
- $path = null;
- asort($enFiles);
- foreach( $enFiles as $key => $en )
- {
- if ( $en->syncStatus != FileStatusEnum::Untranslated )
- continue;
- if ( $path !== $en->path )
- {
- $path = $en->path;
- $path2 = $path == '' ? '/' : $path;
- print " $path2 ";
- }
- $size = $en->size < 1024 ? 1 : floor( $en->size / 1024 );
-
- print <<
- $en->name
- $en->hash
- $size
-
-HTML;
+ $total = $data->fileSummary[ RevcheckStatus::TranslatedOld->value ];
+ $total += $data->fileSummary[ RevcheckStatus::TranslatedWip->value ];
+ if ( $total == 0 )
+ {
+ print "Hooray! There is no files to update, nice work!
\n\n";
+ return;
}
- print "\n";
-}
-function print_html_footer()
-{
- print_html_menu("");
print <<
-
-
-
-
-HTML;
-}
-
-function print_html_files( $enFiles , $trFiles , $lang )
-{
- print_html_menu("files");
- print <<
Translated file
@@ -792,101 +235,217 @@ function print_html_files( $enFiles , $trFiles , $lang )
en
- $lang
-
-
+ {$data->lang}
+ \n
HTML;
$now = new DateTime( 'now' );
$path = null;
- asort($trFiles);
- foreach( $trFiles as $key => $tr )
+
+ foreach( $data->fileDetail as $key => $file )
{
- if ( $tr->syncStatus == FileStatusEnum::TranslatedOk )
- continue;
- if ( $tr->syncStatus == FileStatusEnum::RevTagProblem )
- continue;
- if ( $tr->syncStatus == FileStatusEnum::NotInEnTree )
- continue;
- $en = $enFiles[ $key ];
- if ( $en->syncStatus == FileStatusEnum::Untranslated )
- continue;
+ switch ( $file->status )
+ {
+ case RevcheckStatus::TranslatedOld:
+ case RevcheckStatus::TranslatedWip:
+ break;
+ default:
+ continue 2;
+ }
- if ( $path !== $en->path )
+ if ( $path !== $file->path )
{
- $path = $en->path;
+ $path = $file->path;
$path2 = $path == '' ? '/' : $path;
print " $path2 ";
}
- $ll = strtolower( $lang );
+
+ $ma = $file->maintainer;
+ $st = $file->completion;
+ $ll = strtolower( $data->lang );
$kh = hash( 'sha256' , $key );
- $d1 = "https://doc.php.net/revcheck.php?p=plain&lang={$ll}&hbp={$tr->hash}&f=$key&c=on";
- $d2 = "https://doc.php.net/revcheck.php?p=plain&lang={$ll}&hbp={$tr->hash}&f=$key&c=off";
- $nm = "{$en->name} [colored] ";
- if ( $en->syncStatus == FileStatusEnum::RevTagProblem )
- $nm = $en->name;
- $h1 = "{$en->hash} ";
- $h2 = "{$tr->hash} ";
+ $d1 = "https://doc.php.net/revcheck.php?p=plain&lang={$ll}&hbp={$file->hashRvtg}&f=$key";
+ $d2 = "https://doc.php.net/revcheck.php?p=plain&lang={$ll}&hbp={$file->hashRvtg}&f=$key&c=on";
- $bgdays = '';
- if ($en->days != null && $en->days > 90)
- $bgdays = 'bgorange';
+ $nm = "{$file->name} [colored] ";
+ $h1 = "{$file->hashLast} ";
+ $h2 = "{$file->hashRvtg} ";
- if ($en->adds != null)
- $ch = "+{$en->adds} -{$en->dels} ";
+ if ( $file->adds > 0 || $file->dels > 0 )
+ $ch = "+{$file->adds} -{$file->dels} ";
else
- $ch = "no data ";
+ $ch = " ";
+
+ $bgdays = '';
+ if ( $file->days > 90 )
+ $bgdays = 'bgorange';
- $ma = $tr->maintainer;
- $st = $tr->completion;
print <<
$nm
$ch
- Copy $h1
+ Copy $h1
$h2
$ma
$st
- {$en->days}
-
+ {$file->days}
+ \n
HTML;
}
-print "
\n";
+
+ print "
\n\n";
}
-function print_html_notinen()
+function print_html_notinen( RevcheckData $data )
{
- global $oldfiles, $notinen_count;
print_html_menu("notinen");
- $exists = false;
- if (!$notinen_count)
+
+ if ( $data->fileSummary[ RevcheckStatus::NotInEnTree->value ] == 0 )
{
- print "Good, it seems that this translation doesn't contain any file which is not present in English tree.
\n";
- } else {
- print <<Good, it seems that this translation doesn't contain any file which is not present in source tree.\n\n";
+ return;
+ }
+
+ print <<
- Files which is not present in English tree. ($notinen_count files)
- Size in kB
+ Files which is not present in source tree
+ Size kB
HTML;
- $path = null;
- foreach( $oldfiles as $key => $en )
- {
- if ( $path !== $en->path )
- {
- $path = $en->path;
- print " /$path ";
- }
- print <<fileDetail as $file )
+ {
+ if ( $file->status != RevcheckStatus::NotInEnTree )
+ continue;
+
+ if ( $header !== $file->path )
+ {
+ $header = $file->path;
+ print " $header ";
+ }
+
+ $name = $file->name;
+ $size = round( $file->size / 1024 );
+
+ print <<
- $en->name
- $en->size
+ {$name}
+ {$size}
+
+HTML;
+ }
+
+ print "
\n\n";
+}
+
+function print_html_revtag( RevcheckData $data )
+{
+ print_html_menu("revtag");
+ if ( $data->fileSummary[ RevcheckStatus::RevTagProblem->value ] == 0 )
+ {
+ echo "Good, all files contain valid revtags.
\n\n";
+ return;
+ }
+
+ echo <<
+
+ Files with invalid or missing revision tags
+ Size kB
+
+HTML;
+
+ $last_path = null;
+ foreach ( $data->fileDetail as $file )
+ {
+ if ( $file->status != RevcheckStatus::RevTagProblem )
+ continue;
+
+ if ( $last_path != $file->path )
+ {
+ $path = $file->path == '' ? '/' : $file->path;
+ echo "$path ";
+ $last_path = $file->path;
+ }
+ $size = round( $file->size / 1024 );
+ echo "{$file->name} {$size} ";
+ }
+ echo '';
+}
+
+function print_html_untranslated( RevcheckData $data )
+{
+ print_html_menu("untranslated");
+ if ( $data->fileSummary[ RevcheckStatus::Untranslated->value ] == 0 )
+ {
+ echo "No file left untranslated!
\n\n";
+ return;
+ }
+
+ print <<
+
+ Untranslated files
+ Last hash
+ kb
+
+HTML;
+
+ $path = null;
+ foreach ( $data->fileDetail as $key => $file )
+ {
+ if ( $file->status != RevcheckStatus::Untranslated )
+ continue;
+
+ if ( $path !== $file->path )
+ {
+ $path = $file->path;
+ $header = $path == '' ? '/' : $path;
+ print " $header ";
+ }
+
+ $name = $file->name;
+ $hash = $file->hashLast;
+ $href = "https://github.com/php/doc-en/blob/{$hash}/$key";
+ $size = round( $file->size / 1024 );
+
+ print <<
+ $name
+ $hash
+ $size
HTML;
- }
-print "
";
}
+ print "\n\n";
+}
+
+function print_html_footer()
+{
+ print_html_menu("");
+ print <<