GithubHelp home page GithubHelp logo

paulvl / backup Goto Github PK

View Code? Open in Web Editor NEW
79.0 2.0 29.0 45 KB

MySQL Database backup package for Laravel

License: MIT License

PHP 100.00%
database-backup laravel dump mysqldump backup restore restoration mysql-restore database backup-files

backup's Introduction

Backup

Backup is a Laravel package that allow the creation and restoration of database backups in an easy way.

New version 4.* works with laravel 8

Latest Stable Version Latest Unstable Version License Total Downloads

Quick Installation

Begin by installing this package through Composer.

You can run:

composer require paulvl/backup 4.*

Or edit your project's composer.json file to require paulvl/backup.

    "require": {
        "paulvl/backup": "4.*"
    }

Next, update Composer from the Terminal:

composer update

Once the package's installation completes, the final step is to add the service provider. Open config/app.php, and add a new item to the providers array:

Backup\BackupServiceProvider::class,

Finally publish package's configuration file:

php artisan vendor:publish --provider="Backup\BackupServiceProvider" --tag="config"

Then the file config/backup.php will be created.

That's it! You're ready to go. Run the artisan command from the Terminal to see the new backup commands.

php artisan

Mysql commands

mysql-dump - Creating a backup

To make a backup of you current aplication's database you have to run:

php artisan backup:mysql-dump

This will create an .sql file on your configured local-storage.path like /this/is/my/path/dbname_20150101201505.sql, this file is named using current datetime. If you want a custom name run:

php artisan backup:mysql-dump custom_name

This will create an .sql file on your configured local-storage.path like /this/is/my/path/custom_name.sql

--connection=mysql - Specify database connection name

Specify the database connection name, it uses the primary connection name by default.

php artisan backup:mysql-dump --connection=custom-connection

--compress - Enable file compression

From versión 4.* compress option use gzenconde. To have your previous compressed files working with this versión see fix-file command

Enable file compression regardless if is disabled in the configuration file. This option will always overwrite --no-compress option

php artisan backup:mysql-dump --compress

--no-compress - Disable file compression

Disable file compression regardless if is enabled in the configuration file. This option will be always overwrited by --compress option

php artisan backup:mysql-dump --no-compress

mysql-restore - Restoring database from a file

From versión 4.* compress option use gzenconde. To have your previous compressed files working with this versión see fix-file command

To restore a backup to your current aplication's database you have to run:

php artisan mysql:restore filename

This will display a list of your current backup files stored on your configured local-storage.disk.

--filename | -f - Especifiy a backup file name

Especifiy a backup file name

php artisan backup:mysql-restore --filename=backup_filename

--all-backup-files | -A - Display all backup files

Display all available backup files on disk. By default displays files for current connection's database.

php artisan backup:mysql-restore --all-backup-files

--from-cloud | -C - Use cloud disk

Display a list of backup files from cloud disk.

php artisan backup:mysql-restore --from-cloud

--restore-latest-backup | -L - Restore latest backup file

Use latest backup file to restore database.

php artisan backup:mysql-restore --restore-latest-backup

--yes | -y - Confirms restoration action

Confirms database restoration without asking.

php artisan backup:mysql-restore --yes

fix-file - Fix backup file encoding mode

Prior to version 4.* all backup files generated with compression option where compressed using gzenconde, by this the generated file was unable to use with any other uncompression software. Thats why we now use gzencode instead which is friendly to external software.

To fix the encoding mode of a compressed backup file you have to run:

php artisan mysql:fix-file

This will display a list of your current compressed backup files stored on your configured local-storage.disk.

--filename | -f - Especifiy a backup file name

Especifiy a backup file name

php artisan backup:fix-file --filename=backup_filename

--from-cloud | -C - Use cloud disk

Display a list of backup files from cloud disk.

php artisan backup:fix-file --from-cloud

--yes | -y - Confirms fixing action

Confirms file fixing without asking.

php artisan backup:fix-file --yes

Programing backups

If you need to perform a backup for example, every day at midnight, at this like to yor schedule function on app/Console/Commands/Kernel.php:

protected function schedule(Schedule $schedule)
{
...
    $schedule->command('backup:mysql-dump')->dailyAt('00:00');
...
}

Contribute and share ;-)

If you like this little piece of code share it with you friends and feel free to contribute with any improvements.

backup's People

Contributors

carusogabriel avatar dylan-dpc avatar geekcom avatar ian-nisbet avatar joshuadegier avatar paulvl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

backup's Issues

db can't be dumped

dear all, I've got problems in dumping my db: php7.3, Laravel 6.x, here's the error message:

sh: mysqldump: command not found
Database 'Tirocinio' cannot be dumped

after running the command
php artisan backup:mysql-dump

I've followed the previous steps as tutorial says

may it be a matter of Laravel version? mine is 6.X, while tutorial says that it work in Laravel 8...
New version 4.* works with laravel 8
which version should I downgrade at?

Large size database dump storage to S3

There is an issue when we are uploading large size (130M) database dump to S3. It is giving the following error:

mmap() failed: [12] Cannot allocate memory
PHP Fatal error: Out of memory (allocated 157945856) (tried to allocate 847000680 bytes) in path/to/project/vendor/league/flysystem/src/Util/MimeType.php on line 28

ubuntu error?

hi,Running laravel5.6 on ubuntu gives an error when backing up. How can I handle it? thank!
{ "message": "exec() has been disabled for security reasons", "exception": "ErrorException", "file": "/www/wwwroot/test.a-nan.cn/vendor/paulvl/backup/src/Console/Commands/MysqlDump.php", "line": 207, "trace": [ { "function": "handleError", "class": "Illuminate\\Foundation\\Bootstrap\\HandleExceptions", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/paulvl/backup/src/Console/Commands/MysqlDump.php", "line": 207, "function": "exec" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/paulvl/backup/src/Console/Commands/MysqlDump.php", "line": 127, "function": "dumpDatabase", "class": "Backup\\Console\\Commands\\MysqlDump", "type": "->" }, { "function": "handle", "class": "Backup\\Console\\Commands\\MysqlDump", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php", "line": 29, "function": "call_user_func_array" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php", "line": 87, "function": "Illuminate\\Container\\{closure}", "class": "Illuminate\\Container\\BoundMethod", "type": "::" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php", "line": 31, "function": "callBoundMethod", "class": "Illuminate\\Container\\BoundMethod", "type": "::" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Container/Container.php", "line": 564, "function": "call", "class": "Illuminate\\Container\\BoundMethod", "type": "::" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Console/Command.php", "line": 184, "function": "call", "class": "Illuminate\\Container\\Container", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/symfony/console/Command/Command.php", "line": 251, "function": "execute", "class": "Illuminate\\Console\\Command", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Console/Command.php", "line": 171, "function": "run", "class": "Symfony\\Component\\Console\\Command\\Command", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/symfony/console/Application.php", "line": 886, "function": "run", "class": "Illuminate\\Console\\Command", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/symfony/console/Application.php", "line": 262, "function": "doRunCommand", "class": "Symfony\\Component\\Console\\Application", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/symfony/console/Application.php", "line": 145, "function": "doRun", "class": "Symfony\\Component\\Console\\Application", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Console/Application.php", "line": 89, "function": "run", "class": "Symfony\\Component\\Console\\Application", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Console/Application.php", "line": 188, "function": "run", "class": "Illuminate\\Console\\Application", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php", "line": 250, "function": "call", "class": "Illuminate\\Console\\Application", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php", "line": 221, "function": "call", "class": "Illuminate\\Foundation\\Console\\Kernel", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/app/Http/Controllers/Backend/DatabaseController.php", "line": 48, "function": "__callStatic", "class": "Illuminate\\Support\\Facades\\Facade", "type": "::" }, { "function": "backup", "class": "App\\Http\\Controllers\\Backend\\DatabaseController", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Controller.php", "line": 54, "function": "call_user_func_array" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php", "line": 45, "function": "callAction", "class": "Illuminate\\Routing\\Controller", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 212, "function": "dispatch", "class": "Illuminate\\Routing\\ControllerDispatcher", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Route.php", "line": 169, "function": "runController", "class": "Illuminate\\Routing\\Route", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 665, "function": "run", "class": "Illuminate\\Routing\\Route", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 30, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/app/Http/Middleware/Breadcrumb.php", "line": 21, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "App\\Http\\Middleware\\Breadcrumb", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/app/Http/Middleware/Authentication.php", "line": 26, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "App\\Http\\Middleware\\Authentication", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/app/Http/Middleware/AdminLogin.php", "line": 25, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "App\\Http\\Middleware\\AdminLogin", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/voerro/laravel-visitor-tracker/src/Middleware/RecordVisits.php", "line": 21, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Voerro\\Laravel\\VisitorTracker\\Middleware\\RecordVisits", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php", "line": 41, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\Routing\\Middleware\\SubstituteBindings", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php", "line": 67, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php", "line": 49, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php", "line": 63, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\Session\\Middleware\\StartSession", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php", "line": 37, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php", "line": 59, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\Cookie\\Middleware\\EncryptCookies", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 104, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 667, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 642, "function": "runRouteWithinStack", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 608, "function": "runRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Router.php", "line": 597, "function": "dispatchToRoute", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 176, "function": "dispatch", "class": "Illuminate\\Routing\\Router", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 30, "function": "Illuminate\\Foundation\\Http\\{closure}", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/barryvdh/laravel-cors/src/HandleCors.php", "line": 36, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Barryvdh\\Cors\\HandleCors", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/fideloper/proxy/src/TrustProxies.php", "line": 57, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Fideloper\\Proxy\\TrustProxies", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 31, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php", "line": 31, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php", "line": 27, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php", "line": 62, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 151, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php", "line": 53, "function": "Illuminate\\Pipeline\\{closure}", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php", "line": 104, "function": "Illuminate\\Routing\\{closure}", "class": "Illuminate\\Routing\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 151, "function": "then", "class": "Illuminate\\Pipeline\\Pipeline", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php", "line": 116, "function": "sendRequestThroughRouter", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" }, { "file": "/www/wwwroot/test.a-nan.cn/public/index.php", "line": 55, "function": "handle", "class": "Illuminate\\Foundation\\Http\\Kernel", "type": "->" } ] }

restore DB doesn't work

I tried every thing but still not working

I tried through php artisan command and also I tried to use artisan through controller same result

my problem is that when I call php artisan backup:mysql-restore db_20180107033316.sql --yes

it shows
There are no backup files to restore!

but guess what when I use php artisan backup:mysql-restore --all-backup-files
all backup files shows fine . what should I do ?

how can I do restore ?! and by the way you didn't mention what should by configured in config/backup.php file

Why I can't restore my database when is called programmatically?

hola paul, escribire en español ya que mi ingles es muy pobre,
al momento de restaurar el ultimo backup que tengo aplico la siguiente linea codigo
Artisan::call("backup:mysql-restore",["--restore-latest-backup"=>true]); el cual no me retorna nada y hace que mi pantalla quede toda blanca...
Quisiera saber si es problema del paquete o yo lo estoy utilizando de mala forma, estoy toda una tarde tratando de solucionarlo pero nada. Te agradeceria si respondieras


English translation

Hi paul, i'll write in spanish because my english is poor,
at the moment to restore my latest backup I use the following code:
Artisan::call("backup:mysql-restore",["--restore-latest-backup"=>true]); it doesn't return nothing and my screen stays blank...
I want to know if there is package's issue or if I'm doing something wrong, I spent a lot of time trying to figure it out. I'll be glad if you can answer me

local-storage.path not working

My settings in config:
'local-storage' => [

        /*
        |--------------------------------------------------------------------------
        | Local Storage Disk Name
        |--------------------------------------------------------------------------
        */

        'disk' => 'local',

        /*
        |--------------------------------------------------------------------------
        | Local Storage Path
        |--------------------------------------------------------------------------
        */

        'path' => 'backups',

    ],

but everytime I run backup:mysql-dump, it always put generated .sql file under storage/app/ directly, not in 'backups' sub-folder

laravel8 Unable to install

Using version ^3.1 for paulvl/backup
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: remove laravel/framework v8.8.0
- Conclusion: don't install laravel/framework v8.8.0
- paulvl/backup 3.1.0 requires illuminate/console 5.0.* || 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.* -> satisfiable by illumi
nate/console[5.0.x-dev, 5.1.x-dev, 5.2.x-dev, 5.3.x-dev, 5.4.x-dev, 5.5.x-dev, 5.6.x-dev, 5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, 6.x-dev, v5.0.0, v5.0.22, v
5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.2.0,
v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4
.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9, v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.37, v5.5.39, v5.5.40,
v5.5.41, v5.5.43, v5.5.44, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6
.23, v5.6.24, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5,
v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4,
v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28,
v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v
6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.18.1, v6.18.10, v6.18.11, v6.18.12, v6.18.13, v6.18.14, v6.18.
15, v6.18.16, v6.18.17, v6.18.18, v6.18.19, v6.18.2, v6.18.20, v6.18.21, v6.18.22, v6.18.23, v6.18.24, v6.18.25, v6.18.26, v6.18.27, v6.18.28, v6.18.29, v6.18.3, v
6.18.30, v6.18.31, v6.18.32, v6.18.33, v6.18.34, v6.18.35, v6.18.36, v6.18.37, v6.18.38, v6.18.39, v6.18.4, v6.18.40, v6.18.41, v6.18.42, v6.18.5, v6.18.6, v6.18.7
, v6.18.8, v6.18.9, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].

local-storage.path not working

path not working, if local disk selected, it is saving file to path defined in "config/filesystem", not saving in custom path

compression is applied on sql string instead of file

When I create a db dump using the --compress flag or enabling the compress to true from the config file the output file cannot be uncompressed successfully. I tried different apps to do it, here are the results I got

Archive Utility App

  • This creates another compressed file with .cpgz as the extension. Ex: source file is db.sql.gz the extracted file from Archive Utility App will be db.sql.gz.cpgz. If I try to unzip this one it will create another file called db.sql 2.gz which will then become db.sql 2.gz.cpgz if i uncompress that again therefore becoming an infinite loop if I keep doing it

RAR Extractor Lite

  • The app will crash

Keka

  • Extraction failed.. will create a folder with the same name of the gz filed but is empty folder

Tools from CLI
dtrx

  • dtrx: ERROR: could not handle ets_20180828105530.sql.gz
    dtrx: ERROR: treating as gzip-encoded compressed file failed: decoding error: 'zcat' returned status code 1
    dtrx: ERROR: Error output from this process:
    zcat: unknown compression format

tar
-tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

Im running on MAC OS high sierra

Calling from code fails

\Artisan::call('backup:mysql-dump'); results in this error

exec(): Unable to fork [mysqldump -C -h "127.0.0.1" -P "3306" -u"root" --single-transaction --skip-lock-tables --quick "back_myadmin"]

While the plugin works on command prompt
php artisan backup:mysql-dump

Laravel 5.2, Xampp, Windows 10 local.

Any ideas? Thank you!

filename option

In handle function

$filename = $database.'_'.empty ....

needs to be changed to

$filename = empty ...

so the filename option takes effect.

This is in the 5.1 branch

Restoring large database memory exhausted

Hello,
While trying to restore to a database that is fairly over 300mb, I encountered this problem :

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 410236016 bytes) in /path/to/project/vendor/league/flysystem/src/Adapter/Local.php on line 223

escapeshellcmd

Using the 5.1 branch the dumpCommand could use escapeshellcmd or spacial characters can break things (e.g. backpack in the password) e.g.

$dumpCommand = "mysqldump -e -f -h $host -u ".escapeshellcmd($username)." -p".escapeshellcmd($password)." ".escapeshellcmd($database)." > $backupPath$filename.sql";

Call backup command from Route

Hi Paul, first thanks for this great package!

I've tested using terminal and everything works well.
But how can I call the backup:mysql-dump command in route / controller?
It's always say "database cannot dumped".

Thanks

Laravel v6

Any chance that this can be used with Laravel ^6.0? Currently composer will not install the package because it requires illuminate/console 5.* and it appears that the current version of Laravel (6.6.2) replaces illuminate/console: v6.6.2

Erorr whe try restore DB

Hi!
Thank you for extension.

Look. I try create restoring database from site. I created view. and when I press button 'restore' I need that my DB was restored.

via console works fine =)

In controller I try such command:
\Artisan::call('backup:mysql-restore --yes --filename='.$file);

And I see error:

Command "backup:mysql-restore --yes --filename=advisordev_db_20171226145541.sql" is not defined. Did you mean one of these? backup:mysql-dump backup:mysql-restore

What is the problem? Can you help me?

Custom name file is truncated

Hi,

When custom name specified contains dot, the name is truncated at position of dot.

Example :
Cmd : php artisan backup:mysql-dump sylva.sygexp_2023-07-28_12-00-17
Result : sylva.sygexp.sql.gz

It's not working on Mac

Good initiative. I have properly installed the package via composer, published and edited the config file. But I ran php artisan backup:mysql-dump xxxxxx_dash_xxxxxx
I got the following output

mysqldump: [Warning] Using a password on the command line interface can be insecure.
Database 'pos_dash' dumped successfully
But the output file exists nowhere on computer.

System Info

  • OS: MacOs Sierra v 10.12.4
  • PHP: 7.1.1 (cli) (built: Jan 19 2017 13:56:18)
  • Laravel: 5.3.31
    Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.