first commit
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Duplicator messages sections
|
||||
*
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\SchedulePageController;
|
||||
use Duplicator\Core\Controllers\ControllersManager;
|
||||
use Duplicator\Models\ScheduleEntity;
|
||||
use Duplicator\Models\Storages\AbstractStorageEntity;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
* @var AbstractStorageEntity $storage
|
||||
*/
|
||||
$blur = $tplData['blur'];
|
||||
$schedule = $tplData['schedule'];
|
||||
$copyScheduleList = ScheduleEntity::getAll(
|
||||
0,
|
||||
0,
|
||||
null,
|
||||
fn(ScheduleEntity $s): bool => $s->getId() != $schedule->getId()
|
||||
);
|
||||
$schedulesListURL = ControllersManager::getMenuLink(
|
||||
ControllersManager::SCHEDULES_SUBMENU_SLUG
|
||||
);
|
||||
$scheduleCopyBaseURL = SchedulePageController::getInstance()->getCopyActionUrl($schedule->getId());
|
||||
|
||||
$countList = count($copyScheduleList);
|
||||
?>
|
||||
<div class="dup-toolbar <?php echo ($blur ? 'dup-mock-blur' : ''); ?>">
|
||||
<label for="dup-copy-source-id-select" class="screen-reader-text">Copy storage action</label>
|
||||
<select
|
||||
id="dup-schedule-copy-select"
|
||||
name="dupli-source-schedule-id"
|
||||
class="small"
|
||||
<?php disabled($countList, 0); ?>>
|
||||
<option value="-1" selected="selected" disabled="true">
|
||||
<?php esc_html_e('Copy From', 'duplicator-pro'); ?>
|
||||
</option>
|
||||
<?php foreach ($copyScheduleList as $copy_schedule) { ?>
|
||||
<option value="<?php echo (int) $copy_schedule->getId(); ?>">
|
||||
<?php echo esc_html($copy_schedule->name); ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<input
|
||||
id="dup-schedule-copy-btn"
|
||||
type="button"
|
||||
class="button hollow secondary small action"
|
||||
value="<?php esc_html_e("Apply", 'duplicator-pro') ?>"
|
||||
disabled>
|
||||
<span class="separator"></span>
|
||||
<a
|
||||
href="<?php echo esc_url($schedulesListURL); ?>"
|
||||
class="button hollow secondary small "
|
||||
title="<?php esc_attr_e('Back to Schedules list.', 'duplicator-pro'); ?>">
|
||||
<i class="far fa-clock fa-sm"></i> <?php esc_html_e('Schedules', 'duplicator-pro'); ?>
|
||||
</a>
|
||||
</div>
|
||||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
$('#dup-schedule-copy-select').on('change', function(e) {
|
||||
let copyId = parseInt($(this).val());
|
||||
$('#dup-schedule-copy-btn').prop('disabled', (copyId <= 0));
|
||||
});
|
||||
|
||||
/*$('#dup-schedule-copy-select').change(function (evente) {
|
||||
event.preventDefault();
|
||||
alert('changed val ' + $(this).val());
|
||||
$('#dup-schedule-copy-btn').prop('disabled', ($(this).val() > 0));
|
||||
});*/
|
||||
|
||||
$('#dup-schedule-copy-btn').click(function(event) {
|
||||
event.preventDefault();
|
||||
let copyId = $('#dup-schedule-copy-select').val();
|
||||
document.location.href = <?php echo json_encode($scheduleCopyBaseURL); ?> + '&dupli-source-schedule-id=' + copyId;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<hr class="dup-toolbar-divider" />
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Duplicator Daily repeat template
|
||||
*
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
*/
|
||||
$runEvery = $tplMng->getDataValueIntRequired('run_every');
|
||||
$frequency_note = $tplMng->getDataValueString('frequency_note', '');
|
||||
?>
|
||||
<label class="lbl-larger">
|
||||
<?php esc_html_e('Every', 'duplicator-pro'); ?>
|
||||
</label>
|
||||
<div>
|
||||
<select name="_run_every_days" class="width-tiny inline-block margin-0" data-parsley-ui-enabled="false">
|
||||
<?php for ($i = 1; $i < 30; $i++) { ?>
|
||||
<option <?php selected($i, $runEvery); ?> value="<?php echo (int) $i; ?>">
|
||||
<?php echo (int) $i; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<?php esc_html_e('days', 'duplicator-pro'); ?>
|
||||
<i
|
||||
class="fa-solid fa-question-circle fa-sm dark-gray-color"
|
||||
data-tooltip-title="<?php esc_attr_e("Frequency Note", 'duplicator-pro'); ?>"
|
||||
data-tooltip="<?php echo esc_attr($frequency_note) ?>">
|
||||
</i>
|
||||
</div>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Duplicator Hourly repeat template
|
||||
*
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
*/
|
||||
|
||||
$runEvery = $tplMng->getDataValueIntRequired('run_every');
|
||||
$frequency_note = $tplMng->getDataValueString('frequency_note', '');
|
||||
$hour_intervals = [
|
||||
1,
|
||||
2,
|
||||
4,
|
||||
6,
|
||||
12,
|
||||
];
|
||||
$tipContent = __('Backup will build every x hours starting at 00:00.', 'duplicator-pro') . '<br/><br/>' . $frequency_note;
|
||||
?>
|
||||
<label class="lbl-larger">
|
||||
<?php esc_html_e('Every', 'duplicator-pro'); ?>
|
||||
</label>
|
||||
<div>
|
||||
<select name="_run_every_hours" class="width-tiny inline-block margin-0" data-parsley-ui-enabled="false">
|
||||
<?php foreach ($hour_intervals as $hour_interval) { ?>
|
||||
<option <?php selected($hour_interval, $runEvery); ?> value="<?php echo (int) $hour_interval; ?>">
|
||||
<?php echo (int) $hour_interval; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<?php
|
||||
esc_html_e('hours', 'duplicator-pro');
|
||||
?>
|
||||
<i
|
||||
class="fa-solid fa-question-circle fa-sm dark-gray-color"
|
||||
data-tooltip-title="<?php esc_attr_e("Frequency Note", 'duplicator-pro'); ?>"
|
||||
data-tooltip="<?php echo esc_attr($tipContent); ?>">
|
||||
</i>
|
||||
</div>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Duplicator Monthly repeat template
|
||||
*
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
*/
|
||||
|
||||
$runEvery = $tplMng->getDataValueIntRequired('run_every');
|
||||
$dayOfMonth = $tplMng->getDataValueIntRequired('day_of_month');
|
||||
?>
|
||||
<label class="lbl-larger">
|
||||
<?php esc_html_e('Day', 'duplicator-pro'); ?>
|
||||
</label>
|
||||
<div>
|
||||
<select name="day_of_month" class="width-tiny inline-block margin-0">
|
||||
<?php for ($i = 1; $i <= 31; $i++) { ?>
|
||||
<option <?php selected($i, $dayOfMonth); ?> value="<?php echo (int) $i; ?>">
|
||||
<?php echo (int) $i; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<?php esc_html_e('of every', 'duplicator-pro'); ?>
|
||||
<select name="_run_every_months" data-parsley-ui-enabled="false" class="width-tiny inline-block margin-0">
|
||||
<?php for ($i = 1; $i <= 12; $i++) { ?>
|
||||
<option <?php selected($i, $runEvery); ?> value="<?php echo (int) $i; ?>">
|
||||
<?php echo (int) $i; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<?php esc_html_e('month(s)', 'duplicator-pro'); ?>
|
||||
</div>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Duplicator Weekly repeat template
|
||||
*
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
*/
|
||||
|
||||
$weekdays = $tplMng->getDataValueArrayRequired('weekdays');
|
||||
?>
|
||||
<label class="lbl-larger">
|
||||
<?php esc_html_e('Every', 'duplicator-pro'); ?>
|
||||
</label>
|
||||
<div>
|
||||
<!-- RSR Cron does not support counting by week - just days and months so removing (for now?)-->
|
||||
<div class="weekday-div">
|
||||
<input
|
||||
<?php checked($weekdays['mon']); ?>
|
||||
value="mon" name="weekday[]"
|
||||
type="checkbox"
|
||||
id="repeat-weekly-mon"
|
||||
data-parsley-group="weekly" required data-parsley-class-handler="#repeat-weekly-area"
|
||||
data-parsley-error-message="<?php esc_attr_e('At least one day must be checked.', 'duplicator-pro'); ?>"
|
||||
data-parsley-no-focus data-parsley-errors-container="#weekday-errors">
|
||||
<label for="repeat-weekly-mon"><?php esc_html_e('Monday', 'duplicator-pro'); ?></label>
|
||||
</div>
|
||||
<div class="weekday-div">
|
||||
<input
|
||||
<?php checked($weekdays['tue']); ?>
|
||||
value="tue" name="weekday[]"
|
||||
type="checkbox"
|
||||
id="repeat-weekly-tue">
|
||||
<label for="repeat-weekly-tue"><?php esc_html_e('Tuesday', 'duplicator-pro'); ?></label>
|
||||
</div>
|
||||
<div class="weekday-div">
|
||||
<input
|
||||
<?php checked($weekdays['wed']); ?>
|
||||
value="wed" name="weekday[]"
|
||||
type="checkbox"
|
||||
id="repeat-weekly-wed">
|
||||
<label for="repeat-weekly-wed"><?php esc_html_e('Wednesday', 'duplicator-pro'); ?></label>
|
||||
</div>
|
||||
<div class="weekday-div">
|
||||
<input
|
||||
<?php checked($weekdays['thu']); ?>
|
||||
value="thu" name="weekday[]"
|
||||
type="checkbox"
|
||||
id="repeat-weekly-thu">
|
||||
<label for="repeat-weekly-thu"><?php esc_html_e('Thursday', 'duplicator-pro'); ?></label>
|
||||
</div>
|
||||
<div class="weekday-div" style="clear:both">
|
||||
<input
|
||||
<?php checked($weekdays['fri']); ?>
|
||||
value="fri" name="weekday[]"
|
||||
type="checkbox"
|
||||
id="repeat-weekly-fri">
|
||||
<label for="repeat-weekly-fri"><?php esc_html_e('Friday', 'duplicator-pro'); ?></label>
|
||||
</div>
|
||||
<div class="weekday-div">
|
||||
<input
|
||||
<?php checked($weekdays['sat']); ?>
|
||||
value="sat" name="weekday[]"
|
||||
type="checkbox"
|
||||
id="repeat-weekly-sat">
|
||||
<label for="repeat-weekly-sat"><?php esc_html_e('Saturday', 'duplicator-pro'); ?></label>
|
||||
</div>
|
||||
<div class="weekday-div">
|
||||
<input
|
||||
<?php checked($weekdays['sun']); ?>
|
||||
value="sun" name="weekday[]"
|
||||
type="checkbox"
|
||||
id="repeat-weekly-sun">
|
||||
<label for="repeat-weekly-sun"><?php esc_html_e('Sunday', 'duplicator-pro'); ?></label>
|
||||
</div>
|
||||
<div style="padding-top:3px; clear:both;" id="weekday-errors"></div>
|
||||
</div>
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Duplicator messages sections
|
||||
*
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
use Duplicator\Addons\ProBase\License\License;
|
||||
use Duplicator\Models\ScheduleEntity;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
*/
|
||||
|
||||
$repeatType = $tplMng->getDataValueIntRequired('repeat_type');
|
||||
|
||||
$min_frequency = 0;
|
||||
$max_frequency = (
|
||||
License::can(License::CAPABILITY_SHEDULE_HOURLY) ?
|
||||
ScheduleEntity::REPEAT_HOURLY :
|
||||
ScheduleEntity::REPEAT_MONTHLY
|
||||
);
|
||||
|
||||
$frequencyUpgradMsg = sprintf(
|
||||
__(
|
||||
'Hourly frequency isn\'t available at the <b>%1$s</b> license level.',
|
||||
'duplicator-pro'
|
||||
),
|
||||
License::getLicenseToString()
|
||||
) .
|
||||
' <b>' .
|
||||
sprintf(
|
||||
_x(
|
||||
'To enable this option %1$supgrade%2$s the License.',
|
||||
'%1$s and %2$s represents the opening and closing HTML tags for an anchor or link',
|
||||
'duplicator-pro'
|
||||
),
|
||||
'<a href="' . esc_url(License::getUpsellURL()) . '" target="_blank">',
|
||||
'</a>'
|
||||
) .
|
||||
'</b>';
|
||||
|
||||
$frequency_note = __(
|
||||
'If you have a large site, it\'s recommended you schedule backups during lower traffic periods.
|
||||
If you\'re on a shared host then be aware that running multiple schedules too close together
|
||||
(i.e. every 10 minutes) may alert your host to a spike in system resource usage.
|
||||
Be sure that your schedules do not overlap and give them plenty of time to run.',
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
|
||||
<div class="dup-settings-wrapper margin-bottom-1">
|
||||
<label class="lbl-larger"><?php esc_html_e("Repeats", 'duplicator-pro'); ?></label>
|
||||
<div class="margin-bottom-1">
|
||||
<select
|
||||
id="change-mode"
|
||||
name="repeat_type"
|
||||
class="width-small margin-0"
|
||||
onchange="DupliJs.Schedule.ChangeMode()"
|
||||
data-parsley-range='<?php printf('[%1$s, %2$s]', (int) $min_frequency, (int) $max_frequency); ?>'
|
||||
data-parsley-error-message="<?php echo esc_attr($frequencyUpgradMsg); ?>">
|
||||
<option
|
||||
value="<?php echo (int) ScheduleEntity::REPEAT_HOURLY; ?>"
|
||||
<?php selected($repeatType, ScheduleEntity::REPEAT_HOURLY) ?>>
|
||||
<?php esc_html_e("Hourly", 'duplicator-pro'); ?>
|
||||
</option>
|
||||
<option
|
||||
value="<?php echo (int) ScheduleEntity::REPEAT_DAILY; ?>"
|
||||
<?php selected($repeatType, ScheduleEntity::REPEAT_DAILY) ?>>
|
||||
<?php esc_html_e("Daily", 'duplicator-pro'); ?>
|
||||
</option>
|
||||
<option
|
||||
value="<?php echo (int) ScheduleEntity::REPEAT_WEEKLY; ?>"
|
||||
<?php selected($repeatType, ScheduleEntity::REPEAT_WEEKLY) ?>>
|
||||
<?php esc_html_e("Weekly", 'duplicator-pro'); ?>
|
||||
</option>
|
||||
<option
|
||||
value="<?php echo (int) ScheduleEntity::REPEAT_MONTHLY; ?>"
|
||||
<?php selected($repeatType, ScheduleEntity::REPEAT_MONTHLY) ?>>
|
||||
<?php esc_html_e("Monthly", 'duplicator-pro'); ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Repeat Options -->
|
||||
<div id="repeat-hourly-area" class="repeater-area margin-bottom-1">
|
||||
<?php $tplMng->render('admin_pages/schedules/parts/repeat_hourly', ['frequency_note' => $frequency_note]); ?>
|
||||
</div>
|
||||
|
||||
<div id="repeat-daily-area" class="repeater-area margin-bottom-1">
|
||||
<?php $tplMng->render('admin_pages/schedules/parts/repeat_daily', ['frequency_note' => $frequency_note]); ?>
|
||||
</div>
|
||||
|
||||
<div id="repeat-weekly-area" class="repeater-area margin-bottom-1">
|
||||
<?php $tplMng->render('admin_pages/schedules/parts/repeat_weekly'); ?>
|
||||
</div>
|
||||
|
||||
<div id="repeat-monthly-area" class="repeater-area margin-bottom-1">
|
||||
<?php $tplMng->render('admin_pages/schedules/parts/repeat_monthly'); ?>
|
||||
</div>
|
||||
|
||||
<!-- Start Time -->
|
||||
<?php $tplMng->render('admin_pages/schedules/parts/start_time'); ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
DupliJs.Schedule.ChangeMode = function() {
|
||||
var mode = $("#change-mode option:selected").val();
|
||||
var animate = 400;
|
||||
$('#repeat-hourly-area, #repeat-daily-area, #repeat-weekly-area, #repeat-monthly-area').hide();
|
||||
n = $("#repeat-weekly-area input:checked").length;
|
||||
|
||||
if (n == 0) {
|
||||
// Hack so parsely will ignore weekly if it isnt selected
|
||||
$('#repeat-weekly-mon').prop("checked", true);
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case "0":
|
||||
$('#repeat-daily-area').show(animate);
|
||||
$('#start-time-label, #start-time-content').show(animate);
|
||||
break;
|
||||
case "1":
|
||||
$('#repeat-weekly-area').show(animate);
|
||||
$('#start-time-label, #start-time-content').show(animate);
|
||||
break;
|
||||
case "2":
|
||||
$('#repeat-monthly-area').show(animate);
|
||||
$('#start-time-label, #start-time-content').show(animate);
|
||||
break;
|
||||
case "3":
|
||||
$('#repeat-hourly-area').show(animate);
|
||||
$('#start-time-label, #start-time-content').hide(animate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DupliJs.Schedule.ChangeMode();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Duplicator Start Time template
|
||||
*
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
*/
|
||||
|
||||
$start_hour = $tplMng->getDataValueIntRequired('start_hour');
|
||||
$start_minute = $tplMng->getDataValueIntRequired('start_minute');
|
||||
$mins = 0;
|
||||
?>
|
||||
<label class="lbl-larger" id="start-time-label">
|
||||
<?php esc_html_e('Start Time', 'duplicator-pro'); ?>
|
||||
</label>
|
||||
<div class="margin-bottom-1" id="start-time-content">
|
||||
<select name="_start_time" class="width-small inline-display margin-0">
|
||||
<?php
|
||||
// Add setting to use 24 hour vs AM/PM the interval for hours is '1'
|
||||
for ($hours = 0; $hours < 24; $hours++) {
|
||||
?>
|
||||
<option <?php selected($hours, $start_hour); ?> value="<?php echo (int) $hours; ?>">
|
||||
<?php echo esc_html(sprintf('%02d:%02d', $hours, $mins)); ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
<i class="dupli-edit-info">
|
||||
<?php esc_html_e("Current Server Time Stamp is", 'duplicator-pro'); ?>
|
||||
<?php echo esc_html(date_i18n('Y-m-d H:i:s')); ?>
|
||||
</i>
|
||||
</div>
|
||||
|
||||
<div class="margin-bottom-1">
|
||||
<p class="description width-xlarge">
|
||||
<?php
|
||||
printf(
|
||||
esc_html_x(
|
||||
'%1$sNote:%2$s Schedules require web site traffic in order to start a build.
|
||||
If you set a start time of 06:00 daily but do not get any traffic till 10:00 then the build will not start until 10:00.
|
||||
If you have low traffic consider setting up a cron job to periodically hit your site.',
|
||||
'%1$s and %2$s represent opening and closing bold tags',
|
||||
'duplicator-pro'
|
||||
),
|
||||
'<b>',
|
||||
'</b>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
Reference in New Issue
Block a user