[web-doc] master: Conversion from svn to git

[email protected] (Nilgün Belma Bugüner) Wed, 21 Apr 2021 22:33:42 +0000
Newsgroups php.doc.web
Message-ID <[email protected]>
Author: Nilgün Belma Bugüner (nilgun)
Date: 2021-04-22T01:33:40+03:00

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

Conversion from svn to git

Changed paths:
  A  build-ops.php.sample
  A  build-ops.sample
  D  build-ops-sample
  D  build-ops-sample.php
  M  README.md
  M  include/lib_general.inc.php
  M  include/lib_proj_lang.inc.php
  M  include/lib_revcheck.inc.php
  M  scripts/gen_picture_info.php
  M  scripts/gen_picture_info_all_lang.php
  M  scripts/populatedocs.sh
  M  scripts/rev.php
  M  www/revcheck.php


Diff:

diff --git a/README.md b/README.md
index c113509..6fd013b 100644
--- a/README.md
+++ b/README.md
@@ -5,26 +5,27 @@ please contact us on `php.doc.web` mailing list or contribute by i.e. sending pu
 
 ## Installation
 Requirements:
-- PHP 5
+- PHP 8
 - GD extension (for generating charts)
 - SQLite3
 
 1. Unpack a copy of JpGraph 3.0.7 into `/include/jpgraph/` ([here](http://jpgraph.net/download/download.php?p=1))
-2. You need to run the scripts/populatedocs.sh to fetch all the required documentation for the site.
-3. Increase memory limit for PHP scripts to at least 32MB
-4. Fill in two configuration files
-	- `build-ops.sample.php` (rename it to `build-ops.php`)
-		- `@SVNDIR@` - absolute path to dir where scripts will clone SVN repos to and then use them for generating data
-		- `@DOCDIR@` - relative path to the directory with documentation in SVN repo
-	- `build-ops-sample` (rename it to `build-ops` [no ext])
+2. Increase memory limit for PHP scripts to at least 32MB
+3. Fill in two configuration files
+	- `build-ops.php.sample` (rename it to `build-ops.php`)
+		- `@GITDIR@` - absolute path to dir where scripts will clone SVN repos to and then use them for generating data
+		- `@SQLITEDIR@` - absolute path to directory where the database will be written
+	- `build-ops.sample` (rename it to `build-ops` [no ext])
 		- `@PHP@` - path to the PHP executable file
-		- `@SVNDIR@` - absolute path to dir where scripts will clone SVN repos to and then use them and then use it for generating data
-		- `@DOCDIR@` - relative path to the directory with documentation in SVN repo
-		- `@DOCWEB@` - absolute path to directory with this website
+		- `@GITDIR@` - absolute path to dir where scripts will clone SVN repos to and then use them and then use it for generating data
+		- `@DOCWEB@` - absolute path to `/www/` directory
 		- `@PHDDIR@` - absolute path to directory with PhD installed from Git master
 		- `@SCRIPTSDIR@`- absolute path to `/scripts/` directory
+		- `@SQLITEDIR@` - absolute path to directory where the database will be written
 		- `@SRCDIR@` - path to the directory with PHP source code in SVN repo
-5. Configure the virtual host under Apache. Current suggested settings are:
+4. You need to run the scripts/populatedocs.sh to fetch all the required documentation for the site.
+6. You need to run the scripts/generation.sh to generate the database and graphs
+7. Configure the virtual host under Apache. Current suggested settings are:
 ```
 <VirtualHost 127.0.0.1:80>
  ServerName doc.php.net
diff --git a/build-ops-sample.php b/build-ops.php.sample
similarity index 66%
rename from build-ops-sample.php
rename to build-ops.php.sample
index dcc901f..abbfd05 100644
--- a/build-ops-sample.php
+++ b/build-ops.php.sample
@@ -1,6 +1,5 @@
 <?php
 // Please read README.md in the same directory to get more info about filling in this file
 
-define('SVN_DIR',     '@SVNDIR@');
-define('DOC_DIR',     '@DOCDIR@');
+define('GIT_DIR',     '@GITDIR@');
 define('SQLITE_DIR',  '@SQLITEDIR@');
diff --git a/build-ops-sample b/build-ops.sample
similarity index 77%
rename from build-ops-sample
rename to build-ops.sample
index ca8e456..2c9776e 100644
--- a/build-ops-sample
+++ b/build-ops.sample
@@ -2,10 +2,9 @@
 # Please read README.md in the same directory to get more info about filling in this file
 
 PHP=@PHP@
-SVNDIR=@SVNDIR@
-DOCDIR=@DOCDIR@
+GIT_DIR=@GITDIR@
 DOCWEB=@DOCWEB@
 PHDDIR=@PHDDIR@
 SCRIPTSDIR=@SCRIPTSDIR@
-SQLITEDIR=@SQLITEDIR@
+SQLITE_DIR=@SQLITEDIR@
 SRCDIR=@SRCDIR@
diff --git a/include/lib_general.inc.php b/include/lib_general.inc.php
index 2b78960..05d6232 100644
--- a/include/lib_general.inc.php
+++ b/include/lib_general.inc.php
@@ -13,7 +13,8 @@
 | obtain it through the world-wide-web, please send a note to          |
 | [email protected] so we can mail you a copy immediately.               |
 +----------------------------------------------------------------------+
-| Authors:          Yannick Torres <[email protected]>                   |
+| Authors:          Nilgün Belma Bugüner <[email protected]>              |
+|                   Yannick Torres <[email protected]>                   |
 |                   Mehdi Achour <[email protected]>                       |
 |                   Gabor Hojtsy <[email protected]>                        |
 |                   Sean Coates <[email protected]>                         |
@@ -29,15 +30,6 @@ function get_svn_dir($project)
 
 function site_header()
 {
-   $TITLE = 'Documentation Tools';
-   $SUBDOMAIN = 'doc';
-   $CSS = array('/styles/doc.css');
-   $LINKS = array(
-        array('href' => '/revcheck.php', 'text' => 'Documentation Tools'),
-        array('href' => '/tutorial/', 'text' => 'Tutorial for Contributors'),
-        array('href' => '/phd.php', 'text' => 'PhD Homepage'),
-    );
-
     require __DIR__ . '/../shared/templates/header.inc';
 
     echo '<section class="mainscreen">';
@@ -45,7 +37,9 @@ function site_header()
 
 function site_footer($SECONDSCREEN = false)
 {
-    echo '</section>';
+   echo '</section><section class="secondscreen">';
+   if ($SECONDSCREEN != false) echo $SECONDSCREEN;
+   echo '</section>';
     require __DIR__ . '/../shared/templates/footer.inc';
 }
 
diff --git a/include/lib_proj_lang.inc.php b/include/lib_proj_lang.inc.php
index f0f99d5..be82aee 100644
--- a/include/lib_proj_lang.inc.php
+++ b/include/lib_proj_lang.inc.php
@@ -14,7 +14,8 @@
 | obtain it through the world-wide-web, please send a note to          |
 | [email protected] so we can mail you a copy immediately.               |
 +----------------------------------------------------------------------+
-| Authors:          Yannick Torres <[email protected]>                   |
+| Authors:          Nilgün Belma Bugüner <[email protected]>              |
+|                   Yannick Torres <[email protected]>                   |
 |                   Mehdi Achour <[email protected]>                       |
 |                   Gabor Hojtsy <[email protected]>                        |
 |                   Sean Coates <[email protected]>                         |
@@ -26,35 +27,16 @@
 // Supported languages
 // DO NOT insert English here - it is only for translations!
 $LANGUAGES = array(
-    'ar'    => 'Arabic',
-    'pt_BR' => 'Brazilian Portuguese',
-    'bg'    => 'Bulgarian',
-    'zh'    => 'Chinese (Simplified)',
-    'hk'    => 'Chinese (Hong Kong Cantonese)',
-    'tw'    => 'Chinese (Traditional)',
-    'cs'    => 'Czech',
-    'da'    => 'Danish',
-    'nl'    => 'Dutch',
-    'fi'    => 'Finnish',
-    'fr'    => 'French',
     'de'    => 'German',
-    'el'    => 'Greek',
-    'he'    => 'Hebrew',
-    'hu'    => 'Hungarian',
+    'es'    => 'Spanish',
+    'fr'    => 'French',
     'it'    => 'Italian',
     'ja'    => 'Japanese',
-    'kr'    => 'Korean',
-    'no'    => 'Norwegian',
-    'fa'    => 'Persian',
     'pl'    => 'Polish',
-    'pt'    => 'Portuguese',
+    'pt_br' => 'Brazillian Portuguese',
     'ro'    => 'Romanian',
     'ru'    => 'Russian',
-    'sr'    => 'Serbian',
-    'sk'    => 'Slovak',
-    'sl'    => 'Slovenian',
-    'es'    => 'Spanish',
-    'sv'    => 'Swedish',
     'tr'    => 'Turkish',
     'uk'    => 'Ukrainian',
+    'zh'    => 'Chinese (Simplified)',
 );
diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php
index f771562..fa7eb72 100644
--- a/include/lib_revcheck.inc.php
+++ b/include/lib_revcheck.inc.php
@@ -13,7 +13,8 @@
 | obtain it through the world-wide-web, please send a note to          |
 | [email protected] so we can mail you a copy immediately.               |
 +----------------------------------------------------------------------+
-| Authors:          Yannick Torres <[email protected]>                   |
+| Authors:          Nilgün Belma Bugüner <[email protected]>              |
+                    Yannick Torres <[email protected]>                   |
 |                   Mehdi Achour <[email protected]>                       |
 |                   Maciej Sobaczewski <[email protected]>                 |
 +----------------------------------------------------------------------+
@@ -21,36 +22,33 @@
 
 // Return an array of directory containing outdated files
 function get_dirs($idx, $lang) {
-    $sql = 'SELECT
-        DISTINCT b.name AS name,
-        a.dir AS dir
+    $sql = "SELECT
+        b.path AS dir,
+        a.name AS name
     FROM
         files a,
-        dirs b
-    LEFT JOIN
-        files c
-    ON
-        c.name = a.name
-    AND
-        c.dir = a.dir
+        dirs b,
+        enfiles c
     WHERE
-        b.id = a.dir
+        a.lang= '$lang'
     AND
-        a.lang="' . $lang . '"
+         a.id = b.id
+    AND
+         c.id = a.id
     AND
-        c.lang="en"
+         a.name = c.name
     AND
         a.revision != c.revision
     AND
-        a.revision != "n/a"
+        a.revision != 'n/a'
     ORDER BY
-        b.name';
+        b.path";
 
     $result = $idx->query($sql);
 
     $tmp = array();
     while ($r = $result->fetchArray()) {
-        $tmp[$r['dir']] = $r['name'];
+        $tmp[$r['dir']] = $r['dir'];
     }
 
     return $tmp;
@@ -59,30 +57,31 @@ function get_dirs($idx, $lang) {
 // return an array with the outdated files; can be optionally filtered by user or dir
 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.name AS name, a.dir AS dir
-    FROM files a, dirs b
-    LEFT JOIN files c ON c.name = a.name AND c.dir = a.dir
-    WHERE b.id = a.dir AND a.lang="' . $lang . '" AND a.revision != c.revision AND a.revision != "n/a" AND c.lang="en" ';
+    $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 files a, dirs b, enfiles c
+    WHERE a.lang = '$lang'
+     AND a.revision != c.revision AND a.revision != 'n/a'
+     AND c.name = a.name AND c.id = a.id AND b.id = a.id";
 
     if ($filter == 'dir') {
-        $sql .= 'AND a.dir = '.(int)$value;
+        $sql .= " AND b.path = '$value'";
     }
     elseif ($filter == 'translator') {
-        $sql .= 'AND a.maintainer = "'.SQLite3::escapeString($value).'"';
+        $sql .= ' AND a.maintainer = "'.SQLite3::escapeString($value).'"';
     }
 
-    $sql .= ' ORDER BY b.name';
+    $sql .= ' ORDER BY b.path';
 
     $result = $idx->query($sql);
     $tmp = array();
     while ($r = $result->fetchArray()) {
         $tmp[] = array(
-        'name' => $r['name'],
+        'file' => $r['file'],
         'en_rev' => $r['en_rev'],
         'trans_rev' => $r['trans_rev'],
         'status' => $r['status'],
         'maintainer' => $r['maintainer'],
-        'file' => $r['file']);
+        'name' => $r['dir']);
     }
 
     return $tmp;
@@ -103,7 +102,7 @@ function revcheck_available_languages($idx)
 // Return en integer
 function count_en_files($idx)
 {
-    $sql = "SELECT COUNT(name) FROM files WHERE lang = 'en'";
+    $sql = "SELECT COUNT(name) FROM enfiles";
     $res = $idx->query($sql);
     $row = $res->fetchArray();
     return $row[0];
@@ -112,32 +111,27 @@ function count_en_files($idx)
 function get_missfiles($idx, $lang)
 {
     $sql = 'SELECT
-        d.name as dir,
+        d.path as dir,
         b.size as size,
+        b.revision as revision,
         a.name as file
     FROM
-        files a,
+        utfiles a,
         dirs d
     LEFT JOIN
-        files b
+        enfiles b
     ON
-        a.dir = b.dir
+        a.id = b.id
     AND
         a.name = b.name
     WHERE
         a.lang="' . $lang . '"
     AND
-        b.lang="en"
-    AND
-        a.revision IS NULL
-    AND
-        a.size IS NULL
-    AND
-        a.dir = d.id';
+        a.id = d.id';
     $result = $idx->query($sql);
 
     while ($r = $result->fetchArray()) {
-        $tmp[] = array('dir' => $r['dir'], 'size' => $r['size'], 'file' => $r['file']);
+        $tmp[] = array('dir' => $r['dir'], 'size' => $r['size'], 'revision' => $r['revision'], 'file' => $r['file']);
     }
 
     return $tmp;
@@ -146,7 +140,7 @@ function get_missfiles($idx, $lang)
 function get_oldfiles($idx, $lang)
 {
     $sql = 'SELECT
-     dir, file, size
+     path, file, size
 
      FROM
      old_files
@@ -163,7 +157,7 @@ function get_oldfiles($idx, $lang)
 
     while ($r = $result->fetchArray()) {
         if (isset($special_files[$r['file']])) continue; // skip some files
-        $tmp[] = array('dir' => $r['dir'], 'size' => $r['size'], 'file' => $r['file']);
+        $tmp[] = array('dir' => $r['path'], 'size' => $r['size'], 'file' => $r['file']);
     }
     return $tmp;
 }
@@ -171,13 +165,13 @@ function get_oldfiles($idx, $lang)
 function get_misstags($idx, $lang)
 {
     $sql = 'SELECT
-     d.name AS dir, b.size AS en_size, a.size AS trans_size, a.name AS name
-     FROM files a, dirs d
-     LEFT JOIN files b ON a.dir = b.dir AND a.name = b.name
-     WHERE a.lang="'.$lang.'" AND b.lang="en" AND (a.revision IS NULL OR a.revision = "n/a")
-     AND a.size IS NOT NULL AND a.dir = d.id
+     d.path AS dir, a.size AS en_size, b.size AS trans_size, a.name AS name
+     FROM enfiles a, dirs d
+     LEFT JOIN files b ON a.id = b.id AND a.name = b.name AND a.id = d.id
+     WHERE b.lang="'.$lang.'" AND (b.revision IS NULL OR b.revision = "n/a")
+     AND b.size IS NOT NULL
      ORDER BY dir, name';
-
+    $tmp = NULL;
     $result = $idx->query($sql);
     while($row = $result->fetchArray()) {
         $tmp[] = $row;
@@ -204,8 +198,8 @@ function get_translators_stats($idx, $lang, $status) {
     else {
         $sql = "SELECT COUNT(a.name) AS total, a.maintainer
         FROM files a
-        LEFT JOIN files b ON a.name = b.name AND a.dir = b.dir
-        WHERE a.lang = '$lang' AND b.lang = 'en' AND a.size IS NOT NULL AND ";
+        LEFT JOIN enfiles b ON a.name = b.name AND a.id = b.id
+        WHERE a.lang = '$lang' AND a.size IS NOT NULL AND ";
 
         if ($status == 'uptodate') {
             $sql .= 'a.revision = b.revision';
@@ -229,11 +223,11 @@ function get_translators_stats($idx, $lang, $status) {
 
 function get_translators($idx, $lang)
 {
-    $sql = "SELECT nick, name, mail, svn FROM translators WHERE lang = '$lang' ORDER BY nick COLLATE NOCASE";
+    $sql = "SELECT nick, name, mail, karma FROM translators WHERE lang = '$lang' ORDER BY nick COLLATE NOCASE";
     $persons = array();
     $result = $idx->query($sql);
     while ($r = $result->fetchArray()) {
-        $persons[$r['nick']] = array('name' => $r['name'], 'mail' => $r['mail'], 'svn' => $r['svn']);
+        $persons[$r['nick']] = array('name' => $r['name'], 'mail' => $r['mail'], 'karma' => $r['karma']);
     }
     return $persons;
 }
@@ -250,14 +244,17 @@ function get_translators($idx, $lang)
 function get_stats($idx, $lang, $status) {
     if ($status == 'wip') { // special case, ehh; does anyone still use this status?
         $sql = "SELECT COUNT(*) AS total, 0 AS size
-        FROM wip
-        WHERE lang = '$lang'";
+        FROM files a, dirs b, enfiles c
+        WHERE lang = '$lang' AND a.status ='wip' AND b.id = a.id AND b.id = c.id AND a.name = c.name";
+    }
+    elseif ($status == 'notrans') {
+        $sql = "SELECT COUNT(a.name) AS total, SUM(c.size) AS size FROM utfiles a, dirs b, enfiles c WHERE a.lang = '$lang' AND b.id = a.id AND b.id = c.id AND a.name = c.name";
     }
     else {
         $sql = "SELECT COUNT(a.name) AS total, SUM(b.size) AS size
-        FROM files a
-        LEFT JOIN files b ON a.name = b.name AND a.dir = b.dir
-        WHERE a.lang = '$lang' AND b.lang = 'en' AND ";
+        FROM enfiles a
+        LEFT JOIN files b ON a.name = b.name AND a.id = b.id
+        WHERE b.lang = '$lang' AND ";
 
         if ($status == 'uptodate') {
             $sql .= 'a.revision = b.revision';
@@ -268,9 +265,6 @@ function get_stats($idx, $lang, $status) {
         elseif ($status == 'norev') {
             $sql .= '(a.revision IS NULL OR a.revision = "n/a") AND a.size IS NOT NULL';
         }
-        elseif ($status == 'notrans') {
-            $sql .= 'a.revision IS NULL AND a.size IS NULL';
-        }
     }
 
     $result = $idx->query($sql)->fetchArray();
diff --git a/scripts/gen_picture_info.php b/scripts/gen_picture_info.php
index 01c7429..c655908 100644
--- a/scripts/gen_picture_info.php
+++ b/scripts/gen_picture_info.php
@@ -59,7 +59,7 @@ function generate_image($lang, $idx) {
     $legend = array($percent[0] . '%% up to date ('.$up_to_date.')', $percent[1] . '%% outdated ('.$outdated.')', $percent[2] . '%% missing ('.$missing.')', $percent[3] . '%% without EN-Revision ('.$no_tag.')');
     $title = 'Details for '.$LANGUAGES[$lang].' PHP Manual';
 
-    $graph = new PieGraph(530,300);
+    $graph = new PieGraph(630,400);
     $graph->SetShadow();
 
     $graph->title->Set($title);
diff --git a/scripts/gen_picture_info_all_lang.php b/scripts/gen_picture_info_all_lang.php
index 38e96a7..03ccad6 100644
--- a/scripts/gen_picture_info_all_lang.php
+++ b/scripts/gen_picture_info_all_lang.php
@@ -29,7 +29,7 @@ function generate_image() {
     global $percent, $legend;
 
     // Create the graph. These two calls are always required
-    $graph = new Graph(550,250);
+    $graph = new Graph(600,262);
     $graph->SetScale("textlin");
     $graph->yaxis->scale->SetGrace(20);
 
diff --git a/scripts/populatedocs.sh b/scripts/populatedocs.sh
index b0479a3..3cdadd7 100755
--- a/scripts/populatedocs.sh
+++ b/scripts/populatedocs.sh
@@ -12,31 +12,39 @@
 # | obtain it through the world-wide-web, please send a note to          |
 # | [email protected] so we can mail you a copy immediately.               |
 # +----------------------------------------------------------------------+
-# | Authors: Jacques Marneweck <[email protected]>                         |
+# | Authors:          Nilgün Belma Bugüner <[email protected]>              |
+# |                   Jacques Marneweck <[email protected]>                |
 # +----------------------------------------------------------------------+
 #
+LANGS="de en es fr it ja pl pt_br ro ru tr uk zh"
 
-SVNBIN="/usr/bin/env svn"
+GITBIN="/usr/bin/env git"
 pushd .
 
 cd `dirname $0`/..
 source ./build-ops
 
-if [ ! -d ${SVNDIR} ]
+if [ ! -d ${GIT_DIR} ]
 then
-  echo "Making SVN directory: ${SVNDIR}"
-  /bin/mkdir ${SVNDIR}
+  echo "Making GIT directory: ${GIT_DIR}"
+  /bin/mkdir ${GIT_DIR}
 fi
 
-echo "Changing to SVN directory: ${SVNDIR}"
-cd ${SVNDIR}
+echo "Changing to GIT directory: ${GIT_DIR}"
+cd ${GIT_DIR}
 
 echo "Checking out PHP docs..."
-if [ -d ${DOCDIR} ]
+if [ -d en ]
 then
-  (cd ${DOCDIR} && ${SVNBIN} up)
+  for L in $LANGS
+  do
+    (cd ${L} && ${GITBIN} pull)
+  done
 else
-  ${SVNBIN} co http://svn.php.net/repository/phpdoc/modules/doc-all ${DOCDIR}
+  for L in $LANGS
+  do
+    ${GITBIN} clone https://github.com/php/doc-${L}.git ${L}
+  done
 fi
 
 echo -n "Reverting directory:"
diff --git a/scripts/rev.php b/scripts/rev.php
index dc54924..14422ac 100644
--- a/scripts/rev.php
+++ b/scripts/rev.php
@@ -13,11 +13,12 @@
 | obtain it through the world-wide-web, please send a note to          |
 | [email protected] so we can mail you a copy immediately.               |
 +----------------------------------------------------------------------+
-| Original Authors: Thomas Schöfbeck <tom at php dot net>              |
+| Original Authors: Thomas Schöfbeck <tom at php dot net>              |
 |                   Gabor Hojtsy    <goba at php dot net>              |
 |                   Mark Kronsbein    <mk at php dot net>              |
 |                   Jan Fabry     <cheezy at php dot net>              |
 | SQLite version Authors:                                              |
+|                   Nilgün Belma Bugüner <nilgun at php dot net>              |
 |                   Mehdi Achour         <didou at php dot net>        |
 |                   Maciej Sobaczewski   <sobak at php dot net>        |
 +----------------------------------------------------------------------+
@@ -30,7 +31,7 @@
 include '../include/init.inc.php';
 include '../include/lib_proj_lang.inc.php';
 
-$DOCS = SVN_DIR . DOC_DIR . '/';
+$DOCS = GIT_DIR;
 
 // Test the languages:
 $LANGS = array_keys($LANGUAGES);
@@ -46,8 +47,6 @@
     exit;
 }
 
-$SQL_BUFF = "INSERT INTO dirs (id, name) VALUES (1, '/');\n";
-
 $CREATE = <<<SQL
 
 CREATE TABLE description (
@@ -61,8 +60,9 @@
   nick TEXT,
   name TEXT,
   mail TEXT,
-  svn TEXT,
-  editor TEXT
+  karma TEXT,
+  editor TEXT,
+  UNIQUE (lang, nick)
 );
 
 CREATE TABLE wip (
@@ -74,37 +74,57 @@
 
 CREATE TABLE dirs (
   id INT,
-  name TEXT,
-  UNIQUE (name)
+  path TEXT,
+  UNIQUE (path)
 );
 
 CREATE INDEX dirs_1 ON dirs (id);
 
+CREATE TABLE enfiles (
+  id INT,
+  name TEXT,
+  revision TEXT,
+  size TEXT,
+  mdate TEXT,
+  UNIQUE(id, name)
+);
+
+CREATE INDEX enfiles_1 ON enfiles (id, name);
+
 CREATE TABLE files (
+  id INT,
   lang TEXT,
-  dir TEXT,
   name TEXT,
   revision TEXT,
   size TEXT,
   mdate TEXT,
   maintainer TEXT,
   status TEXT,
-  UNIQUE(lang, dir, name)
+  UNIQUE(lang, id, name)
 );
 
-CREATE INDEX files_1 ON files (dir, name);
-CREATE INDEX files_2 ON files (lang, revision, size, dir);
-CREATE INDEX files_3 ON files (lang, size, mdate, revision, size, dir);
+CREATE INDEX files_1 ON files (lang, id, name, revision);
+CREATE INDEX files_2 ON files (lang, id, name, mdate, revision);
+CREATE INDEX files_3 ON files (lang, id, name, maintainer, mdate, revision);
+
+CREATE TABLE utfiles (
+  id INT,
+  lang TEXT,
+  name TEXT,
+  UNIQUE(lang, id, name)
+);
 
 CREATE TABLE old_files (
   lang TEXT,
-  dir TEXT,
+  path TEXT,
   file TEXT,
   size INT
 );
 
 SQL;
 
+$SQL_BUFF = "INSERT INTO dirs VALUES (1, '/');\n";
+
 /**
 *   Functions
 **/
@@ -119,7 +139,7 @@ function parse_translation($lang)
     $translation_xml = $DOCS . $lang . "/translation.xml";
 
     $intro = "No intro available for the {$LANGUAGES[$lang]} translation of the manual.";
-    $charset  = 'iso-8859-1';
+    $charset  = 'utf-8';
 
     if (file_exists($translation_xml)) {
         // Else go on, and load in the file, replacing all
@@ -250,7 +270,10 @@ function do_revcheck($dir = '') {
             || $dir == '/chmonly' || $dir == '/internals' || $dir == '/internals2'
             || $file == 'contributors.ent' || $file == 'contributors.xml'
             || ($dir == '/appendices' && ($file == 'reserved.constants.xml' || $file == 'extensions.xml'))
+            || $file == '.editorconfig'
+            || $file == '.gitignore'
             || $file == 'README'
+            || $file == 'README.md'
             || $file == 'DO_NOT_TRANSLATE'
             || $file == 'rsusi.txt'
             || $file == 'missing-ids.xml'
@@ -260,7 +283,7 @@ function do_revcheck($dir = '') {
                 continue;
             }
 
-            if ($file != '.' && $file != '..' && $file != '.svn' && $dir != '/functions') {
+            if ($file != '.' && $file != '..' && $file != '.git' && $dir != '/functions' && $dir != '/.git' && $dir != '/.github' && $file != '.github') {
 
                 if (is_dir($DOCS . 'en' . $dir.'/' .$file)) {
                     $entriesDir[] = $file;
@@ -269,33 +292,37 @@ function do_revcheck($dir = '') {
                 }
             }
         }
-
+        $cwd = getcwd();
         // Files first
+        $maintainer = NULL;
+        $status = NULL;
         if (sizeof($entriesFiles) > 0 ) {
             foreach($entriesFiles as $file) {
-                $path = $DOCS . 'en' . $dir . '/' . $file;
-
-                $size = intval(filesize($path) / 1024);
-                $date = filemtime($path);
-                $revision = get_original_rev($path);
+                $path = $DOCS . 'en' . $dir . '/';
+                chdir ($path);
+                $size = intval(filesize($file) / 1024);
+                $date = filemtime($file);
+                $revision = `git log -n1 --format=format:"%H" -- {$file};`;
                 $revision = ($revision == 0) ? 'NULL' : "'$revision'";
-
-                $SQL_BUFF .= "INSERT INTO files VALUES ('en', '$id', '$file', $revision, '$size','$date', NULL, NULL);\n";
+                $SQL_BUFF .= "INSERT INTO enfiles VALUES ($id, '$file', $revision, '$size', '$date');\n";
 
                 foreach ($LANGS as $lang) {
                     $path = $DOCS . $lang . $dir . '/' . $file;
                     if (is_file($path)) {
                         $size = intval(filesize($path) / 1024);
                         $date = filemtime($path);
+
                         list($revision, $maintainer, $status) = get_tags($path);
-                        echo " Adding file: $lang$dir/$file\n";
-                        $SQL_BUFF .= "INSERT INTO files VALUES ('$lang', '$id', '$file', $revision, '$size', $date, $maintainer, $status);\n";
+                        echo " Adding file: {$id}, {$lang}, {$file},{$revision}, {$size}, {$date}, {$maintainer}, {$status}\n";
+
+                        $SQL_BUFF .= "INSERT INTO files VALUES ($id, '$lang', '$file', '$revision', '$size', '$date', '$maintainer', '$status');\n";
                     } else {
-                        $SQL_BUFF .= "INSERT INTO files VALUES ('$lang', '$id', '$file', NULL, NULL, NULL, NULL, NULL);\n";
+                        $SQL_BUFF .= "INSERT INTO utfiles VALUES ($id, '$lang', '$file');\n";
                     }
                 }
             }
         }
+        chdir($cwd);
 
         // Directories..
         if (sizeof($entriesDir) > 0) {
@@ -303,19 +330,21 @@ function do_revcheck($dir = '') {
             reset($entriesDir);
 
             foreach ($entriesDir as $Edir) {
-                $path = $DOCS . 'en/' . $dir . '/' . $Edir;
-                $id++;
-                echo "Adding directory: $dir/$Edir (id: $id)\n";
+                if ($Edir != 'figures') {
+                    $path = $DOCS . 'en/' . $dir . '/' . $Edir;
+                    $id++;
+                    echo "Adding directory: $dir/$Edir (id: $id)\n";
 
-                $SQL_BUFF .= "INSERT INTO dirs VALUES (" . $id . ", '$dir/$Edir');\n";
-                do_revcheck($dir . '/' . $Edir);
+                    $SQL_BUFF .= "INSERT INTO dirs VALUES ($id, '$dir/$Edir');\n";
+                    do_revcheck($dir . '/' . $Edir);
+                }
             }
         }
     }
     closedir($dh);
 }
 
-function check_old_files($dir = '', $lang) {
+function check_old_files($lang, $dir = '') {
     global $DOCS, $SQL_BUFF;
     static $id = 1;
 
@@ -328,13 +357,15 @@ function check_old_files($dir = '', $lang) {
             if (
             (!is_dir($DOCS . $lang . $dir.'/' .$file) && !in_array(substr($file, -3), array('xml','ent')) && substr($file, -13) != 'PHPEditBackup' )
             || strpos($file, 'entities.') === 0
-            || $dir == '/chmonly' || $dir == '/internals' || $dir == '/internals2'
+            || $dir == '/chmonly' || $dir == '/internals' || $dir == '/internals2' || $dir == '/.git' || $dir == '/.github'
             || $file == 'contributors.ent' || $file == 'contributors.xml'
             || ($dir == '/appendices' && ($file == 'reserved.constants.xml' || $file == 'extensions.xml'))
             || $file == 'README'
+            || $file == 'README.md'
             || $file == 'DO_NOT_TRANSLATE'
             || $file == 'rsusi.txt'
             || $file == 'missing-ids.xml'
+            || $file == 'translation.xml'
             ) {
                 continue;
             }
@@ -369,7 +400,7 @@ function check_old_files($dir = '', $lang) {
             reset($entriesDir);
 
             foreach ($entriesDir as $Edir) {
-                check_old_files($dir . '/' . $Edir, $lang);
+                check_old_files($lang, $dir . '/' . $Edir);
             }
         }
     }
@@ -380,17 +411,17 @@ function get_tags($file) {
     // Read the first 500 chars. The comment should be at
     // the begining of the file
     $fp = @fopen($file, "r") or die("Unable to read $file.");
-    $line = fread($fp, 500);
+    $line = fread($fp, 1024);
     fclose($fp);
 
     // No match before the preg
     $match = array ();
 
     // Check for the translations "revision tag"
-    if (preg_match("/<!--\s*EN-Revision:\s*(\d+)\s*Maintainer:\s*(\\S*)\s*Status:\s*(.+)\s*-->/U",
-    $line, $match)) {
+    $regex = "/<!--\s*EN-Revision:\s*(.+)\s*Maintainer:\s*(.+)\s*Status:\s*(.+)\s*-->/U";
+    if (preg_match ( $regex , $line , $match )) {
         // note the simple quotes
-        return array("'" . trim($match[1]) . "'", "'" . trim($match[2]) . "'", "'" . trim($match[3]) . "'");
+        return array(trim($match[1]),trim($match[2]),trim($match[3]));
     }
 
     // The tag with revision number is not found so search
@@ -410,7 +441,7 @@ function get_original_rev($file) {
     // Read the first 500 chars. The comment should be at
     // the begining of the file
     $fp = @fopen($file, "r") or die ("Unable to read $file.");
-    $line = fread($fp, 500);
+    $line = fread($fp, 1024);
     fclose($fp);
 
     // Return if this was needed (it should be there)
@@ -470,7 +501,7 @@ function get_original_rev($file) {
 
 // 4:1 - Recurse in the manuel seeking for old files for each language and fill $SQL_BUFF
 foreach ($LANGS as $lang) {
-    check_old_files('', $lang);
+    check_old_files($lang, '');
 }
 
 // 5 - Query $SQL_BUFF and exit
diff --git a/www/revcheck.php b/www/revcheck.php
index 6d561c9..0c7de1d 100644
--- a/www/revcheck.php
+++ b/www/revcheck.php
@@ -4,6 +4,13 @@
 include '../include/init.inc.php';
 include '../include/lib_revcheck.inc.php';
 
+// Revision marks used to flag files
+define("REV_UPTODATE", 1); // Up to date files
+define("REV_OUTDATED", 2); // Outdated files
+define("REV_NOREV",    3); // file with revision comment without revision
+define("REV_NOTRANS",  4); // file without translation (utfiles)
+define("REV_WIP",      5); // Work in progress
+
 if (isset($_GET['lang']) && in_array($_GET['lang'], array_keys($LANGUAGES))) {
 	$lang = $_GET['lang'];
 }
@@ -11,7 +18,9 @@
 	$lang = 'en';
 }
 
-$lang_name = $LANGUAGES[$lang];
+if ($lang != 'en' ) $lang_name = $LANGUAGES[$lang];
+
+$tool = '';
 
 if (isset($_GET['p'])) {
 	$tool = $_GET['p'];
@@ -67,7 +76,7 @@
 <tr>
 <th rowspan="2">Name</th>
 <th rowspan="2">Nick</th>
-<th rowspan="2">SVN</th>
+<th rowspan="2">Karma</th>
 <th colspan="7">Files maintained</th>
 </tr>
 <tr>
@@ -82,7 +91,7 @@
 				echo '<tr>',
 				'<td><a href="mailto:'.$data['mail'].'">'.$data['name'].'</a></td>',
 				'<td><a href="/revcheck.php?p=files&amp;user='.$nick.'&amp;lang='.$lang.'">'.$nick.'</a></td>',
-				'<td>'.(($data['svn'] == 'yes') ? '✓' : '&nbsp;').'</td>',
+				'<td>'.(($data['karma'] == 'yes') ? '✓' : '&nbsp;').'</td>',
 				'<td>' , @$files_w[$nick]['uptodate'], '</td>',
 				'<td>' , $files_w[$nick]['outdated'], '</td>',
 				'<td>', $files_w[$nick]['wip'], '</td>',
@@ -102,23 +111,23 @@
 		else {
 			$num = count($missfiles);
 			echo '<table border="0" cellpadding="3" cellspacing="1" style="text-align:center">';
-			echo '<tr><th rowspan="1">Available for translation ('.$num.' files):</th><th colspan="1">kB</th></tr>';
+			echo '<tr><th rowspan="1">Available for translation ('.$num.' files):</th><th>Commit Hash</th><th colspan="1">kB</th></tr>';
 
 			$last_dir = false;
 			$total_size = 0;
 			foreach ($missfiles as $miss) {
 				if (!$last_dir || $last_dir != $miss['dir']) {
-					echo '<tr><th colspan="2">'.$miss['dir'].'</th></tr>';
+					echo '<tr><th colspan="3">'.$miss['dir'].'</th></tr>';
 					$last_dir = $miss['dir'];
 				}
-				echo '<tr><td>'.$miss['file'].'</td><td>'.$miss['size'].'</td></tr>';
+				echo '<tr><td>'.$miss['file'].'</td><td>'.$miss['revision'].'</td><td>'.$miss['size'].'</td></tr>';
 				$total_size += $miss['size'];
 				// flush every 200 kbytes
 				if (($total_size % 200) == 0) {
 					flush();
 				}
 			}
-			echo '<tr><th colspan="2">Total Size ('.$num.' files): '.$total_size.' kB</th></tr>';
+			echo '<tr><th colspan="3">Total Size ('.$num.' files): '.$total_size.' kB</th></tr>';
 			echo '</table>';
 		}
 		echo gen_date($DBLANG);
@@ -156,11 +165,12 @@
 
 	case 'misstags':
 		$misstags = get_misstags($dbhandle, $lang);
-		$num = count($misstags);
-		if (!$num) {
+
+		if ($misstags == NULL) {
 			echo '<p>Good, all files contain revision numbers.</p>';
 		}
 		else {
+		 $num = count($misstags);
 			echo '<table border="0" cellpadding="3" cellspacing="1" style="text-align:center">';
 			echo '<tr><th rowspan="2">Files without EN-Revision number ('.$num.' files):</th><th colspan="3">Sizes in kB</th></tr>';
 			echo '<tr><th>en</th><th>'.$lang.'</th><th>diff</th></</tr>';
@@ -324,18 +334,24 @@
 				}
 
 				// Make a link to the SVN repository's diff script
-				$r['short_name'] = '<a href="http://svn.php.net/viewvc/phpdoc/en/trunk' . $r['name'] . '/' . $r['file'] .
-				'?r1=' . $r['trans_rev'] . '&amp;r2=' . $r['en_rev'] . '&amp;view=patch">' . $r['file'] . '</a>';
+				$key = substr($r['name'] . '/' . $r['file'], 1);
+				if ($r['name'] == '/') {
+				    $key = $r['file'];
+    }
+    $d1 = "https://git.php.net/?p=doc/en.git;a=blobdiff_plain;f=$key;hb={$r['en_rev']};hpb={$r['trans_rev']};"; // text
+
+    $d2 = "https://git.php.net/?p=doc/en.git;a=blobdiff;f=$key;hb={$r['en_rev']};hpb={$r['trans_rev']};";       // html
+    $nm = "<a href='$d1'>{$r['file']}</a> <a href='$d2'>(html)</a>";
+
+    $h1 = "<a href='http://git.php.net/?p=doc/en.git;a=blob;f=$key;hb={$r['en_rev']}'>{$r['en_rev']}</a>";
 
-				// Add a [diff] link
-				$r['short_name'] .= ' <a href="http://svn.php.net/viewvc/phpdoc/en/trunk' . $r['name'] . '/' . $r['file'] .
-				'?r1=' . $r['trans_rev'] . '&amp;r2=' . $r['en_rev'] . '">[diff]</a>';
+    $h2 = "<a href='http://git.php.net/?p=doc/en.git;a=blob;f=$key;hb={$r['trans_rev']}'>{$r['trans_rev']}</a>";
 
 				// Write out the line for the current file (get file name shorter)
 				echo '<tr>'.
-				"<td>{$r['short_name']}</td>".
-				"<td>{$r['en_rev']}</td>" .
-				"<td>{$r['trans_rev']}</td>" .
+				"<td style='white-space:nowrap'>{$nm}</td>".
+				"<td>{$h1}</td>" .
+				"<td>{$h2}</td>" .
 				"<td> {$r['maintainer']}</td>" .
 				"<td> {$r['status']}</td></tr>\n";
 			}