Skip to content

Commit

Permalink
Adds checkbox to deploy media files
Browse files Browse the repository at this point in the history
Fixes #51
  • Loading branch information
octoberapp committed Aug 9, 2023
1 parent 4d12bd2 commit a8f0ac6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
17 changes: 16 additions & 1 deletion classes/ArchiveBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function buildConfigFiles(string $outputFilePath)
}

/**
* buildConfigFiles builds the config files
* buildAppFiles builds the application files
*/
public function buildAppFiles(string $outputFilePath)
{
Expand All @@ -176,6 +176,21 @@ public function buildAppFiles(string $outputFilePath)
]);
}

/**
* buildMediaFiles builds the media files in the storage directory
*/
public function buildMediaFiles(string $outputFilePath)
{
$this->buildArchive($outputFilePath, [
'dirs' => [
'storage/app/media'
],
'dirsSrc' => [
'storage/app/media' => base_path('storage/app/media'),
]
]);
}

/**
* buildCoreModules builds the core modules
*/
Expand Down
13 changes: 13 additions & 0 deletions controllers/Servers.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Str;
use Flash;
use System;
use Config;
use Backend;
use Redirect;
use Response;
Expand Down Expand Up @@ -317,6 +318,10 @@ public function manage_onSaveDeployToServer($serverId)
$useFiles[] = $this->buildArchiveDeployStep($deployActions, 'App', 'buildAppFiles');
}

if (post('deploy_media')) {
$useFiles[] = $this->buildArchiveDeployStep($deployActions, 'Media', 'buildMediaFiles');
}

if ($plugins = post('plugins')) {
$useFiles[] = $this->buildArchiveDeployStep($deployActions, 'Plugins', 'buildPluginsBundle', [(array) $plugins]);
}
Expand Down Expand Up @@ -623,5 +628,13 @@ protected function applyFormWidgetFilter($key, $widget)
) {
$appField->hidden = true;
}

// Hide the media field is media storage is not local
if (
Config::get('filesystems.disks.media.driver') !== 'local' &&
($mediaField = $widget->getField('deploy_media'))
) {
$mediaField->hidden = true;
}
}
}
7 changes: 7 additions & 0 deletions models/server/fields_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ fields:
comment: Everything in the app directory (including blueprints)
type: checkbox

deploy_media:
tab: Deploy
span: auto
label: Deploy Media Files
comment: All media files in the storage directory
type: checkbox

plugins:
tab: Deploy
span: left
Expand Down

0 comments on commit a8f0ac6

Please sign in to comment.