Skip to content

Commit

Permalink
Merge pull request #4 from ARCANEDEV/develop
Browse files Browse the repository at this point in the history
Starting Laravel v8 support
  • Loading branch information
arcanedev-maroc authored Sep 10, 2020
2 parents e1da781 + 2370305 commit af2cb4c
Show file tree
Hide file tree
Showing 120 changed files with 438 additions and 314 deletions.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- LaravelBackup Version: #.#.#
- Laravel Version: #.#.#
- PHP Version: #.#.#

### Description:

### Steps To Reproduce:
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4]
php: [7.3, 7.4]
dependency-version: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}
Expand All @@ -27,7 +27,7 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-7-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
key: dependencies-laravel-8-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 6
runs: 4
php_code_sniffer:
enabled: true
config:
Expand Down
30 changes: 20 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
"type": "library",
"license": "MIT",
"require": {
"php": "^7.2.5",
"ext-json": "*",
"ext-zip": "*",
"arcanedev/support": "^7.0",
"league/flysystem": "^1.0.49"
"php": "^7.3",
"ext-json": "*",
"ext-zip": "*",
"arcanedev/support": "^8.0",
"league/flysystem": "^1.0.49"
},
"require-dev": {
"laravel/slack-notification-channel": "^2.0",
"league/flysystem-aws-s3-v3": "^1.0.1",
"mockery/mockery": "^1.3.1",
"orchestra/testbench": "^5.0",
"phpunit/phpunit": "^8.5|^9.0"
"laravel/slack-notification-channel": "^2.2",
"league/flysystem-aws-s3-v3": "^1.0.1",
"mockery/mockery": "^1.3.1",
"orchestra/testbench": "^6.0",
"phpunit/phpunit": "^9.3"
},
"autoload": {
"psr-4": {
Expand All @@ -37,14 +37,24 @@
"Arcanedev\\LaravelBackup\\Tests\\": "tests/"
}
},
"scripts": {
"test": "phpunit",
"coverage": "phpunit --coverage-html build/coverage/html"
},
"extra": {
"branch-alias": {
"dev-develop": "2.x-dev"
},
"laravel": {
"providers": [
"Arcanedev\\LaravelBackup\\BackupServiceProvider",
"Arcanedev\\LaravelBackup\\Providers\\DeferredServiceProvider"
]
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
109 changes: 90 additions & 19 deletions config/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
| -----------------------------------------------------------------
*/

/*
* The name of this application. You can use this name to monitor the backups.
*/
'name' => env('APP_NAME', 'laravel-backup'),

/* -----------------------------------------------------------------
Expand All @@ -16,8 +19,10 @@

'destination' => [

// The filename prefix used for the backup zip file.
'filename-prefix' => '',

// The disk names on which the backups will be stored.
'disks' => [
'local',
],
Expand All @@ -32,24 +37,82 @@
'backup' => [

'source' => [

'files' => [

// The list of directories and files that will be included in the backup.
'include' => [
base_path(),
],

/*
* These directories and files will be excluded from the backup.
*
* Directories used by the backup process will automatically be excluded.
*/
'exclude' => [
base_path('vendor'),
base_path('node_modules'),
],

// Determines if symlinks should be followed.
'follow-links' => false,

// Determines if it should avoid unreadable folders.
'ignore-unreadable-directories' => false,

],

/*
* The names of the connections to the databases that should be backed up
* MySQL, PostgreSQL, SQLite and Mongo databases are supported.
*
* The content of the database dump may be customized for each connection
* by adding a 'dump' key to the connection settings in config/database.php.
* E.g.
* 'mysql' => [
* ...
* 'dump' => [
* 'excludeTables' => [
* 'table_to_exclude_from_backup',
* 'another_table_to_exclude'
* ]
* ],
* ],
*
* If you are using only InnoDB tables on a MySQL server, you can
* also supply the useSingleTransaction option to avoid table locking.
*
* E.g.
* 'mysql' => [
* ...
* 'dump' => [
* 'useSingleTransaction' => true,
* ],
* ],
*
* For a complete list of available customization options, see https://github.com/spatie/db-dumper
*/
'databases' => [
'mysql',
],

],

/*
* The database dump can be compressed to decrease disk space usage.
*
* Out of the box LaravelBackup supplies:
* Arcanedev\LaravelBackup\Database\Compressors\GzipCompressor::class
*
* You can also use a custom compressor by implementing the contract:
* Arcanedev\LaravelBackup\Database\Contracts\Compressor
*
* If you do not want any compressor at all, set it to `null`.
*/
'db-dump-compressor' => null,

// The directory where the temporary files will be stored.
'temporary-directory' => storage_path('app/_backup-temp'),

'tasks' => [
Expand All @@ -68,41 +131,36 @@
| -----------------------------------------------------------------
*/

/*
* The strategy that will be used to cleanup old backups. The default strategy will keep all backups
* for a certain amount of days. After that period only a daily backup will be kept.
* After that period only weekly backups will be kept and so on.
*
* No matter how you configure it the default strategy will never delete the newest backup.
*/
'cleanup' => [

'strategy' => [
'default' => Arcanedev\LaravelBackup\Actions\Cleanup\Strategies\DefaultStrategy::class,

'keep-backups' => [
/**
* The number of days for which backups must be kept.
*/
// The number of days for which backups must be kept.
'all' => 7,

/**
* The number of days for which daily backups must be kept.
*/
// The number of days for which daily backups must be kept.
'daily' => 16,

/**
* The number of weeks for which one weekly backup must be kept.
*/
// The number of weeks for which one weekly backup must be kept.
'weekly' => 8,

/**
* The number of months for which one monthly backup must be kept.
*/
// The number of months for which one monthly backup must be kept.
'monthly' => 4,

/**
* The number of years for which one yearly backup must be kept.
*/
// The number of years for which one yearly backup must be kept.
'yearly' => 2,
],

/*
* After cleaning up the backups remove the oldest backup until this amount of megabytes has been reached.
*/
// After cleaning up the backups remove the oldest backup until this amount of megabytes has been reached.
'delete-backups' => [
'oldest-when-size-reach' => 5000,
],
Expand All @@ -120,6 +178,10 @@
| -----------------------------------------------------------------
*/

/*
* Here you can specify which backups should be monitored.
* If a backup does not meet the specified requirements the UnhealthyBackupsWasFound event will be fired.
*/
'monitor' => [

'destinations' => [
Expand Down Expand Up @@ -155,6 +217,14 @@
| -----------------------------------------------------------------
*/

/*
* You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
*
* For 'slack' you need to install 'laravel/slack-notification-channel'.
*
* You can also use your own notification classes, just make sure the class is named after one of
* the `Arcanedev\LaravelBackup\Events` classes.
*/
'notifications' => [

'supported' => [
Expand All @@ -176,6 +246,7 @@

'mail' => [
'to' => '[email protected]',

'from' => [
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'Example'),
Expand All @@ -185,7 +256,7 @@
'slack' => [
'webhook_url' => '',

/* If this is set to null the default channel of the webhook will be used. */
// If this is set to null the default channel of the webhook will be used.
'channel' => null,
'username' => null,
'icon' => null,
Expand Down
26 changes: 13 additions & 13 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
>
<testsuites>
<testsuite name="Package Test Suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</include>
<report>
<clover outputFile="build/coverage/clover.xml"/>
<html outputDirectory="build/coverage/html"/>
<text outputFile="build/coverage/coverage.txt" showOnlySummary="true"/>
</report>
</coverage>
<php>
<env name="APP_NAME" value="ARCANEDEV"/>
<env name="DB_DATABASE" value="laravel_db"/>
Expand Down
1 change: 0 additions & 1 deletion src/Actions/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/**
* Class Action
*
* @package Arcanedev\LaravelBackup\Actions
* @author ARCANEDEV <[email protected]>
*/
abstract class Action extends Pipeline
Expand Down
1 change: 0 additions & 1 deletion src/Actions/Backup/BackupAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/**
* Class BackupAction
*
* @package Arcanedev\LaravelBackup\Actions\Backup
* @author ARCANEDEV <[email protected]>
*/
class BackupAction extends Action
Expand Down
1 change: 0 additions & 1 deletion src/Actions/Backup/BackupPassable.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/**
* Class BackupPassable
*
* @package Arcanedev\LaravelBackup\Actions\Backup
* @author ARCANEDEV <[email protected]>
*/
class BackupPassable extends Passable
Expand Down
1 change: 0 additions & 1 deletion src/Actions/Backup/Tasks/CheckBackupDestinations.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/**
* Class CheckBackupDestinations
*
* @package Arcanedev\LaravelBackup\Actions\Backup\Tasks
* @author ARCANEDEV <[email protected]>
*/
class CheckBackupDestinations implements TaskInterface
Expand Down
1 change: 0 additions & 1 deletion src/Actions/Backup/Tasks/CheckOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/**
* Class CheckOptions
*
* @package Arcanedev\LaravelBackup\Actions\Backup\Tasks
* @author ARCANEDEV <[email protected]>
*/
class CheckOptions implements TaskInterface
Expand Down
5 changes: 2 additions & 3 deletions src/Actions/Backup/Tasks/CreateBackupFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Arcanedev\LaravelBackup\Actions\Backup\Tasks;

use Arcanedev\LaravelBackup\Actions\TaskInterface;
use Arcanedev\LaravelBackup\Entities\Manifest;
use Arcanedev\LaravelBackup\Entities\{Backup, Manifest};
use Arcanedev\LaravelBackup\Events\BackupZipWasCreated;
use Arcanedev\LaravelBackup\Helpers\Zip;
use Closure;
Expand All @@ -14,7 +14,6 @@
/**
* Class CreateBackupFile
*
* @package Arcanedev\LaravelBackup\Actions\Backup\Tasks
* @author ARCANEDEV <[email protected]>
*/
class CreateBackupFile implements TaskInterface
Expand Down Expand Up @@ -77,6 +76,6 @@ protected static function createZipFile(Manifest $manifest, string $path): Zip
*/
protected static function getFilename(): string
{
return Carbon::now()->format('Ymd-His').'.zip';
return Carbon::now()->format(Backup::FILENAME_FORMAT);
}
}
Loading

0 comments on commit af2cb4c

Please sign in to comment.