I have always used 
http://www.dereuromark.de/2012/02/25/dynamic-database-switching/ (since 
1.3).
It switches based on domain (or path in cli).


Am Dienstag, 16. Juli 2013 13:37:24 UTC+2 schrieb advantage+:
>
> Is there a simply way to switch database based on it being local or on 
> actual domain server.
>
>  
>
> Example:
>
>  
>
> *<?php*
>
> class DATABASE_CONFIG {
>
>  
>
>                 public $local = array(
>
>                                 'datasource' => 'Database/Mysql',
>
>                                 'persistent' => false,
>
>                                 'host' => 'localhost',
>
>                                 'login' => 'local',
>
>                                 'password' => '******',
>
>                                 'database' => 'local_db',
>
>                                 'encoding' => 'utf8'
>
>                 );
>
>                 
>
>                 
>
>                 public $remote = array(
>
>                                 'datasource' => 'Database/Mysql',
>
>                                 'persistent' => false,
>
>                                 'host' => 'localhost',
>
>                                 'login' => 'remote',
>
>                                 'password' => '******',
>
>                                 'database' => 'remote_db',
>
>                                 'encoding' => 'utf8'
>
>                 );
>
> }
>
>  
>
> Rather than having to switch between to 2 configurations when making 
> changes local for testing then switch and upload to remote, then switch 
> back to local to continue making edits. 
>
> So if local will use $local config, or on actual server use $remote config.
>
>  
>
> Thanks guys.
>
> Dave
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to