[doc-base] master: List of TranslatedOk files and count of files outdated more than 1 and 2 years (#344)

From: Date: Thu, 24 Sep 2026 11:48:40 +0000
Subject: [doc-base] master: List of TranslatedOk files and count of files outdated more than 1 and 2 years (#344)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23768@lists.php.net to get a copy of this message
Author: alfsb (alfsb) Committer: GitHub (web-flow) Pusher: alfsb Date: 2026-09-24T08:48:38-03:00 Commit: https://github.com/php/doc-base/commit/1bec0155f3ead7e31f83ce2399742ec725b86969 Raw diff: https://github.com/php/doc-base/commit/1bec0155f3ead7e31f83ce2399742ec725b86969.diff List of TranslatedOk files and count of files outdated more than 1 and 2 years (#344) Changed paths: M .gitignore M languages.php M scripts/translation/lib/RevcheckRun.php Diff: diff --git a/.gitignore b/.gitignore index 8e5220c8b2..4236585caa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,9 @@ + # Files generated by the configure script .manual.xml -.revcheck.json version.xml sources.xml -# File use to generate entities by configure script fileModHistory.php - # A plece for all temporary or generated files (idempotent build) temp/ diff --git a/languages.php b/languages.php index 5926b777e5..2d6e80734d 100644 --- a/languages.php +++ b/languages.php @@ -42,7 +42,7 @@ function print_usage() { print <<<USAGE usage: [--clone] [--undo] [--pull] [--mark] [--quiet] - [--list-cvs] [--list-ssv] [--rev] [--all] + [--list-csv] [--list-ssv] [--rev] [--all] [lang] [lang] ... Options that operates on local repositories: diff --git a/scripts/translation/lib/RevcheckRun.php b/scripts/translation/lib/RevcheckRun.php index 4f6df5530b..bca5e236e8 100644 --- a/scripts/translation/lib/RevcheckRun.php +++ b/scripts/translation/lib/RevcheckRun.php @@ -256,9 +256,64 @@ private function parseTranslationXml() : void } } - private function saveRevcheckData() + public function saveRevcheckData() { - $json = json_encode( $this->revData , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT ); - file_put_contents( __DIR__ . "/../../../.revcheck.json" , $json ); + // doc-base/temp + + $tmpDir = __DIR__ . '/../../../temp'; + if ( ! file_exists( $tmpDir ) ) + mkdir( $tmpDir ); + + // Full revcheck data in JSON + + $conf = JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT; + $json = json_encode( $this->revData , $conf ); + file_put_contents( "{$tmpDir}/revcheck.json" , $json ); + + // TranslatedOk simple list + + $fp = fopen( "{$tmpDir}/files-ok.txt" , 'w' ); + $oldy1 = 0; + $oldy2 = 0; + + foreach ( $this->revData->fileDetail as $item ) + { + if ( $item->status == RevcheckStatus::TranslatedOk ) + { + $path = $item->path; + $name = $item->name; + + if ( $path == '.' ) + $line = "{$name}\n"; + else + $line = "{$path}/{$name}\n"; + + fwrite( $fp , $line ); + } + + if ( $item->status == RevcheckStatus::TranslatedOld ) + { + if ( $item->days > 365 ) + $oldy1++; + if ( $item->days > 730 ) + $oldy2++; + } + } + fclose( $fp ); + + // Files outdated more than N years, count + + $filey1 = "{$tmpDir}/files-outdated-1y.txt"; + $filey2 = "{$tmpDir}/files-outdated-2y.txt"; + + if ( file_exists( $filey1 ) ) + unlink( $filey1 ); + if ( file_exists( $filey2 ) ) + unlink( $filey2 ); + + if ( $oldy1 > 0 ) + file_put_contents( $filey1 , $oldy1 ); + if ( $oldy2 > 0 ) + file_put_contents( $filey2 , $oldy2 ); } }

« previous php.doc.cvs (#23768) next »