[web-doc] master: Added gitweb installation

[email protected] (Nilgün Belma Bugüner) Fri, 23 Apr 2021 12:23:35 +0000
Newsgroups php.doc.web
Message-ID <[email protected]>
Author: Nilgün Belma Bugüner (nilgun)
Date: 2021-04-23T15:23:34+03:00

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

Added gitweb installation
adjusted scripts by gitweb
fixed typos

Changed paths:
  M  .gitignore
  M  README.md
  M  scripts/rev.php
  M  www/revcheck.php


Diff:

diff --git a/.gitignore b/.gitignore
index 7ba3f7d..bbe059d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ sqlite
 git
 www/images
 www/robots.txt
+www/doc
\ No newline at end of file
diff --git a/README.md b/README.md
index 6fd013b..b6cc21e 100644
--- a/README.md
+++ b/README.md
@@ -14,17 +14,17 @@ Requirements:
 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
+		- `@SQLITEDIR@` - absolute path to `/sqlite/` directory
 	- `build-ops.sample` (rename it to `build-ops` [no ext])
 		- `@PHP@` - path to the PHP executable file
 		- `@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
+		- `@SQLITEDIR@` - absolute path to `/sqlite/` directory
 		- `@SRCDIR@` - path to the directory with PHP source code in SVN repo
 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
+6. You need to run the scripts/generation.sh to generate the database and graphs (Time of generation: 921.84918999672 s)
 7. Configure the virtual host under Apache. Current suggested settings are:
 ```
 <VirtualHost 127.0.0.1:80>
@@ -40,10 +40,77 @@ Requirements:
 
  <Directory /path/to/docweb/www>
   Allowoverride FileInfo Options Limit
-  Options -Indexes
+  Options -Indexes +ExecCGI
+  <Files gitweb.cgi>
+   SetHandler cgi-script
+  </Files>
  </Directory>
 </VirtualHost>
 ```
+8. Create /etc/httpd/conf/extra/gitweb.conf
+```
+<IfModule mod_alias.c>
+  <IfModule mod_mime.c>
+    <IfModule mod_cgi.c>
+      Define ENABLE_GITWEB
+    </IfModule>
+    <IfModule mod_cgid.c>
+      Define ENABLE_GITWEB
+    </IfModule>
+  </IfModule>
+</IfModule>
+
+<IfDefine ENABLE_GITWEB>
+  Alias /gitweb /usr/share/gitweb
+
+  <Directory /usr/share/gitweb>
+    DirectoryIndex gitweb.cgi
+    Options +FollowSymLinks +ExecCGI
+    <Files gitweb.cgi>
+      SetHandler cgi-script
+    </Files>
+    AddHandler cgi-script .cgi
+    AllowOverride None
+    SetEnv  GITWEB_CONFIG  /etc/gitweb.conf
+  </Directory>
+</IfDefine>
+```
+9. Add the following line to /etc/httpd/conf/httpd.conf (cgi.load)
+```
+LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so
+```
+10. Next we need to make a gitweb config file. Open (or create if it does not exist) the file /etc/gitweb.conf and place this in it:
+```
+# path to git projects (<project>.git)
+$projectroot = "/path/to/docweb/www";
+
+# directory to use for temp files
+$git_temp = "/tmp";
+
+# Base URLs for links displayed in the web interface.
+our @git_base_url_list = qw(git://git.php.net:);
+
+$feature{'highlight'}{'default'} = [1];
+$omit_owner = "true";
+$projects_list_description_width = "36";
+```
+11. Restart apache
+```
+# systemctl restart apache2
+```
+12. Create symbolic links for gitweb
+```
+$ cd /path/to/docweb/www
+$ mkdir doc
+$ cd doc
+```
+repeat lines like these for other languages
+```
+$ ln -s ../../git/de/.git de.git
+$ echo "German PHP documentation" > de.git/description
+```
+11. If there is no problem, open browser and go: http://doc.php.net/docweb/
+12. Or: http://doc.php.net/revcheck.php
 
 ## TODO
 - add more cowbell
diff --git a/scripts/rev.php b/scripts/rev.php
index 14422ac..2b56088 100644
--- a/scripts/rev.php
+++ b/scripts/rev.php
@@ -18,9 +18,9 @@
 |                   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>        |
+|                   Nilgün Belma Bugüner <nilgun at php dot net>       |
+|                   Mehdi Achour          <didou at php dot net>       |
+|                   Maciej Sobaczewski    <sobak at php dot net>       |
 +----------------------------------------------------------------------+
 */
 
diff --git a/www/revcheck.php b/www/revcheck.php
index 0c7de1d..5205c16 100644
--- a/www/revcheck.php
+++ b/www/revcheck.php
@@ -333,19 +333,22 @@
 					$r["maintainer"] = '<a href="?p=translators&amp;lang=' . $lang . '">' . $r["maintainer"] . '</a>';
 				}
 
-				// Make a link to the SVN repository's diff script
+				// Make a link to the GIT repository's diff script
 				$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
+				}
+				//text
+				$d1 = "/gitweb/?p=doc/en.git;a=blobdiff_plain;f=$key;hb={$r['en_rev']};hpb={$r['trans_rev']};";
+
+				//html
+				$d2 = "/gitweb/?p=doc/en.git;a=blobdiff;f=$key;hb={$r['en_rev']};hpb={$r['trans_rev']};";
 
-    $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>";
+				$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>";
+				$h1 = "<a href='/gitweb/?p=doc/en.git;a=blob;f=$key;hb={$r['en_rev']}'>{$r['en_rev']}</a>";
 
-    $h2 = "<a href='http://git.php.net/?p=doc/en.git;a=blob;f=$key;hb={$r['trans_rev']}'>{$r['trans_rev']}</a>";
+				$h2 = "<a href='/gitweb/?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>'.