[DOC-WEB] [web-doc] master: Slight optimization, only grab hashes once per English file as needed
[email protected] (Jim Winstead) Tue, 22 Oct 2024 18:19:35 +0000
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <[email protected]> |
Author: Jim Winstead (jimwins)
Date: 2024-10-22T11:15:02-07:00
Commit: https://github.com/php/web-doc/commit/ecbd7646ed935c0b518285dc468ef2041834ec71
Raw diff: https://github.com/php/web-doc/commit/ecbd7646ed935c0b518285dc468ef2041834ec71.diff
Slight optimization, only grab hashes once per English file as needed
Changed paths:
M scripts/rev.php
Diff:
diff --git a/scripts/rev.php b/scripts/rev.php
index 2a9ee3d..0c2ace6 100644
--- a/scripts/rev.php
+++ b/scripts/rev.php
@@ -167,6 +167,7 @@ class FileStatusInfo
public $size;
public $hash;
public $skip;
+ public $hashes;
public $syncStatus;
public $maintainer;
public $completion;
@@ -548,7 +549,7 @@ function captureGitValues( & $output )
$cwd = getcwd();
chdir( $DOCS . 'en' );
- $subject = `git diff --numstat $trFile->hash -- {$filename}`;
+ $subject = `git diff --numstat {$trFile->hash} -- {$filename}`;
chdir( $cwd );
if ( $subject ) {
preg_match('/(\d+)\s+(\d+)/', $subject, $matches);
@@ -559,11 +560,13 @@ function captureGitValues( & $output )
if ( $trFile->completion != null && $trFile->completion != "ready" )
$trFile->syncStatus = FileStatusEnum::TranslatedWip;
if ( $en->skip ) {
- $cwd = getcwd();
- chdir( $DOCS . 'en' );
- $hashes = explode ( "\n" , `git log -2 --format=%H -- {$filename}` );
+ if (!$en->hashes) {
+ $cwd = getcwd();
+ chdir( $DOCS . 'en' );
+ $en->hashes = explode ( "\n" , `git log -2 --format=%H -- {$filename}` );
+ }
chdir( $cwd );
- if ( $hashes[1] == $trFile->hash )
+ if ( $en->hashes[1] == $trFile->hash )
$trFile->syncStatus = FileStatusEnum::TranslatedOk;
}
$SQL_BUFF .= "INSERT INTO translated VALUES ($id, '$lang',