Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error getting database server config #48

Closed
umar1147 opened this issue Oct 26, 2015 · 2 comments
Closed

Error getting database server config #48

umar1147 opened this issue Oct 26, 2015 · 2 comments

Comments

@umar1147
Copy link

Sorry my English is bad.

I edit your code because i have multiple servers configurations, example:

config/database.php
'default' => 'server1',

     'server1' => [
        'driver'    => 'mysql',
        'host'      => '127.0.0.1,
        'database'  => 'db_1',
        'username'  => 'user_1',
        'password'  => 'pass_1',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,
    ],

    'server2' => [
        'driver'    => 'mysql',
        'host'      => '127.0.0.1,
        'database'  => 'db_2',
        'username'  => 'user_2',
        'password'  => 'pass_2',
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,
    ],

Your code:
File: Spatie\Backup\BackupHandlers\Database\DatabaseBackupHandler
$database = $database ?: config('database.default');

In my exaple $database = server1 and $database != "mysql" then error : laravel-backup can only backup mysql databases

My changes:
File: Spatie\Backup\BackupHandlers\Database\DatabaseBackupHandler

$db_server = config('database.default');

$database = $database ?: config('database.connections.' . $db_server . '.driver');

$database = mysql

Backup successfully completed.!!

@freekmurze
Copy link
Member

Thanks for bringing this to my attention. I'll fix it soon.

@freekmurze
Copy link
Member

This is fixed in v2.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants