Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 83 additions & 83 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
{
"name": "itiden/statamic-backup",
"description": "Backup your Statamic site",
"license": "MIT",
"authors": [
{
"name": "Neo Lejondahl",
"role": "Developer"
}
],
"require": {
"ext-zip": "*",
"statamic/cms": "^5.0.0",
"pixelfear/composer-dist-plugin": "^0.1.6"
},
"require-dev": {
"orchestra/testbench": "^9.0",
"pestphp/pest": "^3.0",
"pestphp/pest-plugin-laravel": "^3.0",
"carthage-software/mago": "^0.11.0"
},
"autoload": {
"psr-4": {
"Itiden\\Backup\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Itiden\\Backup\\Tests\\": "tests",
"Workbench\\App\\": "workbench/app/",
"Workbench\\Database\\Factories\\": "workbench/database/factories/",
"Workbench\\Database\\Seeders\\": "workbench/database/seeders/"
},
"files": [
"tests/Helpers.php"
]
"name": "itiden/statamic-backup",
"description": "Backup your Statamic site",
"license": "MIT",
"authors": [
{
"name": "Neo Lejondahl",
"role": "Developer"
}
],
"require": {
"ext-zip": "*",
"statamic/cms": "^5.0.0",
"pixelfear/composer-dist-plugin": "^0.1.6"
},
"require-dev": {
"orchestra/testbench": "^9.0",
"pestphp/pest": "^3.0",
"pestphp/pest-plugin-laravel": "^3.0",
"carthage-software/mago": "^0.11.0"
},
"autoload": {
"psr-4": {
"Itiden\\Backup\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Itiden\\Backup\\Tests\\": "tests",
"Workbench\\App\\": "workbench/app/",
"Workbench\\Database\\Factories\\": "workbench/database/factories/",
"Workbench\\Database\\Seeders\\": "workbench/database/seeders/"
},
"scripts": {
"post-autoload-dump": [
"@clear",
"@prepare"
],
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": "@php vendor/bin/testbench workbench:build --ansi",
"serve": [
"Composer\\Config::disableProcessTimeout",
"@build",
"@php vendor/bin/testbench serve --ansi"
],
"lint": [
"@php vendor/bin/mago lint"
],
"format": [
"@php vendor/bin/mago format"
],
"test": [
"XDEBUG_MODE=coverage vendor/bin/pest --coverage"
],
"qa": [
"@format",
"@lint",
"@test"
]
"files": [
"tests/Helpers.php"
]
},
"scripts": {
"post-autoload-dump": [
"@clear",
"@prepare"
],
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
"prepare": "@php vendor/bin/testbench package:discover --ansi",
"build": "@php vendor/bin/testbench workbench:build --ansi",
"serve": [
"Composer\\Config::disableProcessTimeout",
"@build",
"@php vendor/bin/testbench serve --ansi"
],
"lint": [
"@php vendor/bin/mago lint"
],
"format": [
"@php vendor/bin/mago format"
],
"test": [
"XDEBUG_MODE=coverage vendor/bin/pest --coverage"
],
"qa": [
"@format",
"@lint",
"@test"
]
},
"extra": {
"statamic": {
"name": "Backup",
"description": "Backup your Statamic site"
},
"extra": {
"statamic": {
"name": "Backup",
"description": "Backup your Statamic site"
},
"laravel": {
"providers": [
"Itiden\\Backup\\ServiceProvider"
]
},
"download-dist": {
"url": "https://github.com/itiden/statamic-backup/releases/download/{$version}/dist.tar.gz",
"path": "resources/dist"
}
"laravel": {
"providers": [
"Itiden\\Backup\\ServiceProvider"
]
},
"config": {
"allow-plugins": {
"pixelfear/composer-dist-plugin": true,
"pestphp/pest-plugin": true,
"carthage-software/mago": true
}
"download-dist": {
"url": "https://github.com/itiden/statamic-backup/releases/download/{$version}/dist.tar.gz",
"path": "resources/dist"
}
},
"config": {
"allow-plugins": {
"pixelfear/composer-dist-plugin": true,
"pestphp/pest-plugin": true,
"carthage-software/mago": true
}
}
}
}
27 changes: 20 additions & 7 deletions config/backup.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<?php

return [
/**
* The path to the content directory
*
* This is used by the default content backup driver
*/
'content_path' => storage_path('content'),

/**
* The backup destination options
Expand Down Expand Up @@ -70,8 +64,27 @@
* All pipes are expected to be instances of Itiden\Backup\Abtracts\BackupPipe
*/
'pipeline' => [
Itiden\Backup\Pipes\Content::class,
Itiden\Backup\Pipes\StacheData::class,
Itiden\Backup\Pipes\Assets::class,
Itiden\Backup\Pipes\Users::class,
],

/**
* The stache stores that should be backed up by the StacheData pipe, by key
*/
'stache_stores' => [
// stores configurations
'asset-containers',
'collections',
'navigation',
'taxonomies',
// content stores
'terms',
'entries',
'globals',
'global-variables',
'collection-trees',
'nav-trees',
'form-submissions',
],
];
14 changes: 7 additions & 7 deletions docs/pages/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for example, maybe you don't want to backup your users, then just comment that o

```php
'pipeline' => [
Itiden\Backup\Pipes\Content::class,
Itiden\Backup\Pipes\StacheData::class,
Itiden\Backup\Pipes\Assets::class,
// Itiden\Backup\Pipes\Users::class,
],
Expand Down Expand Up @@ -68,7 +68,7 @@ use Itiden\Backup\Abstracts\BackupPipe;
use Illuminate\Support\Facades\File;
use Itiden\Backup\Support\Zipper;

final class Logs extends BackupPipe
final readonly class Logs extends BackupPipe
{
/**
* Get the key of the driver.
Expand All @@ -81,7 +81,7 @@ final class Logs extends BackupPipe
/**
* Run the restore process.
*/
public function restore(string $restoringFromPath, Closure $next): void
public function restore(string $restoringFromPath, Closure $next): string
{
$path = $this->getDirectoryPath($restoringFromPath);
// Implement the logic to restore data from the provided backup file at $path.
Expand All @@ -93,7 +93,7 @@ final class Logs extends BackupPipe
/**
* Run the backup process.
*/
public function backup(Zipper $zip, Closure $next): void
public function backup(Zipper $zip, Closure $next): Zipper
{
if (!file_exists(storage_path('logs'))) {
return $this->skip(
Expand Down Expand Up @@ -127,9 +127,9 @@ Finally, you can configure your backup to use the custom driver you've created.
return [
// ...
'pipeline' => [
Itiden\Backup\Drivers\Content::class,
Itiden\Backup\Drivers\Assets::class,
Itiden\Backup\Drivers\Users::class,
Itiden\Backup\Pipes\StacheData::class,
Itiden\Backup\Pipes\Assets::class,
Itiden\Backup\Pipes\Users::class,
App\Backup\Pipes\Logs::class,
],
// ...
Expand Down
2 changes: 2 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<php>
<env name="APP_ENV" value="testing"/>
<env name="DB_CONNECTION" value="testing"/>
<env name="CACHE_STORE" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="base64:2fl+Ktvkfl+Fuz4Qp/A75G2RTiWVA/ZoKZvp6fiiM10="/>
</php>
Expand Down
2 changes: 1 addition & 1 deletion src/Abstracts/BackupPipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Closure;
use Itiden\Backup\Support\Zipper;

abstract class BackupPipe
abstract readonly class BackupPipe
{
/**
* Get the key of the driver.
Expand Down
3 changes: 2 additions & 1 deletion src/Pipes/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
namespace Itiden\Backup\Pipes;

use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Itiden\Backup\Abstracts\BackupPipe;
use Itiden\Backup\Support\Zipper;
use Statamic\Assets\AssetContainer as Container;
use Statamic\Facades\AssetContainer;

final class Assets extends BackupPipe
final readonly class Assets extends BackupPipe
{
public static function getKey(): string
{
Expand Down
45 changes: 0 additions & 45 deletions src/Pipes/Content.php

This file was deleted.

Loading