Skip to content

Commit

Permalink
Merge pull request #7 from ARCANEDEV/update-1
Browse files Browse the repository at this point in the history
Updating the package
  • Loading branch information
arcanedev-maroc authored Jun 3, 2021
2 parents 0ef0b6a + fcefb08 commit 5534f74
Show file tree
Hide file tree
Showing 129 changed files with 1,522 additions and 489 deletions.
3 changes: 2 additions & 1 deletion .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:7-cli-alpine
FROM php:7.3-cli-alpine

# Cleaning...
RUN rm -rf /var/cache/apk/* /tmp/*
Expand All @@ -14,6 +14,7 @@ RUN apk add --no-cache \
# Installing PHP Extensions
RUN docker-php-ext-install \
mysqli \
pcntl \
pdo_mysql \
zip

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: true
fail-fast: false
matrix:
php: [7.3, 7.4, 8.0]
dependency-version: [prefer-lowest, prefer-stable]
Expand All @@ -17,6 +17,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Install SQLite 3
run: |
Expand Down
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@
"ext-json": "*",
"ext-zip": "*",
"arcanedev/support": "^8.0",
"league/flysystem": "^1.1"
"league/flysystem": "^1.1",
"symfony/process": "^4.2|^5.0"
},
"require-dev": {
"aws/aws-sdk-php": "^3.155",
"laravel/framework": "^v8.40",
"laravel/slack-notification-channel": "^2.3",
"league/flysystem-aws-s3-v3": "^1.0.1",
"mockery/mockery": "^1.4.2",
"orchestra/testbench": "^6.4",
"orchestra/testbench-core": "^6.4",
"phpunit/phpunit": "^9.3.3"
},
"autoload": {
Expand All @@ -39,8 +41,9 @@
}
},
"scripts": {
"test": "phpunit",
"coverage": "phpunit --coverage-html build/coverage/html"
"test": "phpunit --colors=always",
"test:dox": "phpunit --testdox --colors=always",
"test:cov": "phpunit --coverage-html coverage"
},
"extra": {
"branch-alias": {
Expand Down
66 changes: 54 additions & 12 deletions config/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@
// Determines if it should avoid unreadable folders.
'ignore-unreadable-directories' => false,

/*
* This path is used to make directories in resulting zip-file relative
* Set to `null` to include complete absolute path
* Example: base_path()
*/
'relative-path' => null,

],

/*
Expand Down Expand Up @@ -99,22 +106,47 @@

],

/*
* 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,
'db-dump' => [
/*
* 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`.
*/
'compressor' => null,

/*
* The file extension used for the database dump files.
*
* If not specified, the file extension will be `.archive` for MongoDB and `.sql` for all other databases
* The file extension should be specified without a leading `.`
*/
'file-extension' => '',
],

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

/*
* The password to be used for archive encryption.
* Set to `null` to disable encryption.
*/
'password' => env('BACKUP_ARCHIVE_PASSWORD'),

/*
* The encryption algorithm to be used for archive encryption.
* You can set it to `null` or `false` to disable encryption.
*
* When set to 'default', we'll use ZipArchive::EM_AES_256 if it is
* available on your system.
*/
'encryption' => 'default',

'tasks' => [
Arcanedev\LaravelBackup\Actions\Backup\Tasks\CheckOptions::class,
Arcanedev\LaravelBackup\Actions\Backup\Tasks\CheckBackupDestinations::class,
Expand Down Expand Up @@ -262,6 +294,13 @@
'icon' => null,
],

'discord' => [
'webhook_url' => '',

'username' => null,
'avatar_url' => null,
],

],

/* -----------------------------------------------------------------
Expand All @@ -278,6 +317,9 @@
Arcanedev\LaravelBackup\Events\BackupActionHasFailed::class => [
Arcanedev\LaravelBackup\Listeners\SendBackupHasFailedNotification::class
],
Arcanedev\LaravelBackup\Events\BackupZipWasCreated::class => [
Arcanedev\LaravelBackup\Listeners\EncryptBackupArchive::class,
],

// Cleanup Action
Arcanedev\LaravelBackup\Events\CleanupActionWasSuccessful::class => [
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"

services:
php:
container_name: php_cli
container_name: laravel_backup_php
build: ./.docker/php
tty: true
volumes:
Expand All @@ -18,7 +18,7 @@ services:

mysql:
image: mysql:5.7
container_name: php_mysql
container_name: laravel_backup_mysql
volumes:
- db_data:/var/lib/mysql
ports:
Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Action.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions;

Expand Down
6 changes: 1 addition & 5 deletions src/Actions/Backup/BackupAction.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Backup;

Expand Down Expand Up @@ -72,8 +70,6 @@ protected function handleOnSuccess($passable)
* @param \Arcanedev\LaravelBackup\Actions\Backup\BackupPassable|mixed $passable
* @param \Throwable $e
*
* @return mixed|void
*
* @throws \Exception
*/
protected function handleException($passable, Throwable $e)
Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Backup/BackupPassable.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Backup;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Backup/Tasks/CheckBackupDestinations.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Backup\Tasks;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Backup/Tasks/CheckOptions.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Backup\Tasks;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Backup/Tasks/CreateBackupFile.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Backup\Tasks;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Backup/Tasks/CreateTemporaryDirectory.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Backup\Tasks;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Backup/Tasks/MoveBackupToDisks.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Backup\Tasks;

Expand Down
20 changes: 8 additions & 12 deletions src/Actions/Backup/Tasks/PrepareFilesToBackup.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Backup\Tasks;

use Arcanedev\LaravelBackup\Actions\Backup\BackupPassable;
use Arcanedev\LaravelBackup\Actions\TaskInterface;
use Arcanedev\LaravelBackup\Database\DdDumper;
use Arcanedev\LaravelBackup\Database\DbDumper;
use Arcanedev\LaravelBackup\Entities\Manifest;
use Arcanedev\LaravelBackup\Events\BackupManifestWasCreated;
use Arcanedev\LaravelBackup\Helpers\FilesSelector;
Expand All @@ -27,7 +25,7 @@ class PrepareFilesToBackup implements TaskInterface
/** @var \Arcanedev\LaravelBackup\Helpers\FilesSelector */
protected $selector;

/** @var \Arcanedev\LaravelBackup\Database\DdDumper */
/** @var \Arcanedev\LaravelBackup\Database\DbDumper */
protected $dbDumper;

/* -----------------------------------------------------------------
Expand All @@ -39,9 +37,9 @@ class PrepareFilesToBackup implements TaskInterface
* PrepareFilesToBackup constructor.
*
* @param \Arcanedev\LaravelBackup\Helpers\FilesSelector $selector
* @param \Arcanedev\LaravelBackup\Database\DdDumper $dbDumper
* @param \Arcanedev\LaravelBackup\Database\DbDumper $dbDumper
*/
public function __construct(FilesSelector $selector, DdDumper $dbDumper)
public function __construct(FilesSelector $selector, DbDumper $dbDumper)
{
$this->selector = $selector;
$this->dbDumper = $dbDumper;
Expand Down Expand Up @@ -83,16 +81,14 @@ public function handle($passable, Closure $next)
*
* @return \Arcanedev\LaravelBackup\Entities\Manifest
*/
protected function createManifest(BackupPassable $passable)
protected function createManifest(BackupPassable $passable): Manifest
{
return tap(Manifest::make($passable->temporaryDirectoryPath()), function (Manifest $manifest) use ($passable) {
if ( ! $passable->isOnlyDatabases()) {
if ( ! $passable->isOnlyDatabases())
$manifest->addFiles(['files' => $this->selectedFiles($passable)]);
}

if ( ! $passable->isOnlyFiles()) {
if ( ! $passable->isOnlyFiles())
$manifest->addFiles(['databases' => $this->dumpDatabases($passable)]);
}

$manifest->save();
});
Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Cleanup/CleanAction.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Cleanup;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Cleanup/CleanupPassable.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Cleanup;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Cleanup/Strategies/CleanupStrategy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Cleanup\Strategies;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Cleanup/Strategies/DefaultStrategy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Cleanup\Strategies;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Cleanup/Tasks/ApplyCleanupStrategy.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Cleanup\Tasks;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Cleanup/Tasks/CheckBackupDestinations.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Cleanup\Tasks;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Monitor/HealthCheckFailure.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Monitor;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Monitor/HealthChecks/AbstractHealthCheck.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Monitor\HealthChecks;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Monitor/HealthChecks/HealthCheckable.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Monitor\HealthChecks;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Monitor/HealthChecks/IsReachable.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Monitor\HealthChecks;

Expand Down
4 changes: 1 addition & 3 deletions src/Actions/Monitor/HealthChecks/MaximumAgeInDays.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<?php

declare(strict_types=1);
<?php declare(strict_types=1);

namespace Arcanedev\LaravelBackup\Actions\Monitor\HealthChecks;

Expand Down
Loading

0 comments on commit 5534f74

Please sign in to comment.