-
-
Notifications
You must be signed in to change notification settings - Fork 317
Add backup feature #3678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tadhgboyle
wants to merge
17
commits into
develop
Choose a base branch
from
tb/backups
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add backup feature #3678
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0219edb
Add backup feature
tadhgboyle 600dc36
lint
tadhgboyle b2bcee5
wip
tadhgboyle f8c67a4
wip
tadhgboyle e1d8bde
wip
tadhgboyle eb0998b
wip
tadhgboyle 3f1612d
lint
tadhgboyle b863be3
add retention and daily backup settings
tadhgboyle af33fdf
wip
tadhgboyle f83e466
wip
tadhgboyle 313ac84
add backup information to update page
tadhgboyle 840c91b
remove hardcoded
tadhgboyle 1c15441
lint
tadhgboyle ae6587c
split file backup and zipping into seperate methods
tadhgboyle b6721a0
Merge branch 'develop' into tb/backups
tadhgboyle d3fb309
add root user check during downloads
tadhgboyle 5b16ceb
store backups in /cache/backups
tadhgboyle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ composer.lock | |
| checksums.json | ||
| /.node_cache/ | ||
| /release/ | ||
| /backups/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,16 @@ public function run(): void | |
| Settings::set('discord_widget_theme', $discord_widget_theme, 'Discord Integration'); | ||
| $this->_cache->eraseAll(); | ||
|
|
||
| // Add admincp.core.backups permission to Admin group | ||
| $admin_group = Group::find(1); | ||
| $permissions = json_decode($admin_group->permissions, true); | ||
| if (!isset($permissions['admincp.core.backups'])) { | ||
| $permissions['admincp.core.backups'] = 1; | ||
| DB::getInstance()->update('groups', $admin_group->id, [ | ||
| 'permissions' => json_encode($permissions), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of this can still be removed, We have not updated admin group perms for ages as it already had Adminstrator perm |
||
| ]); | ||
| } | ||
|
|
||
| $this->setVersion('2.3.0'); | ||
| } | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| {include file='header.tpl'} | ||
|
|
||
| <body id="page-top"> | ||
|
|
||
| <!-- Wrapper --> | ||
| <div id="wrapper"> | ||
|
|
||
| <!-- Sidebar --> | ||
| {include file='sidebar.tpl'} | ||
|
|
||
| <!-- Content Wrapper --> | ||
| <div id="content-wrapper" class="d-flex flex-column"> | ||
|
|
||
| <!-- Main content --> | ||
| <div id="content"> | ||
|
|
||
| <!-- Topbar --> | ||
| {include file='navbar.tpl'} | ||
|
|
||
| <!-- Begin Page Content --> | ||
| <div class="container-fluid"> | ||
|
|
||
| <!-- Page Heading --> | ||
| <div class="d-sm-flex align-items-center justify-content-between mb-4"> | ||
| <h1 class="h3 mb-0 text-gray-800">{$DEBUGGING_AND_MAINTENANCE}</h1> | ||
| <ol class="breadcrumb float-sm-right"> | ||
| <li class="breadcrumb-item"><a href="{$PANEL_INDEX}">{$DASHBOARD}</a></li> | ||
| <li class="breadcrumb-item active">{$CONFIGURATION}</li> | ||
| <li class="breadcrumb-item"><a href="{$BACK_LINK}">{$DEBUGGING_AND_MAINTENANCE}</a></li> | ||
| <li class="breadcrumb-item active">{$BACKUPS}</li> | ||
| </ol> | ||
| </div> | ||
|
|
||
| <!-- Update Notification --> | ||
| {include file='includes/update.tpl'} | ||
|
|
||
| <div class="card shadow mb-4"> | ||
| <div class="card-body"> | ||
|
|
||
| <h5 style="display: inline-block; margin-top: 7px; margin-bottom: 7px;">{$BACKUPS}</h5> | ||
|
|
||
| <div class="float-right"> | ||
| <a href="{$CREATE_BACKUP_LINK}" class="btn btn-success">{$CREATE_BACKUP}</a> | ||
| <a href="{$BACK_LINK}" class="btn btn-primary">{$BACK}</a> | ||
| </div> | ||
| <hr /> | ||
|
|
||
| <!-- Success and Error Alerts --> | ||
| {include file='includes/alerts.tpl'} | ||
|
|
||
| <div class="card shadow border-left-primary"> | ||
| <div class="card-body"> | ||
| <h5><i class="icon fa fa-info-circle"></i> {$INFO}</h5> | ||
| {$BACKUPS_INFO} | ||
| </div> | ||
| </div> | ||
|
|
||
| <br /> | ||
|
|
||
| <!-- Backup Settings --> | ||
| <div class="card shadow border-left-info mb-4"> | ||
| <div class="card-body"> | ||
| <h5><i class="icon fa fa-cogs"></i> {$BACKUP_SETTINGS}</h5> | ||
|
|
||
| <form action="" method="post"> | ||
| <div class="form-group row"> | ||
| <div class="col-md-6"> | ||
| <label for="inputMaxRetention">{$MAX_BACKUP_RETENTION}</label> | ||
| <input type="number" name="max_backup_retention" id="inputMaxRetention" | ||
| class="form-control" value="{$MAX_BACKUP_RETENTION_VALUE}" min="0" step="1"> | ||
| <small class="form-text text-muted">{$MAX_BACKUP_RETENTION_INFO}</small> | ||
| </div> | ||
| <div class="col-md-6"> | ||
| <label for="inputDailyScheduling">{$DAILY_BACKUP_SCHEDULING}</label> | ||
| <select name="daily_backup_scheduling" id="inputDailyScheduling" class="form-control"> | ||
| <option value="0" {if $DAILY_BACKUP_SCHEDULING_VALUE eq '0'}selected{/if}>{$DISABLED}</option> | ||
| <option value="1" {if $DAILY_BACKUP_SCHEDULING_VALUE eq '1'}selected{/if}>{$ENABLED}</option> | ||
| </select> | ||
| <small class="form-text text-muted">{$DAILY_BACKUP_SCHEDULING_INFO}</small> | ||
| </div> | ||
| </div> | ||
| <div class="form-group"> | ||
| <input type="hidden" name="token" value="{$TOKEN}"> | ||
| <input type="hidden" name="action" value="settings"> | ||
| <input type="submit" class="btn btn-primary" value="{$SUBMIT}"> | ||
| </div> | ||
| </form> | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Existing Backups --> | ||
| {if isset($EXISTING_BACKUPS) && count($EXISTING_BACKUPS) > 0} | ||
| <h5>{$EXISTING}</h5> | ||
|
|
||
| <div class="table-responsive"> | ||
| <table class="table table-striped table-hover"> | ||
| <thead> | ||
| <tr> | ||
| <th>{$FILENAME}</th> | ||
| <th>{$DATE_CREATED}</th> | ||
| <th>{$FILE_SIZE}</th> | ||
| {if $CAN_DOWNLOAD} | ||
| <th>{$ACTIONS}</th> | ||
| {/if} | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {foreach from=$EXISTING_BACKUPS item=backup} | ||
| <tr> | ||
| <td>{$backup.filename}</td> | ||
| <td>{$backup.date}</td> | ||
| <td>{$backup.size}</td> | ||
| {if $CAN_DOWNLOAD} | ||
| <td> | ||
| <a href="{$backup.download_link}" target="_blank" class="btn btn-sm btn-primary"> | ||
| <i class="fa fa-download"></i> {$DOWNLOAD} | ||
| </a> | ||
| </td> | ||
| {/if} | ||
| </tr> | ||
| {/foreach} | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| {else} | ||
| <div class="alert alert-info"> | ||
| <i class="fa fa-info-circle"></i> {$NO_BACKUPS} | ||
| </div> | ||
| {/if} | ||
| </div> | ||
| </div> | ||
|
|
||
| <!-- Spacing --> | ||
| <div style="height:1rem;"></div> | ||
|
|
||
| <!-- End Page Content --> | ||
| </div> | ||
|
|
||
| <!-- End Main Content --> | ||
| </div> | ||
|
|
||
| {include file='footer.tpl'} | ||
|
|
||
| <!-- End Content Wrapper --> | ||
| </div> | ||
|
|
||
| <!-- End Wrapper --> | ||
| </div> | ||
|
|
||
| {include file='scripts.tpl'} | ||
|
|
||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.