[web-doc] master: after tests, case of [skip-revcheck] in the commit message

[email protected] (Nilgün Belma Bugüner) Thu, 2 Sep 2021 16:33:00 +0000
Newsgroups php.doc.web
Message-ID <[email protected]>
Author: Nilgün Belma Bugüner (nilgun)
Date: 2021-09-02T19:33:22+03:00

Commit: https://github.com/php/web-doc/commit/c9a02d410f8165c4549810dc65494655095d3148
Raw diff: https://github.com/php/web-doc/commit/c9a02d410f8165c4549810dc65494655095d3148.diff

after tests, case of [skip-revcheck] in the commit message

Changed paths:
  M  include/lib_revcheck.inc.php
  M  scripts/rev.php
  M  www/revcheck.php


Diff:

diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php
index 7f3854d..3e31c2c 100644
--- a/include/lib_revcheck.inc.php
+++ b/include/lib_revcheck.inc.php
@@ -50,7 +50,7 @@ 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
     FROM translated a, dirs b, enfiles c
-    WHERE a.lang = '$lang' AND c.skip = 0
+    WHERE a.lang = '$lang'
       AND c.name = a.name AND b.id = a.id AND b.id = c.id
       AND (a.syncStatus = 'TranslatedOld'
        OR  a.syncStatus = 'TranslatedWip')";
@@ -216,7 +216,7 @@ function get_translators($idx, $lang)
 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 b.skip = 0 AND ";
+        WHERE a.lang = '$lang' AND a.id = b.id AND a.name = b.name AND ";
     if ($status == 'wip') {
          $sql .= "a.syncStatus = 'TranslatedWip'";
     } elseif ($status == 'notrans') {
diff --git a/scripts/rev.php b/scripts/rev.php
index 94ac118..11d4159 100644
--- a/scripts/rev.php
+++ b/scripts/rev.php
@@ -95,7 +95,6 @@
   name TEXT,
   revision TEXT,
   size INT,
-  skip INT,
   UNIQUE(id, name)
 );
 
@@ -433,13 +432,13 @@ function captureGitValues( & $output )
     $hash = null;
     $date = null;
     $utct = new DateTimeZone( "UTC" );
-    $skipThisCommit = 0;
+    $skipThisCommit = false;
     while ( ( $line = fgets( $fp ) ) !== false )
     {
         if ( substr( $line , 0 , 7 ) == "commit " )
         {
             $hash = trim( substr( $line , 7 ) );
-            $skipThisCommit = 0;
+            $skipThisCommit = false;
             continue;
         }
         if ( strpos( $line , 'Date:' ) === 0 )
@@ -453,7 +452,7 @@ function captureGitValues( & $output )
         {
             if ( stristr( $line, '[skip-revcheck]' ) !== false )
             {
-                 $skipThisCommit = 1;
+                 $skipThisCommit = true;
              }
            continue;
         }
@@ -499,7 +498,7 @@ function captureGitValues( & $output )
     else
         print "Warn: No hash for en/$filename\n";
 
-    $SQL_BUFF .= "INSERT INTO enfiles VALUES ($id, '$en->name', '$en->hash', $size, '$en->skip');\n";
+    $SQL_BUFF .= "INSERT INTO enfiles VALUES ($id, '$en->name', '$en->hash', $size);\n";
 
     foreach( $LANGS as $lang )
     {
@@ -516,10 +515,11 @@ function captureGitValues( & $output )
             }
             if ( $trFile->completion != null && $trFile->completion != "ready" )
                 $trFile->syncStatus = FileStatusEnum::TranslatedWip;
+            if ( $en->skip )
+               $trFile->syncStatus = FileStatusEnum::TranslatedOk;
             $SQL_BUFF .= "INSERT INTO translated VALUES ($id, '$lang',
             '$en->name', '$trFile->hash', $size, '$trFile->maintainer',
             '$trFile->completion', '$trFile->syncStatus');\n";
-
         }
     }
 }
diff --git a/www/revcheck.php b/www/revcheck.php
index 5551e90..bf1de88 100644
--- a/www/revcheck.php
+++ b/www/revcheck.php
@@ -186,6 +186,7 @@
      $files_wip      = get_stats($dbhandle, $lang, 'wip');
      $files_notinen  = get_stats($dbhandle, $lang, 'notinen');
 
+     $files_outdated[1] = $files_outdated[1] > 0 ? $files_outdated[1] : 0;
      $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;