Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #31  
Old 8th June 2009, 15:30
Slowhand Slowhand is offline
Member
 
Join Date: Sep 2007
Posts: 96
Thanks: 6
Thanked 0 Times in 0 Posts
 
Default

Quote:
Originally Posted by Croydon View Post
It would work I think but it would create a symlink to /var/www/phpmyadmin (you didn't change that).

And I don't think that doing this with a forum is a good idea since forums often need a fix url (http://www.example.com/forum/) and don't work on multiple hosts. But you could give it a try.
Of course you would have to install the forum in /var/www/forum and change the symlink in the plugin.
Croydon,

Sorry... like this then
Code:
<?php

/*
Copyright (c) 2007 - 2009, Till Brehm, projektfarm Gmbh
All rights reserved.
Modification (c) 2009, Marius Cramer, pixcept KG 

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of ISPConfig nor the names of its contributors
      may be used to endorse or promote products derived from this software without
      specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

class forum_symlink_plugin {
    
    var $plugin_name = 'forum_symlink_plugin';
    var $class_name = 'forum_symlink_plugin';
    
    var $action;
    
    //* This function is called during ispconfig installation to determine
    //  if a symlink shall be created for this plugin.
    function onInstall() {
        global $conf;
        
        if($conf['services']['web'] == true) {
            return true;
        } else {
            return false;
        }
        
    }
    
        
    /*
         This function is called when the plugin is loaded
    */
    
    function onLoad() {
        global $app;
        
        /*
        Register for the events
        */
        
        $app->plugins->registerEvent('web_domain_insert',$this->plugin_name,'insert');
        $app->plugins->registerEvent('web_domain_update',$this->plugin_name,'update');
    }
    
    function insert($event_name,$data) {
        global $app, $conf;
        
        $this->action = 'insert';
        // just run the update function
        $this->update($event_name,$data);
    }
    
    function update($event_name,$data) {
        global $app, $conf;
        
        if($this->action != 'insert') $this->action = 'update';
        
        if($data["new"]["type"] != "vhost" && $data["new"]["parent_domain_id"] > 0) {
            
            $old_parent_domain_id = intval($data["old"]["parent_domain_id"]);
            $new_parent_domain_id = intval($data["new"]["parent_domain_id"]);
            
            // If the parent_domain_id has been chenged, we will have to update the old site as well.
            if($this->action == 'update' && $data["new"]["parent_domain_id"] != $data["old"]["parent_domain_id"]) {
                $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$old_parent_domain_id." AND active = 'y'");
                $data["new"] = $tmp;
                $data["old"] = $tmp;
                $this->action = 'update';
                $this->update($event_name,$data);
            }
            
            // This is not a vhost, so we need to update the parent record instead.
            $tmp = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$new_parent_domain_id." AND active = 'y'");
            $data["new"] = $tmp;
            $data["old"] = $tmp;
            $this->action = 'update';
        }
        
        if($data["new"]["document_root"] == '') {
            $app->log("document_root not set",LOGLEVEL_WARN);
            return 0;
        }
        
        $symlink = true;
        if($data["new"]["php"] == "suphp") $symlink = false;
        elseif($data["new"]["php"] == "cgi" && $data["new"]["suexec"] == "y") $symlink = false;
        elseif($data["new"]["php"] == "fast-cgi" && $data["new"]["suexec"] == "y") $symlink = false;
        
        
        if(!is_dir($data["new"]["document_root"]."/web")) exec("mkdir -p ".$data["new"]["document_root"]."/web");
        if($symlink == false) {
            if(is_link($data["new"]["document_root"]."/web/forum")) exec("rm -f ".$data["new"]["document_root"]."/web/forum");
        } else {
            if(!is_link($data["new"]["document_root"]."/web/forum")) exec("ln -s /var/www/forum ".$data["new"]["document_root"]."/web/forum");
            else exec("ln -sf /var/www/forum ".$data["new"]["document_root"]."/web/forum");
        }
    }
    

} // end class

?>
I don't understand your point about the address...

What would the resulting address look like? not http://www.example.com/forum/?

S
Reply With Quote
Sponsored Links
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newb: ISPConfig not showing @ :8080 Slowhand Installation/Configuration 11 2nd June 2009 13:52
Newb needs help savagemania Installation/Configuration 1 9th August 2007 09:58
Newb Guide to the World of Servers latcarf Suggest HOWTO 2 6th February 2007 15:12
extreamly newb question.... gatsu Installation/Configuration 20 13th December 2006 10:42
Best distro choise for newb & some advice pls Planet_Jeroen Technical 4 10th March 2006 09:41


All times are GMT +2. The time now is 02:55.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.