Skip to content

Commit a96db43

Browse files
committed
Merge branch 'master' into trunk
2 parents 4225701 + 39d722a commit a96db43

File tree

103 files changed

+4042
-1716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+4042
-1716
lines changed

.github/workflows/deploy-beta.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Deploy Beta to WordPress.org
2+
on:
3+
release:
4+
types:
5+
- published
6+
jobs:
7+
tag:
8+
name: New Release
9+
runs-on: ubuntu-latest
10+
if: ${{ contains(github.event.release.name, 'beta') }}
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: WordPress Beta Plugin Deploy
16+
uses: wp-media/action-wordpress-plugin-trunk-deploy@v1.0.1
17+
env:
18+
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
19+
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
20+
SLUG: backwpup

.github/workflows/deploy-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
tag:
88
name: New Release
99
runs-on: ubuntu-latest
10+
if: ${{ !contains(github.event.release.name, 'beta') }}
1011
steps:
11-
1212
- name: Checkout
13-
uses: actions/checkout@master
13+
uses: actions/checkout@v4
1414

1515
- name: WordPress Plugin Deploy
1616
uses: 10up/action-wordpress-plugin-deploy@stable

assets/css/backwpup-admin.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,10 @@ select {
999999
margin-top: 0.5rem;
10001000
}
10011001

1002+
.mt-3 {
1003+
margin-top: 0.75rem;
1004+
}
1005+
10021006
.mt-4 {
10031007
margin-top: 1rem;
10041008
}
@@ -1617,6 +1621,14 @@ select {
16171621
padding-bottom: 5rem;
16181622
}
16191623

1624+
.pl-3 {
1625+
padding-left: 0.75rem;
1626+
}
1627+
1628+
.pr-3 {
1629+
padding-right: 0.75rem;
1630+
}
1631+
16201632
.pr-4 {
16211633
padding-right: 1rem;
16221634
}
@@ -1766,6 +1778,10 @@ select {
17661778
color: rgb(255 255 255 / var(--tw-text-opacity, 1));
17671779
}
17681780

1781+
.underline {
1782+
text-decoration-line: underline;
1783+
}
1784+
17691785
.opacity-0 {
17701786
opacity: 0;
17711787
}

assets/js/backwpup-admin.js

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,6 +2195,17 @@ jQuery(document).ready(function ($) {
21952195
}
21962196
}
21972197

2198+
/**
2199+
* Function to initialize the frequency job settings
2200+
* Runs when the element `.js-backwpup-frequency-job` is found in the DOM.
2201+
*/
2202+
function runWhenJobFormatSettingsLoaded() {
2203+
const $element = $(".js-backwpup-format-job");
2204+
if ($element.length) {
2205+
showArchiveFormatJobFields($element);
2206+
}
2207+
}
2208+
21982209
/**
21992210
* MutationObserver: Watches for new elements being added to the DOM
22002211
* When a `.js-backwpup-frequency-job` field appears, it triggers `runWhenJobFrequencySettingsLoaded()`
@@ -2206,13 +2217,100 @@ jQuery(document).ready(function ($) {
22062217
if ($(node).is(".js-backwpup-frequency-job") || $(node).find(".js-backwpup-frequency-job").length) {
22072218
runWhenJobFrequencySettingsLoaded();
22082219
}
2220+
const format_job_element = $(node).find(".js-backwpup-format-job");
2221+
if ($(node).is(".js-backwpup-format-job") || format_job_element.length) {
2222+
showArchiveFormatJobFields(format_job_element);
2223+
}
22092224
});
22102225
});
22112226
});
22122227

22132228
// Start observing DOM changes on the entire document
22142229
observer.observe(document.body, { childList: true, subtree: true });
22152230

2231+
/**
2232+
* Event Listener: Detect changes in format dropdown
2233+
* Calls `showArchiveFormatJobFields()` whenever the user selects a new frequency.
2234+
*/
2235+
$document.on("change", ".js-backwpup-format-job", function () {
2236+
showArchiveFormatJobFields($(this));
2237+
});
2238+
2239+
/**
2240+
* Event Listener: Detect changes in archive name input
2241+
* Calls `showArchiveFormatJobFields()` whenever the user selects a new frequency.
2242+
*/
2243+
$document.on("input", ".js-backwpup-format-job-name", function () {
2244+
let name = $(this).val();
2245+
let error_box = $(this).closest(`div`).find(`.js-backwpup-format-job-name-no-hash`);
2246+
if ( ! name ) {
2247+
return;
2248+
}
2249+
if ( name.includes('%hash%') ) {
2250+
error_box.hide();
2251+
} else {
2252+
error_box.show();
2253+
}
2254+
//replace plaseholder
2255+
let name_preview_span = error_box.parent().find(`.js-backwpup-format-archive-name`);
2256+
let name_previev = name.trim().replace('%hash%', name_preview_span.data('hash'));
2257+
const date = new Date();
2258+
let hourIn12Format = date.getHours();
2259+
let dayPart = 'am'
2260+
if (hourIn12Format > 12) {
2261+
hourIn12Format = hourIn12Format - 12;
2262+
dayPart = 'pm'
2263+
}
2264+
name_previev = name_previev.replace('%d', String(date.getDay() + 1).padStart(2, '0'));
2265+
name_previev = name_previev.replace('%m', String(date.getMonth() + 1).padStart(2, '0'));
2266+
name_previev = name_previev.replace('%n', String(date.getMonth() + 1));
2267+
name_previev = name_previev.replace('%j', date.getDay() + 1);
2268+
name_previev = name_previev.replace('%Y', date.getFullYear());
2269+
name_previev = name_previev.replace('%y', String(date.getFullYear()).slice(-2));
2270+
name_previev = name_previev.replace('%a', dayPart);
2271+
name_previev = name_previev.replace('%A', dayPart.toUpperCase());
2272+
let btm = ( ( date.getHours() * 60 + date.getMinutes() ) * 86.4 / 100 ).toFixed(0);
2273+
name_previev = name_previev.replace('%B', btm);
2274+
name_previev = name_previev.replace('%g', hourIn12Format);
2275+
name_previev = name_previev.replace('%G', date.getHours());
2276+
name_previev = name_previev.replace('%h', String(hourIn12Format).padStart(2, '0'));
2277+
name_previev = name_previev.replace('%H', String(date.getHours()).padStart(2, '0'));
2278+
name_previev = name_previev.replace('%i', date.getMinutes());
2279+
name_previev = name_previev.replace('%s', date.getSeconds());
2280+
//replace special chars
2281+
let specialChars = [ '?', '[', ']', '/', '\\', '=', '<', '>', ':', ';', ',', "'", '"', '&', '$', '#', '*', '(', ')', '|', '~', '`', '!', '{', '}' ];
2282+
specialChars.forEach(function (char) {
2283+
name_previev = name_previev.replace(char, '');
2284+
});
2285+
let spaces = [ ' ', '%20', '+' ];
2286+
spaces.forEach(function (space) {
2287+
name_previev = name_previev.replace(space, '_');
2288+
});
2289+
let divider = [ '\t', '\r', '\n' ];
2290+
divider.forEach(function (divider) {
2291+
name_previev = name_previev.replace(divider, '-');
2292+
});
2293+
name_preview_span.text(name_previev);
2294+
});
2295+
2296+
/**
2297+
* Function to show/hide elements based on selected job archive format
2298+
* @param {string} element - the element to check.
2299+
*/
2300+
function showArchiveFormatJobFields(element) {
2301+
let format = element.val();
2302+
let alert_box = element.closest(`div`).next(`.js-backwpup-format-job-show-if-zip`);
2303+
if (format === ".zip") {
2304+
alert_box.show();
2305+
} else {
2306+
alert_box.hide();
2307+
}
2308+
let name_preview = alert_box.parent().find(`.js-backwpup-format-archive-name-format`);
2309+
if ( name_preview ) {
2310+
name_preview.text(format);
2311+
}
2312+
}
2313+
22162314
/**
22172315
* Event Listener: Detect changes in frequency dropdown
22182316
* Calls `showFrequencyJobFields()` whenever the user selects a new frequency.
@@ -2290,8 +2388,42 @@ jQuery(document).ready(function ($) {
22902388
);
22912389
});
22922390

2391+
2392+
/**
2393+
* Event Listener: Handles the "Save Job Format Settings" button click
2394+
* Extracts form data and sends an AJAX request to save the job format settings.
2395+
*/
2396+
$document.on("click", "#save-job-format", function () {
2397+
const container = $(this).closest("article");
2398+
2399+
// Collect input values from the form
2400+
const data = {
2401+
archiveformat: container.find("select[name='archiveformat']").val(),
2402+
archivename: container.find("input[name='archivename']").val(),
2403+
job_id: container.find("input[name='job_id']").val(),
2404+
};
2405+
2406+
// Send AJAX request to save job settings
2407+
requestWPApi(
2408+
backwpupApi.save_job_format,
2409+
data,
2410+
function (response) {
2411+
if (response.status === 200) {
2412+
backwpupDisplaySettingsToast('success', response.message);
2413+
// Close the settings sidebar
2414+
closeSidebar();
2415+
}
2416+
if (response.status === 500) {
2417+
backwpupDisplaySettingsToast('danger', response.error);
2418+
}
2419+
},
2420+
"POST"
2421+
);
2422+
});
2423+
22932424
// Run the job settings function on initial page load
22942425
runWhenJobFrequencySettingsLoaded();
2426+
runWhenJobFormatSettingsLoaded();
22952427

22962428
$document.on('click', '.backwpup-start-backup-job', function () {
22972429
startBackupProcess({ 'job_id': $(this).data('job_id') });

assets/js/backwpup-admin.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backwpup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: WordPress Backup Plugin
66
* Author: BackWPup – WordPress Backup & Restore Plugin
77
* Author URI: https://backwpup.com
8-
* Version: 5.4.0
8+
* Version: 5.5.0
99
* Requires at least: 4.9
1010
* Requires PHP: 7.4
1111
* Text Domain: backwpup

changelog.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
== Changelog ==
2+
= 5.5.0 =
3+
Release date: September 16, 2025
4+
5+
* New Feature: Archive format per backup
6+
* New Feature: Archive name per backup
7+
8+
= 5.4.1 =
9+
Release date: September 2, 2025
10+
11+
* Fix: Additional Guzzle Dependency conflicts causing errors.
12+
213
= 5.4 =
314
Release date: August 20, 2025
415

516
* New feature: Add extra files or folders for backups
617
* Fix: Sending unwanted warning email because of .donotbackup file.
7-
* FIx: Showing cursor pointer on non-clickable elements.
8-
* FIx: Backup downloads are not working for FTP storage.
9-
* Fix: Guzzle Dependency conflict causing errors in backups.
18+
* Fix: Showing cursor pointer on non-clickable elements.
19+
* Fix: Backup downloads are not working for FTP storage.
20+
* Fix: Guzzle Dependency conflict causing errors in backups
1021
* Fix: The Encrypt archive option is disabled after the update.
1122
* Fix: The backup now icon is closer to the date of scheduled backups.
1223
* Fix: No backup is created for any storage when OneDrive is selected during onboarding.

components/form/text.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
?>
4343
<label class="<?php echo BackWPupHelpers::clsx($container_classes, $container_contextual_classes); ?>">
44-
<input name="<?=esc_attr($name)?>" type="<?php echo esc_attr($type); ?>" <?php echo $id; ?> class="<?php echo BackWPupHelpers::clsx("input-base text-lg w-full", $trigger); ?>" placeholder="" <?php if ($required) : ?>required<?php endif; ?> value="<?php echo esc_attr($value); ?>" <?php if (isset($min) && $type === "number") : ?>min="<?php echo esc_attr($min); ?>" <?php endif; ?> <?php if (isset($max) && $type === "number") : ?>max="<?php echo esc_attr($max); ?>" <?php endif; ?>>
44+
<input name="<?=esc_attr($name)?>" type="<?php echo esc_attr($type); ?>" <?php echo $id; ?> class="<?php echo BackWPupHelpers::clsx("input-base text-lg w-full", $trigger); ?>" placeholder="" <?php if ($required) : ?>required<?php endif; ?> value="<?php echo esc_attr($value); ?>" <?php if (isset($min) && $type === "number") : ?>min="<?php echo esc_attr($min); ?>" <?php endif; ?> <?php if (isset($max) && $type === "number") : ?>max="<?php echo esc_attr($max); ?>" <?php endif; ?><?php if (isset($maxlength)) : ?> maxlength="<?php echo esc_attr($maxlength); ?>" <?php endif; ?>>
4545
<p class="<?php echo $text_classes; ?> <?php echo $text_contextual_classes; ?>">
4646
<?php echo $label; ?>
4747
<?php isset($tooltip) && BackWPupHelpers::component("tooltip", ["content" => $tooltip, "icon_size" => "small", "position" => $tooltip_pos]); ?>

components/job-item.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,5 +206,23 @@
206206
]
207207
);
208208
?>
209+
<span class="h-5 w-0 border-r border-primary-darker"></span>
210+
<?php
211+
BackWPupHelpers::component(
212+
'form/button',
213+
[
214+
'type' => 'link',
215+
'label' => __( 'Format', 'backwpup' ),
216+
'trigger' => 'load-and-open-sidebar',
217+
'display' => 'format',
218+
'disabled' => ! $is_active,
219+
'data' => [
220+
'job-id' => $job_id,
221+
'block-type' => 'children',
222+
'block-name' => 'sidebar/format',
223+
],
224+
]
225+
);
226+
?>
209227
</p>
210228
</div>

inc/Utils/BackWPupHelpers.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,16 @@ function ( &$item ) use ( $job_data, $dest, $page ) {
113113
$item = array_merge( $item, $job_data, [ 'stored_on' => $dest ] );
114114

115115
// Parse the filename to get the type of backup.
116-
$filename = pathinfo( $item['filename'] )['filename'];
117-
$filename = preg_replace( '/\.[^.]+$/', '', $filename ); // Remove file extensions.
116+
$filename = pathinfo( $item['filename'] )['filename'];
117+
if ( stripos( $item['filename'], '.tar.gz' ) === strlen( $item['filename'] ) - 7 ) {
118+
$filename = substr( $item['filename'], 0, -7 );
119+
} elseif ( stripos( $item['filename'], '.tar.bz2' ) === strlen( $item['filename'] ) - 8 ) {
120+
$filename = substr( $item['filename'], 0, -8 );
121+
}
118122
$filename_parts = explode( '_', $filename );
119123

120-
if ( isset( $filename_parts[3] ) ) {
121-
$item['data'] = (array) explode( '-', $filename_parts[3] );
124+
if ( count( $filename_parts ) > 1 ) {
125+
$item['data'] = (array) explode( '-', end( $filename_parts ) );
122126
}
123127

124128
$local_file = untrailingslashit( BackWPup::get_plugin_data( 'TEMP' ) ) . "/{$item['filename']}";

0 commit comments

Comments
 (0)