savannah-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Savannah-cvs] [242] FrontEndHostRedirection: new page about gnu/nongnu


From: assafgordon
Subject: [Savannah-cvs] [242] FrontEndHostRedirection: new page about gnu/nongnu host redirection
Date: Thu, 29 Sep 2016 01:19:40 +0000 (UTC)

Revision: 242
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=administration&revision=242
Author:   agn
Date:     2016-09-29 01:19:35 +0000 (Thu, 29 Sep 2016)
Log Message:
-----------
FrontEndHostRedirection: new page about gnu/nongnu host redirection

Modified Paths:
--------------
    trunk/sviki/FrontEndDevelopmentSite.mdwn
    trunk/sviki/FrontPage.mdwn

Added Paths:
-----------
    trunk/sviki/FrontEndHostRedirection.mdwn

Modified: trunk/sviki/FrontEndDevelopmentSite.mdwn
===================================================================
--- trunk/sviki/FrontEndDevelopmentSite.mdwn    2016-09-29 00:08:12 UTC (rev 
241)
+++ trunk/sviki/FrontEndDevelopmentSite.mdwn    2016-09-29 01:19:35 UTC (rev 
242)
@@ -250,6 +250,7 @@
 
     $sys_default_domain="jsmith.frontend0.savannah.gnu.org";
     $sys_brother_domain="jsmith.frontend0.savannah.nongnu.org";
+    $sys_debug_nobasehost=true; #disable gnu/nongnu redirection
     $sys_incdir="/home/jsmith/savannah/etc/savane/content/gnu-content";
     $sys_name="Savannah-jsmith-DEV";
     $sys_upload_dir="/home/jsmith/savannah/var/www/submissions_uploads/";
@@ -257,6 +258,10 @@
     $sys_trackers_attachments_dir=$sys_appdatadir . "/trackers_attachments";
 
 
+See [[FrontEndHostRedirection]] to learn about gnu/nongnu host redirection
+(keep the debug variable `true` unless you read and understand the redirection
+page).
+
 The outcome should look like:
 
     $ cd /home/jsmith/savannah/etc/savane

Added: trunk/sviki/FrontEndHostRedirection.mdwn
===================================================================
--- trunk/sviki/FrontEndHostRedirection.mdwn                            (rev 0)
+++ trunk/sviki/FrontEndHostRedirection.mdwn    2016-09-29 01:19:35 UTC (rev 
242)
@@ -0,0 +1,124 @@
+FrontEnd GNU/NONGNU host redirection
+====================================
+
+Savannah hosts both GNU and NONGNU projects.
+For each type, it redirects the visitor to the
+correct URL (savannah.gnu.org or savannah.nongnu.org, respectively).
+
+Redirection happens for every project-related page (e.g. main project page,
+bugs, support, etc.).
+
+
+
+Enable/Disable redirection
+--------------------------
+
+In `.savane.conf.php`, setting the boolean variable
+`$sys_debug_nobasehost` to `false` disable redirection completely -
+useful for [[FrontEndDevelopmentSite]].
+
+
+
+Redirection hosts
+-----------------
+
+The hosts used for redirections are defined in the *database*
+(*not* in the configuration file). This is both annoying and confusing.
+
+When page is visited (if it relates to a hosted project), the
+function `$project->getTypeBaseHost()` is called and returns the host
+that is relevant to the viewed project (baed on the project's type).
+
+The values on the production site are:
+
+    mysql> select type_id, name, base_host from group_type ;
+    +---------+------------------------------------+---------------------+
+    | type_id | name                               | base_host           |
+    +---------+------------------------------------+---------------------+
+    |       1 | Official GNU software              | savannah.gnu.org    |
+    |       2 | non-GNU software and documentation | savannah.nongnu.org |
+    |       3 | www.gnu.org portions               | savannah.gnu.org    |
+    |       4 | GUG                                | savannah.nongnu.org |
+    |       6 | www.gnu.org translation teams      | savannah.gnu.org    |
+    +---------+------------------------------------+---------------------+
+    5 rows in set (0.00 sec)
+
+Meaning: if redirection is enabled on a development site, these values
+will cause redirection to the real website.
+
+To test redirection on a [[FrontEndDevelopmentSite]], do the following
+(*on a development database copy, never on the real database `savane`*):
+
+    mysql> update group_type set base_host = 
"jsmith.frontend0.savannah.gnu.org" where type_id in (1,3,6);
+    Query OK, 3 rows affected (0.00 sec)
+    Rows matched: 3  Changed: 3  Warnings: 0
+
+    mysql> update group_type set base_host = 
"jsmith.frontend0.savannah.nongnu.org" where type_id in (2,4);
+    Query OK, 2 rows affected (0.00 sec)
+    Rows matched: 2  Changed: 2  Warnings: 0
+
+    mysql> select type_id, name, base_host from group_type ;
+    
+---------+------------------------------------+--------------------------------------+
+    | type_id | name                               | base_host                 
           |
+    
+---------+------------------------------------+--------------------------------------+
+    |       1 | Official GNU software              | 
jsmith.frontend0.savannah.gnu.org    |
+    |       2 | non-GNU software and documentation | 
jsmith.frontend0.savannah.nongnu.org |
+    |       3 | www.gnu.org portions               | 
jsmith.frontend0.savannah.gnu.org    |
+    |       4 | GUG                                | 
jsmith.frontend0.savannah.nongnu.org |
+    |       6 | www.gnu.org translation teams      | 
jsmith.frontend0.savannah.gnu.org    |
+    
+---------+------------------------------------+--------------------------------------+
+    5 rows in set (0.00 sec)
+
+Then set `$sys_debug_nobasehost=false;` the development `.savane.conf.php` 
file.
+
+Redirection should work within the development site, between gnu and nongnu.
+
+
+Brother-Domain in savane conf
+-----------------------------
+
+In `.savane.conf.php` there are these two variables:
+
+    $sys_default_domain="savannah.gnu.org";
+    $sys_brother_domain="savannah.nongnu.org";
+
+Or in a [[FrontEndDevelopmentSite]]:
+
+    $sys_default_domain="jsmith.frontend0.savannah.gnu.org";
+    $sys_brother_domain="jsmith.frontend0.savannah.nongnu.org";
+
+These variables only seem to affect the login process
+(i.e. the "Login also in savannah.nongnu.org" checkbox in the login page).
+
+Setting these alone will not make the redirection work - updating the database
+is required (as shown above).
+
+
+
+PHP Code
+--------
+
+The variable `$ sys_debug_nobasehost` is mentioned in the following files:
+
+    $ git grep debug_nobasehost
+    include/init.php:$sys_debug_nobasehost = false;
+    include/init.php:  if (isset($group_id) && empty($no_redirection) && 
!$sys_debug_nobasehost)
+    include/project_home.php:if (!$sys_debug_nobasehost && 
strcasecmp($_SERVER['HTTP_HOST'], $project->getTypeBaseHost())
+
+The variable domain/brother-domain variables are mentioned here:
+
+    $ git grep brother_domain
+    account/login.php:      if (!empty($GLOBALS['sys_brother_domain']) && 
$brotherhood)
+    account/login.php:            header ("Location: 
".$http."://".$GLOBALS['sys_brother_domain'].$GLOBALS['sys_home']."/a
+    account/login.php:            header("Location: 
".$http."://".$GLOBALS['sys_brother_domain'].$uri);
+    account/login.php:if (!empty($GLOBALS['sys_brother_domain']))
+    account/login.php:  printf (_("Login also in %s").'</span><br />', 
$GLOBALS['sys_brother_domain']);
+    account/su.php:  if (!empty($GLOBALS['sys_brother_domain']))
+    account/su.php:   header ("Location: 
".su_getprotocol()."://".$GLOBALS['sys_brother_domain'].$GLOBALS['sys_home']."acc
+    account/su.php: header("Location: 
".su_getprotocol()."://".$GLOBALS['sys_brother_domain'].$uri);
+    account/su.php:  header("Location: 
".su_getprotocol()."://".$GLOBALS['sys_brother_domain'].$uri);
+    account/su.php:  if (!empty($GLOBALS['sys_brother_domain']))
+    account/su.php:   header ("Location: 
".su_getprotocol()."://".$GLOBALS['sys_brother_domain'].$GLOBALS['sys_home']."acc
+    account/su.php: header("Location: 
".su_getprotocol()."://".$GLOBALS['sys_brother_domain'].$uri);
+    account/su.php:  header("Location: 
".su_getprotocol()."://".$GLOBALS['sys_brother_domain'].$uri);
+

Modified: trunk/sviki/FrontPage.mdwn
===================================================================
--- trunk/sviki/FrontPage.mdwn  2016-09-29 00:08:12 UTC (rev 241)
+++ trunk/sviki/FrontPage.mdwn  2016-09-29 01:19:35 UTC (rev 242)
@@ -166,6 +166,8 @@
     -   [[FrontEndSetup]] -
     -   [[FrontEndDevelopmentSite]] - How to setup a dedicated development site
         for savannah (on frontend.sv.gnu.org)
+    -   [[FrontEndHostRedirection]] - notes about automatic gnu/nongnu host
+        redirection, important for development sites.
     -   [[FrontEndDebuggingTips]] - points for easier PHP debugging.
 
     -   [[RunningSavaneLocally]]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]