From 22ef4880e565d902aac3875105062de03c3ff8ca Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 15 Jun 2010 10:21:39 -0400
Subject: [PATCH] Implemented: FS#461 - Add Ruby support

---
 server/conf/vhost.conf.master                     |   18 ++++++++++++++++++
 docs/INSTALL_DEBIAN_6.0_dovecot_bind.txt          |    4 ++--
 docs/INSTALL_DEBIAN_5.0_courier_mydns.txt         |    4 ++--
 docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt          |    4 ++--
 install/sql/ispconfig3.sql                        |    1 +
 interface/web/sites/lib/lang/en_web_domain.lng    |    1 +
 docs/INSTALL_DEBIAN_6.0_courier_mydns.txt         |    4 ++--
 interface/web/sites/form/web_domain.tform.php     |    6 ++++++
 interface/web/sites/templates/web_domain_edit.htm |    8 +++++++-
 9 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/docs/INSTALL_DEBIAN_5.0_courier_mydns.txt b/docs/INSTALL_DEBIAN_5.0_courier_mydns.txt
index c3dae3b..bd4e9d4 100644
--- a/docs/INSTALL_DEBIAN_5.0_courier_mydns.txt
+++ b/docs/INSTALL_DEBIAN_5.0_courier_mydns.txt
@@ -118,14 +118,14 @@
 
 3) Install apache, PHP5, phpmyadmin, better fastCGI, suexec, Pear and mcrypt (1 line!):
 
-apt-get -y install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libopenssl-ruby
+apt-get -y install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libopenssl-ruby libapache2-mod-ruby
 
 
 # When phpMyAdmin is asking weather to configure itself automatically, select "Apache2"
 
 # Then run the following to enable the Apache modules suexec, rewrite and ssl:
 
-a2enmod suexec rewrite ssl actions include
+a2enmod suexec rewrite ssl actions include ruby
 
 # If you want to use webdav then run the following to enable the Apache webdav modules:
 
diff --git a/docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt b/docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt
index 21ec3a0..20c6738 100644
--- a/docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt
+++ b/docs/INSTALL_DEBIAN_5.0_dovecot_bind.txt
@@ -86,14 +86,14 @@
 
 3) Install apache, PHP5, phpmyadmin, better fastCGI, suexec, Pear and mcrypt (1 line!):
 
-apt-get -y install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libopenssl-ruby
+apt-get -y install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libopenssl-ruby libapache2-mod-ruby
 
 
 # When phpMyAdmin is asking weather to configure itself automatically, select "Apache2"
 
 # Then run the following to enable the Apache modules suexec, rewrite and ssl:
 
-a2enmod suexec rewrite ssl actions include
+a2enmod suexec rewrite ssl actions include ruby
 
 # If you want webdav then run the following to enable the Apache webdav modules:
 
diff --git a/docs/INSTALL_DEBIAN_6.0_courier_mydns.txt b/docs/INSTALL_DEBIAN_6.0_courier_mydns.txt
index 258b50f..bdbb67d 100644
--- a/docs/INSTALL_DEBIAN_6.0_courier_mydns.txt
+++ b/docs/INSTALL_DEBIAN_6.0_courier_mydns.txt
@@ -112,7 +112,7 @@
 
 3) Install apache, PHP5, phpmyadmin, better fastCGI, suexec, Pear and mcrypt (1 line!):
 
-apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt imagemagick libapache2-mod-suphp libopenssl-ruby
+apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt imagemagick libapache2-mod-suphp libopenssl-ruby libapache2-mod-ruby
 
 #this package is actual missed on official squeeze repository: php5-imagick
 
@@ -120,7 +120,7 @@
 
 # Then run the following to enable the Apache modules suexec, rewrite and ssl:
 
-a2enmod suexec rewrite ssl actions include
+a2enmod suexec rewrite ssl actions include ruby
 
 # If you want webdav then run the following to enable the Apache webdav modules:
 
diff --git a/docs/INSTALL_DEBIAN_6.0_dovecot_bind.txt b/docs/INSTALL_DEBIAN_6.0_dovecot_bind.txt
index 84b93cc..e3c6275 100644
--- a/docs/INSTALL_DEBIAN_6.0_dovecot_bind.txt
+++ b/docs/INSTALL_DEBIAN_6.0_dovecot_bind.txt
@@ -84,14 +84,14 @@
 
 3) Install apache, PHP5, phpmyadmin, better fastCGI, suexec, Pear and mcrypt (1 line!):
 
-apt-get -y install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt imagemagick libapache2-mod-suphp libopenssl-ruby
+apt-get -y install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt imagemagick libapache2-mod-suphp libopenssl-ruby libapache2-mod-ruby
 
 
 # When phpMyAdmin is asking weather to configure itself automatically, select "Apache2"
 
 # Then run the following to enable the Apache modules suexec, rewrite and ssl:
 
-a2enmod suexec rewrite ssl actions include
+a2enmod suexec rewrite ssl actions include ruby
 
 # restart apache before continuing
 
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index f09766d..beab740 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -1064,6 +1064,7 @@
   `is_subdomainwww` tinyint(1) NOT NULL default '1',
   `subdomain` enum('none','www','*') NOT NULL default 'none',
   `php` varchar(32) NOT NULL default 'y',
+  `ruby` enum('n','y') NOT NULL default 'n',
   `redirect_type` varchar(255) default NULL,
   `redirect_path` varchar(255) default NULL,
   `ssl` enum('n','y') NOT NULL default 'n',
diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php
index 7b05352..9d7a1c1 100644
--- a/interface/web/sites/form/web_domain.tform.php
+++ b/interface/web/sites/form/web_domain.tform.php
@@ -193,6 +193,12 @@
 			'valuelimit' => 'client:web_php_options',
 			'value'		=> array('no' => 'Disabled', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP')
 		),
+		'ruby' => array (
+			'datatype'	=> 'VARCHAR',
+			'formtype'	=> 'CHECKBOX',
+			'default'	=> 'n',
+			'value'		=> array(0 => 'n',1 => 'y')
+		),
 		'active' => array (
 			'datatype'	=> 'VARCHAR',
 			'formtype'	=> 'CHECKBOX',
diff --git a/interface/web/sites/lib/lang/en_web_domain.lng b/interface/web/sites/lib/lang/en_web_domain.lng
index b26014d..84ae4d0 100644
--- a/interface/web/sites/lib/lang/en_web_domain.lng
+++ b/interface/web/sites/lib/lang/en_web_domain.lng
@@ -58,4 +58,5 @@
 $wb["redirect_error_regex"] = 'Invalid redirect path. Valid redirects are for example: /test/ or http://www.domain.tld/test/';
 $wb["php_open_basedir_txt"] = 'PHP open_basedir';
 $wb["traffic_quota_exceeded_txt"] = 'Traffic quota exceeded';
+$wb["ruby_txt"] = 'Ruby';
 ?>
diff --git a/interface/web/sites/templates/web_domain_edit.htm b/interface/web/sites/templates/web_domain_edit.htm
index d69a3f9..42c9ed1 100644
--- a/interface/web/sites/templates/web_domain_edit.htm
+++ b/interface/web/sites/templates/web_domain_edit.htm
@@ -70,7 +70,13 @@
 					<div class="multiField">
 						{tmpl_var name='ssi'}
 					</div>
-			</div>
+	  </div>
+	  <div class="ctrlHolder">
+				<p class="label">{tmpl_var name='ruby_txt'}</p>
+					<div class="multiField">
+						{tmpl_var name='ruby'}
+					</div>
+	  </div>
       <div class="ctrlHolder">
 				<p class="label">{tmpl_var name='suexec_txt'}</p>
 					<div class="multiField">
diff --git a/server/conf/vhost.conf.master b/server/conf/vhost.conf.master
index 9995e76..5d5f5da 100644
--- a/server/conf/vhost.conf.master
+++ b/server/conf/vhost.conf.master
@@ -66,6 +66,24 @@
         AddOutputFilter INCLUDES .shtml
         Options +Includes
 </tmpl_if>
+<tmpl_if name='ruby' op='==' value='y'>
+    <IfModule mod_ruby.c>
+      <Directory {tmpl_var name='web_document_root'}>
+        Options +ExecCGI
+      </Directory>
+      RubyRequire apache/ruby-run
+      #RubySafeLevel 0
+      <Files *.rb>
+        SetHandler ruby-object
+        RubyHandler Apache::RubyRun.instance
+      </Files>
+      <Files *.rbx>
+        SetHandler ruby-object
+        RubyHandler Apache::RubyRun.instance
+      </Files>
+    </IfModule>
+</tmpl_if>
+
 <tmpl_if name='php' op='==' value='no'>
         <Files ~ '.php[s3-6]{0,1}$'>
             Order allow,deny

--
Gitblit v1.9.1