Raised This Month: $51 Target: $400
 12% 

Change database.cfg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OnkelBazi
Member
Join Date: Aug 2006
Location: Bavaria
Old 06-30-2013 , 08:53   Change database.cfg
Reply With Quote #1

Hi there,

is it possible to write the sql connection in any other...cfg?

seems like : sourbans_sql.cfg?


and not in the database.cfg?

When yes what must be changed for this?
__________________
OnkelBazi is offline
Rytis
Veteran Member
Join Date: Feb 2012
Location: Germany
Old 06-30-2013 , 09:57   Re: Change database.cfg
Reply With Quote #2

It is possible, but you would need to reprogram some things in the SourceBans plugin

Btw: Why do you want to do that?

Last edited by Rytis; 06-30-2013 at 09:58.
Rytis is offline
OnkelBazi
Member
Join Date: Aug 2006
Location: Bavaria
Old 06-30-2013 , 10:09   Re: Change database.cfg
Reply With Quote #3

because i wanna implitat that in our Webinterface Teklab

But for a one klick install i got some problems when someone use the databse cfg for any other plugins
__________________
OnkelBazi is offline
Rytis
Veteran Member
Join Date: Feb 2012
Location: Germany
Old 06-30-2013 , 10:48   Re: Change database.cfg
Reply With Quote #4

Yup, that's right, but do you really need the one click install?
Rytis is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 06-30-2013 , 10:58   Re: Change database.cfg
Reply With Quote #5

It's possible through SQL_ConnectCustom. But to quote its documentation:

Quote:
In general it is discouraged to use this function. Connections should go through
databases.cfg for greatest flexibility on behalf of users.
So we won't support it. If your webinterface is in PHP, you can use our KeyValues class though, like this:

PHP Code:
include 'KeyValues.php';

$kv = new KeyValues('Databases');
$kv->load('databases.cfg');

$kv['sourcebans'] = array(
    
'driver' => 'mysql',
    
'host' => 'localhost',
    
'database' => 'sourcebans',
    
'user' => 'root',
    
'pass' => '',
);
$kv->save('databases.cfg'); 
But it will remove any comments from databases.cfg.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Rytis
Veteran Member
Join Date: Feb 2012
Location: Germany
Old 06-30-2013 , 11:30   Re: Change database.cfg
Reply With Quote #6

Quote:
Originally Posted by DJ Tsunami View Post
It's possible through SQL_ConnectCustom. But to quote its documentation:


So we won't support it. If your webinterface is in PHP, you can use our KeyValues class though, like this:

PHP Code:
include 'KeyValues.php';

$kv = new KeyValues('Databases');
$kv->load('databases.cfg');

$kv['sourcebans'] = array(
    
'driver' => 'mysql',
    
'host' => 'localhost',
    
'database' => 'sourcebans',
    
'user' => 'root',
    
'pass' => '',
);
$kv->save('databases.cfg'); 
But it will remove any comments from databases.cfg.
I don't think this is possible in Teklab.

Btw: Where can I find the newest updates? On Github or on Google Code (for SourceBans)
Rytis is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 06-30-2013 , 11:54   Re: Change database.cfg
Reply With Quote #7

I didn't Google Teklab, I just assumed it was his custom webinterface
Updates for 1.4 and 1.5 are on Google Code.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Reply



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


All times are GMT -4. The time now is 05:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode