Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 30th October 2005, 09:29
SleeperZ SleeperZ is offline
Junior Member
 
Join Date: Oct 2005
Posts: 23
Thanks: 0
Thanked 2 Times in 1 Post
Default Ability to Select Database Name / Username

Hi Guys,

I have started working on making ISPConfig work for my current setup and one of the first things i've personally found not entirely userfriendly is the in-ability to select your own database names.

For this reason I am posting this back in the hope that if someone else wants to add this ability they can. (Maybe it'll show up in a future release somehow)

First make a backup of the database, and the files.

You then need to edit the Database (Datenbank) form.

Login as an administrator and click the Management Link (Top left corner)
Under Form Designer click Edit Form.
Edit 'isp - ISP Datenbank'

You should see the following:

datenbankname descField [Edit] [Delete] [^]
datenbankuser descField [Edit] [Delete] [^]

I could not work out a quick way to edit the field type, so I deleted the two, and created 2 new Short Textfield.

Important: Keep the Fieldname the same as what it was before (datenbankname / datenbankuser), the Title is what will show on the form and to my knowledge can be set to anything I used Database Name, and Database User respectively.

Now that you've done this, apply the patch that i've attached here to the file:
/home/admispconfig/ispconfig/lib/classes/ispconfig_isp_datenbank.lib.php

That should be it!

I am reasonably new to all this so go easy on me Feel free to comment on how this goes, esspecially if there is a major problem.
Attached Files
File Type: gz select_db_name.patch.gz (671 Bytes, 814 views)

Last edited by SleeperZ; 30th October 2005 at 09:32.
Reply With Quote
Sponsored Links
  #2  
Old 9th November 2005, 03:14
domino domino is offline
Senior Member
 
Join Date: Aug 2005
Posts: 364
Thanks: 0
Thanked 9 Times in 8 Posts
Default

I completely overlooked this post thinking it was only a tip. I didn't realize it was a hack for ISPConfig. Thank you! I hope to see posts like these in the future.

Regards
Reply With Quote
  #3  
Old 9th November 2005, 09:29
SleeperZ SleeperZ is offline
Junior Member
 
Join Date: Oct 2005
Posts: 23
Thanks: 0
Thanked 2 Times in 1 Post
Default

Hi Domino,

Yeah planning on doing a few more before long. Watch this space.
Reply With Quote
  #4  
Old 12th November 2005, 11:01
hairydog2 hairydog2 is offline
Senior Member
 
Join Date: Oct 2005
Posts: 196
Thanks: 9
Thanked 3 Times in 2 Posts
Default

Quote:
Originally Posted by SleeperZ
Now that you've done this, apply the patch that i've attached here to the file:
/home/admispconfig/ispconfig/lib/classes/ispconfig_isp_datenbank.lib.php
I'm happy that I understood all the steps up to here, but I'm not clear how to apply the patch to a php file. The patch looks like an sql query. Can you explain in "Dummies Guide" terms?
Reply With Quote
  #5  
Old 14th November 2005, 21:11
hairydog2 hairydog2 is offline
Senior Member
 
Join Date: Oct 2005
Posts: 196
Thanks: 9
Thanked 3 Times in 2 Posts
Default

Can anyone help here? When I run "patch -i select_db_name.patch"

all I get is Hunk #1 FAILED at 119.
1 out of 1 hunk FAILED -- saving rejects to file ispconfig_isp_datenbank.lib.php.rej

And the patch makes no changes to the php file at all.
Reply With Quote
  #6  
Old 15th November 2005, 22:12
elangel_nocturno elangel_nocturno is offline
Junior Member
 
Join Date: Nov 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by hairydog2
Can anyone help here? When I run "patch -i select_db_name.patch"

all I get is Hunk #1 FAILED at 119.
1 out of 1 hunk FAILED -- saving rejects to file ispconfig_isp_datenbank.lib.php.rej

And the patch makes no changes to the php file at all.
Hi, i do the changhes manually.

Replace this:

PHP Code:
     // sind fr dieses Web berhaupt Datenbanken zugelassen?
     
if(!$web["web_mysql"]){
       
$status "DELETE";
       
$errorMessage $go_api->lng("error_db_nicht_erlaubt");
     }

    
// Datenbankname und -user festlegen
    
$db_ids $go_api->db->queryAllRecords("SELECT datenbankname FROM isp_isp_datenbank WHERE web_id = '$web_doc_id'");
          if(empty(
$db_ids)){
            
$new_db_id 1;
          } else {
            
// kleinste freie ID finden
            
foreach($db_ids as $db_id){
              
$db_nr[] = str_replace('web'.$web["doc_id"].'_db'''$db_id["datenbankname"]);
            }
            
sort($db_nrSORT_NUMERIC);
            
reset($db_nr);
            
$i 0;
            while(!isset(
$new_db_id)){
              if(
$db_nr[$i] != ($i 1)) $new_db_id $i 1;
              
$i++;
            }
          }
    
$datenbankname 'web'.$web_doc_id.'_db'.$new_db_id;
    
$datenbankuser 'web'.$web_doc_id.'_u'.$new_db_id;


    
$go_api->db->query("UPDATE isp_isp_datenbank SET datenbankname = '$datenbankname', datenbankuser = '$datenbankuser', web_id = '$web_doc_id' WHERE doc_id = '$doc_id'");

    
// Eintrag der Datenbank holen
    
$datenbank $go_api->db->queryOneRecord("select * from isp_isp_datenbank where doc_id = '$doc_id'"); 
with this:

PHP Code:
     // sind fr dieses Web berhaupt Datenbanken zugelassen?
     
if(!$web["web_mysql"]){
       
$status "DELETE";
       
$errorMessage $go_api->lng("error_db_nicht_erlaubt");
     }
/*
    // Datenbankname und -user festlegen
    $db_ids = $go_api->db->queryAllRecords("SELECT datenbankname FROM isp_isp_datenbank WHERE web_id = '$web_doc_id'");
          if(empty($db_ids)){
            $new_db_id = 1;
          } else {
            // kleinste freie ID finden
            foreach($db_ids as $db_id){
              $db_nr[] = str_replace('web'.$web["doc_id"].'_db', '', $db_id["datenbankname"]);
            }
            sort($db_nr, SORT_NUMERIC);
            reset($db_nr);
            $i = 0;
            while(!isset($new_db_id)){
              if($db_nr[$i] != ($i + 1)) $new_db_id = $i + 1;
              $i++;
            }
          }
*/
    
$datenbankname 'web'.$web_doc_id.'_db'.$new_db_id;
    
$datenbankuser 'web'.$web_doc_id.'_u'.$new_db_id;

    
$go_api->db->query("UPDATE isp_isp_datenbank SET web_id = '$web_doc_id' WHERE doc_id = '$doc_id'");
   
// $go_api->db->query("UPDATE isp_isp_datenbank SET datenbankname = '$datenbankname', datenbankuser = '$datenbankuser', web_id = '$web_doc_id' WHERE doc_id = '$doc_id'");

    // Eintrag der Datenbank holen
    
$datenbank $go_api->db->queryOneRecord("select * from isp_isp_datenbank where doc_id = '$doc_id'"); 
in the ispconfig_isp_datenbank.lib.php file.

Thank to SleeperZ 4 the great job!.

Bye.

P.D.: sorry for my english
Reply With Quote
  #7  
Old 16th November 2005, 20:28
hairydog2 hairydog2 is offline
Senior Member
 
Join Date: Oct 2005
Posts: 196
Thanks: 9
Thanked 3 Times in 2 Posts
Default

Thank you. That worked perfectly.
Reply With Quote
  #8  
Old 26th January 2006, 02:23
SleeperZ SleeperZ is offline
Junior Member
 
Join Date: Oct 2005
Posts: 23
Thanks: 0
Thanked 2 Times in 1 Post
Default

Hi,

I recently upgraded to the latest version and found out this patch didnt work, so i've uploaded one that does now (And its tested!)

Sorry about the confusion - see attached.

The command I use is: patch -p0 < select_db_name.patch
Attached Files
File Type: gz select_db_name.patch.gz (687 Bytes, 638 views)
Reply With Quote
  #9  
Old 26th January 2006, 23:32
hairydog2 hairydog2 is offline
Senior Member
 
Join Date: Oct 2005
Posts: 196
Thanks: 9
Thanked 3 Times in 2 Posts
Default

It would be great if each update of ISPConfig didn't overwrite this change.

I don't understand why it isn't in the standard ISPConfig build.

Is there a drawback that I have not noticed?
Reply With Quote
  #10  
Old 27th January 2006, 07:30
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
Default

Quote:
Originally Posted by hairydog2
I don't understand why it isn't in the standard ISPConfig build.
Because we're very, very busy (really busy) and don't have the time to test every patch... You must know that it takes several hours each day only to help the people in this forum, and besides that we still have to earn a living...

If we integrate the patch into ISPConfig, we have to test it very thoroughly because otherwise we'd get a lot of posts here from people that are not so lucky... This is very time-consuming. Although this is open-source and free software, we want to maintain a certain level of quality.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
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
Client Website MySQL Database Names Lister Installation/Configuration 4 12th January 2008 17:21
Mail System doesnt work! crichton Installation/Configuration 3 17th September 2007 23:49
Virtual Users And Domains With Postfix, Courier And MySQL (+ SMTP-AUTH, Quota, SpamAs pontifex HOWTO-Related Questions 2 26th October 2005 17:54
username generation Lord_Garfield General 1 25th October 2005 10:00
Mail not accepting username and password! nformosa General 9 14th September 2005 09:58


All times are GMT +2. The time now is 14:20.


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