View Full Version : Ability to Select Database Name / Username
SleeperZ
30th October 2005, 09:29
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. :)
domino
9th November 2005, 03:14
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
SleeperZ
9th November 2005, 09:29
Hi Domino,
Yeah planning on doing a few more before long. :) Watch this space.
hairydog2
12th November 2005, 11:01
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?
hairydog2
14th November 2005, 21:11
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.
elangel_nocturno
15th November 2005, 22:12
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:
// 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 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:
// 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
hairydog2
16th November 2005, 20:28
Thank you. That worked perfectly.
SleeperZ
26th January 2006, 02:23
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
hairydog2
26th January 2006, 23:32
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?
falko
27th January 2006, 07:30
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.
hairydog2
27th January 2006, 09:39
Fair enough. It's a great bit of software, and I'd not want to see that undermined.
deezone
9th March 2006, 23:51
Hi I've tried this patch and it has messed up my ISPConfig database creation. Under website > options... the list of database name no longer appear...it's BLANK. Does anybody know what had happened here? I'm unable to delete any database entry or change the database password because of this.
falko
10th March 2006, 10:05
Can you try to remove the patch?
I haven't tried it, so I don't know what happens there.
meijerbrantm
14th February 2007, 20:41
this post is quite old so i just wanted to ask does this work with the most recent version of ISPConfig?
Jorem
15th February 2007, 13:12
I also like to know if this is still working on the latest build.
I like this patch a lot, because I like to give my databases the names of the projects.
hans2512
25th February 2007, 15:52
Maybe an easier solution is to add a descriptionfield to de database name.
Jorem
25th February 2007, 17:54
How can I do that in ISPConfig?
Pasco
19th April 2007, 11:45
I like this patch a lot, too.
But I got one big unsolved problem. Everytime I do an update of ISPConfig the patch gets overwritten. OK, I can patch my new Version of ISPC again, but the big problem is, that I can't see the customized databases in ISPC webinterface's anymore. It looks like there is no database/s of the web, eventhough there is/are. The databases still exisists of course (accessing them with phpmyadmin is no prob) but I can't change their names, PWDs or erase them anymore via ISPC's webinterface, nor can all other users...
Does anyone know a work around for that? Perhaps saving an ISPConfig Database before updating which I could reload after updating ISPConfig? Is it possible? Which database stores the (customized) databasenames /-users? Can I do that without troubling the update?
Thx so much
pasco
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.