first commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\RecoveryController;
|
||||
use Duplicator\Package\Recovery\RecoveryPackage;
|
||||
use Duplicator\Views\ViewHelper;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
* @var bool $blur
|
||||
*/
|
||||
|
||||
$blur = $tplData['blur'];
|
||||
|
||||
$recoverPackage = RecoveryPackage::getRecoverPackage();
|
||||
$recoverPackageId = RecoveryPackage::getRecoverPackageId();
|
||||
$recoverablePackages = RecoveryPackage::getRecoverablesPackages();
|
||||
|
||||
?>
|
||||
<h2 class="margin-bottom-0">
|
||||
<?php ViewHelper::disasterIcon(); ?> <?php esc_html_e("Disaster Recovery", 'duplicator-pro'); ?>
|
||||
</h2>
|
||||
<hr/>
|
||||
|
||||
<p class="margin-bottom-1">
|
||||
<?php esc_html_e("Quickly restore this site to a specific Backup in time.", 'duplicator-pro'); ?>
|
||||
<span class="link-style dup-global-help">
|
||||
<?php esc_html_e("Need more help?", 'duplicator-pro'); ?>
|
||||
</span>
|
||||
</p>
|
||||
<div class="dupli-recovery-details-max-width-wrapper <?php echo ($blur ? 'dup-mock-blur' : ''); ?>" >
|
||||
<?php if (RecoveryController::isDisallow()) { ?>
|
||||
<p>
|
||||
<?php esc_html_e("The import function is disabled", 'duplicator-pro'); ?>
|
||||
</p>
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<form id="dupli-recovery-form" method="post">
|
||||
<?php
|
||||
RecoveryController::renderRecoveryWidged([
|
||||
'selector' => true,
|
||||
'subtitle' => '',
|
||||
'copyLink' => true,
|
||||
'copyButton' => true,
|
||||
'launch' => true,
|
||||
'download' => true,
|
||||
'info' => true,
|
||||
]);
|
||||
?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
$tplMng->render('admin_pages/tools/recovery/widget/recovery-widget-scripts');
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
?>
|
||||
<div class="dupli-recovery-message" >
|
||||
<p class="recovery-reset-message-error">
|
||||
<i class="fa fa-exclamation-triangle"></i> <b><?php _e('Recovery Point reset issue!', 'duplicator-pro'); ?></b>
|
||||
<p>
|
||||
<p class="recovery-error-message">
|
||||
<!-- here is set the message received from the server -->
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
?><div class="dupli-recovery-message" >
|
||||
<p class="recovery-reset-message-ok">
|
||||
<?php _e('The Recovery Point has been reset, all previously copied Recovery URLs are no longer valid.', 'duplicator-pro'); ?>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
?>
|
||||
<div class="dupli-recovery-message" >
|
||||
<p class="recovery-set-message-error">
|
||||
<i class="fa fa-exclamation-triangle"></i> <b><?php _e('Recovery Backup Issue Detected!', 'duplicator-pro'); ?></b>
|
||||
<p>
|
||||
<p class="recovery-error-message">
|
||||
<!-- here is set the message received from the server -->
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
printf(
|
||||
_x(
|
||||
'For more information see %1$s[the documentation]%2$s',
|
||||
'%1$s and %2$s represents the opening and closing HTML tags for an anchor or link',
|
||||
'duplicator-pro'
|
||||
),
|
||||
'<a href="' . DUPLICATOR_DUPLICATOR_DOCS_URL . 'how-to-handle-recovery-install-setup-launch-issues" target="_blank">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
?>
|
||||
<div class="dupli-recovery-message recovery-set-message-ok" >
|
||||
<!-- message from js -->
|
||||
</div>
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Duplicator
|
||||
* @copyright (c) 2022, Snap Creek LLC
|
||||
*/
|
||||
|
||||
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
|
||||
|
||||
use Duplicator\Controllers\RecoveryController;
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
* @var \Duplicator\Package\Recovery\RecoveryPackage $recoverPackage
|
||||
*/
|
||||
|
||||
$recoverPackage = $tplData['recoverPackage'];
|
||||
|
||||
switch ($tplData['viewMode']) {
|
||||
case RecoveryController::VIEW_WIDGET_NO_PACKAGE_SET:
|
||||
?>
|
||||
<div class="dupli-recovery-active-link-header">
|
||||
<i class="fa-solid fa-house-fire main-icon"></i>
|
||||
<div class="main-title">
|
||||
<?php esc_html_e('Disaster Recovery Backup is Not Set', 'duplicator-pro'); ?>
|
||||
</div>
|
||||
<div class="main-subtitle margin-bottom-1">
|
||||
<b><?php esc_html_e('Backup Age:', 'duplicator-pro'); ?></b>
|
||||
<span class="dupli-recovery-status red"><?php _e('not set', 'duplicator-pro'); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="margin-bottom-1">
|
||||
<?php
|
||||
_e(
|
||||
'A Disaster Recovery feature allows one to quickly restore the site to a prior state.
|
||||
To use this, mark a Backup as the Disaster Recovery Backup, then copy and save off the associated Disaster Recovery URL.
|
||||
Then, if a problem occurs, browse to the URL to launch a streamlined installer to quickly restore the site.',
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case RecoveryController::VIEW_WIDGET_NOT_VALID:
|
||||
?>
|
||||
<div class="orangered margin-bottom-1">
|
||||
<?php echo esc_html($tplData['importFailMessage']); ?>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case RecoveryController::VIEW_WIDGET_VALID:
|
||||
?>
|
||||
<div class="dupli-recovery-active-link-wrapper" >
|
||||
<div class="dupli-recovery-active-link-header" >
|
||||
<i class="fas fa-house-fire main-icon"></i>
|
||||
<div class="main-title" >
|
||||
<?php _e('Disaster Recovery Backup is Set', 'duplicator-pro'); ?>
|
||||
</div>
|
||||
<div class="main-subtitle margin-bottom-1" >
|
||||
<b><?php esc_html_e('Backup Age:', 'duplicator-pro'); ?></b>
|
||||
<span class="dupli-recovery-status green">
|
||||
<?php echo $recoverPackage->getPackageLife('human'); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (strlen($tplData['subtitle'])) { ?>
|
||||
<p>
|
||||
<?php echo $tplData['subtitle']; ?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
<?php if ($tplData['displayInfo']) { ?>
|
||||
<div class="dupli-recovery-package-info margin-bottom-1" >
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><?php _e('Name', 'duplicator-pro'); ?>:</td>
|
||||
<td><b><?php echo esc_html($recoverPackage->getPackageName()); ?></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php _e('Date', 'duplicator-pro'); ?>:</td>
|
||||
<td><b><?php echo esc_html($recoverPackage->getCreated()); ?></b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
default:
|
||||
?>
|
||||
<p class="orangered">
|
||||
<?php echo __('Invalid view mode.', 'duplicator-pro'); ?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
use Duplicator\Package\Recovery\RecoveryPackage;
|
||||
use Duplicator\Views\ViewHelper;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
* @var ?Duplicator\Package\Recovery\RecoveryPackage $recoverPackage
|
||||
*/
|
||||
|
||||
$recoverPackage = $tplData['recoverPackage'];
|
||||
$installerLink = ($recoverPackage instanceof RecoveryPackage) ? $recoverPackage->getInstallLink() : '';
|
||||
$disabledClass = empty($installerLink) ? 'disabled' : '';
|
||||
|
||||
if ($tplData['displayCopyLink']) {
|
||||
$toolTipContent = __(
|
||||
'The recovery point URL is the link to the recovery point Backup installer.
|
||||
The link will run the installer wizard used to re-install and recover the site.
|
||||
Copy this link and keep it in a safe location to easily restore this site.',
|
||||
'duplicator-pro'
|
||||
);
|
||||
$toolTipContent .= '<br><br><b>';
|
||||
$toolTipContent .= __('This URL is valid until another recovery point is set.', 'duplicator-pro');
|
||||
$toolTipContent .= '</b>';
|
||||
?>
|
||||
<label>
|
||||
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
|
||||
data-tooltip-title="<?php esc_attr_e("Recovery Point URL", 'duplicator-pro'); ?>"
|
||||
data-tooltip="<?php echo esc_attr($toolTipContent); ?>"
|
||||
>
|
||||
</i>
|
||||
<b><?php _e('Step 2 ', 'duplicator-pro'); ?>:</b> <i><?php _e('Copy Recovery URL & Store in Safe Place', 'duplicator-pro'); ?></i>
|
||||
</label>
|
||||
<div class="copy-link <?php echo $disabledClass; ?>"
|
||||
data-dup-copy-value="<?php echo esc_url($installerLink); ?>"
|
||||
data-dup-copy-title="<?php _e("Copy Recovery URL to clipboard", 'duplicator-pro'); ?>"
|
||||
data-dup-copied-title="<?php _e("Recovery URL copied to clipboard", 'duplicator-pro'); ?>" >
|
||||
<div class="content" >
|
||||
<?php echo empty($installerLink) ? __('Please set the Recovery Point to generate the Recovery URL', 'duplicator-pro') : $installerLink; ?>
|
||||
</div>
|
||||
<i class="far fa-copy copy-icon"></i>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="dupli-recovery-buttons" >
|
||||
<?php
|
||||
if ($tplData['displayLaunch']) { ?>
|
||||
<a href="<?php echo esc_url($installerLink); ?>"
|
||||
class="button primary hollow dupli-launch small <?php echo $disabledClass; ?>" target="_blank"
|
||||
title="<?php _e('Initiates system recovery using the Recovery Point URL.', 'duplicator-pro'); ?>"
|
||||
>
|
||||
<?php ViewHelper::restoreIcon(); ?> <?php _e('Restore Backup', 'duplicator-pro'); ?>
|
||||
</a>
|
||||
<?php
|
||||
}
|
||||
if ($tplData['displayDownload']) {
|
||||
$title = __(
|
||||
'This button downloads a recovery launcher that allows you to perform the recovery with a simple click of the downloaded file.',
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
<button
|
||||
type="button"
|
||||
class="button primary hollow small dupli-recovery-download-launcher <?php echo $disabledClass; ?>"
|
||||
title="<?php echo esc_attr($title); ?>"
|
||||
>
|
||||
<i class="fa fa-rocket" ></i> <?php _e('Download Launcher', 'duplicator-pro'); ?>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
if ($tplData['displayCopyButton']) {
|
||||
?>
|
||||
<button type="button" class="button primary small hollow dupli-recovery-copy-url <?php echo $disabledClass; ?>"
|
||||
data-dup-copy-value="<?php echo $installerLink; ?>"
|
||||
data-dup-copy-title="<?php _e("Copy Recovery URL to clipboard", 'duplicator-pro'); ?>"
|
||||
data-dup-copied-title="<?php _e("Recovery URL copied to clipboard", 'duplicator-pro'); ?>" >
|
||||
<i class="far fa-copy copy-icon"></i> <?php _e('Copy LINK', 'duplicator-pro'); ?>
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
?>
|
||||
<script>
|
||||
DupliJs.Pack.SetRecoveryPoint = function (packageId, callbackOnSuccess, callbackOnError, topHeaderMessage) {
|
||||
topHeaderMessage = (typeof topHeaderMessage !== 'undefined') ? topHeaderMessage : true;
|
||||
|
||||
let okMsgContent = <?php echo json_encode($tplMng->render('admin_pages/tools/recovery/widget/recovery-message-set-ok', [], false)); ?>;
|
||||
let errorMsgContent = <?php echo json_encode($tplMng->render('admin_pages/tools/recovery/widget/recovery-message-set-error', [], false)); ?>;
|
||||
|
||||
DupliJs.Pack.removeRecoveryMessages();
|
||||
DupliJs.Util.ajaxWrapper(
|
||||
{
|
||||
action: 'duplicator_set_recovery',
|
||||
recovery_package: packageId,
|
||||
fromPageTab: <?php echo json_encode(\Duplicator\Core\Controllers\ControllersManager::getUniqueIdOfCurrentPage()); ?>,
|
||||
nonce: '<?php echo wp_create_nonce('duplicator_set_recovery'); ?>'
|
||||
},
|
||||
function (result, data, funcData, textStatus, jqXHR) {
|
||||
if (topHeaderMessage) {
|
||||
DupliJs.addAdminMessage(okMsgContent, 'notice', {
|
||||
updateCallback: function (msgNode) {
|
||||
msgNode.find('.recovery-set-message-ok').html(funcData.adminMessage);
|
||||
DuplicatorTooltip.reload();
|
||||
msgNode.find('.dupli-recovery-download-launcher').click(function () {
|
||||
DupliJs.Pack.downloadLauncher();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof callbackOnSuccess === "function") {
|
||||
callbackOnSuccess(funcData, data, textStatus, jqXHR);
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
function (result, data, funcData, textStatus, jqXHR) {
|
||||
DupliJs.addAdminMessage(errorMsgContent, 'error', {
|
||||
'updateCallback': function (msgNode) {
|
||||
msgNode.find('.recovery-error-message').html(data.message);
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof callbackOnError === "function") {
|
||||
callbackOnError(funcData, data, textStatus, jqXHR);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
DupliJs.Pack.ResetRecoveryPoint = function (callbackOnSuccess) {
|
||||
let okMsgContent = <?php echo json_encode($tplMng->render('admin_pages/tools/recovery/widget/recovery-message-reset-ok', [], false)); ?>;
|
||||
let errorMsgContent = <?php echo json_encode($tplMng->render('admin_pages/tools/recovery/widget/recovery-message-reset-error', [], false)); ?>;
|
||||
|
||||
DupliJs.Pack.removeRecoveryMessages();
|
||||
DupliJs.Util.ajaxWrapper(
|
||||
{
|
||||
action: 'duplicator_reset_recovery',
|
||||
nonce: '<?php echo wp_create_nonce('duplicator_reset_recovery'); ?>',
|
||||
fromPageTab: <?php echo json_encode(\Duplicator\Core\Controllers\ControllersManager::getUniqueIdOfCurrentPage()); ?>,
|
||||
},
|
||||
function (result, data, funcData, textStatus, jqXHR) {
|
||||
DupliJs.addAdminMessage(okMsgContent, 'notice');
|
||||
|
||||
if (typeof callbackOnSuccess === "function") {
|
||||
callbackOnSuccess(funcData, data, textStatus, jqXHR);
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
function (result, data, funcData, textStatus, jqXHR) {
|
||||
DupliJs.addAdminMessage(errorMsgContent, 'error', {
|
||||
'updateCallback': function (msgNode) {
|
||||
msgNode.find('.recovery-error-message').html(data.message);
|
||||
}
|
||||
});
|
||||
return '';
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
DupliJs.Pack.UpdatgeRecoveryWidget = function (callbackOnSuccess) {
|
||||
let okMsgContent = <?php echo json_encode($tplMng->render('admin_pages/tools/recovery/widget/recovery-message-reset-ok', [], false)); ?>;
|
||||
let errorMsgContent = <?php echo json_encode($tplMng->render('admin_pages/tools/recovery/widget/recovery-message-reset-error', [], false)); ?>;
|
||||
|
||||
DupliJs.Pack.removeRecoveryMessages();
|
||||
DupliJs.Util.ajaxWrapper(
|
||||
{
|
||||
action: 'duplicator_get_recovery_widget',
|
||||
nonce: '<?php echo wp_create_nonce('duplicator_get_recovery_widget'); ?>',
|
||||
fromPageTab: <?php echo json_encode(\Duplicator\Core\Controllers\ControllersManager::getUniqueIdOfCurrentPage()); ?>,
|
||||
},
|
||||
function (result, data, funcData, textStatus, jqXHR) {
|
||||
if (typeof callbackOnSuccess === "function") {
|
||||
callbackOnSuccess(funcData, data, textStatus, jqXHR);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
function (result, data, funcData, textStatus, jqXHR) {
|
||||
return <?php json_encode(__('Can\'t update recovery widget', 'duplicator-pro')); ?>;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
DupliJs.Pack.removeRecoveryMessages = function () {
|
||||
jQuery('#wpcontent .dupli-recovery-message').closest('.notice').remove();
|
||||
};
|
||||
|
||||
DupliJs.Pack.SetRecoveryPackageDetails = function (wrapper, details, setColor) {
|
||||
const setDelayAnimation = 1000;
|
||||
const setDurationAnimationStart = 500;
|
||||
const setDurationAnimationEnd = 1000;
|
||||
|
||||
let newDetails = jQuery(details);
|
||||
wrapper.replaceWith(newDetails);
|
||||
wrapper = newDetails;
|
||||
|
||||
wrapper.closest('.dupli-import-box').find('.box-title .badge').each(function () {
|
||||
if (wrapper.find('.dupli-recovery-active-link-header .dupli-recovery-status').hasClass('green')) {
|
||||
jQuery(this).removeClass('badge-warn').addClass('badge-pass').text('<?php echo esc_js(__('Good', 'duplicator-pro')) ?>');
|
||||
} else {
|
||||
jQuery(this).removeClass('badge-pass').addClass('badge-warn').text('<?php echo esc_js(__('Notice', 'duplicator-pro')) ?>');
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.find('.dupli-recovery-point-selector-area select, .dupli-recovery-point-actions .copy-link')
|
||||
.stop()
|
||||
.animate({
|
||||
backgroundColor: setColor
|
||||
}, setDurationAnimationStart)
|
||||
.delay(setDelayAnimation)
|
||||
.animate({
|
||||
backgroundColor: "transparent"
|
||||
}, setDurationAnimationEnd);
|
||||
|
||||
wrapper.find('.dupli-recovery-point-details')
|
||||
.stop()
|
||||
.css({
|
||||
'outline': '5px solid transparent',
|
||||
'outline-offset': '5px'
|
||||
})
|
||||
.animate({
|
||||
outlineColor: setColor
|
||||
}, setDurationAnimationStart)
|
||||
.delay(setDelayAnimation)
|
||||
.animate({
|
||||
outlineColor: "transparent",
|
||||
'outline-width': '0',
|
||||
'outline-offset': '0'
|
||||
}, setDurationAnimationEnd);
|
||||
|
||||
DupliJs.Pack.initRecoveryWidget(wrapper);
|
||||
};
|
||||
|
||||
DupliJs.Pack.downloadLauncher = function () {
|
||||
DupliJs.Util.ajaxWrapper(
|
||||
{
|
||||
action: 'duplicator_disaster_launcher_download',
|
||||
nonce: '<?php echo wp_create_nonce('duplicator_disaster_launcher_download'); ?>'
|
||||
},
|
||||
function (result, data, funcData, textStatus, jqXHR) {
|
||||
if (funcData.success) {
|
||||
DupliJs.downloadContentAsfile(funcData.fileName, funcData.fileContent, 'text/html');
|
||||
} else {
|
||||
DupliJs.addAdminMessage(funcData.message, 'error');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
DupliJs.Pack.initRecoveryWidget = function (widgetWrapper) {
|
||||
widgetWrapper.find('.recovery-reset').off().click(function () {
|
||||
DupliJs.Pack.ResetRecoveryPoint(function (funcData, data, textStatus, jqXHR) {
|
||||
widgetWrapper.find('.recovery-select').val('');
|
||||
DupliJs.Pack.SetRecoveryPackageDetails(widgetWrapper, funcData.packageDetails, '#e1f5c1');
|
||||
});
|
||||
});
|
||||
|
||||
widgetWrapper.find('.recovery-set').off().click(function () {
|
||||
let packageId = widgetWrapper.find('.recovery-select').val();
|
||||
if (!packageId) {
|
||||
DupliJs.Pack.ResetRecoveryPoint(function (funcData, data, textStatus, jqXHR) {
|
||||
DupliJs.Pack.SetRecoveryPackageDetails(widgetWrapper, funcData.packageDetails, '#e1f5c1');
|
||||
});
|
||||
} else {
|
||||
DupliJs.Pack.SetRecoveryPoint(packageId,
|
||||
function (funcData, data, textStatus, jqXHR) {
|
||||
DupliJs.Pack.SetRecoveryPackageDetails(widgetWrapper, funcData.packageDetails, '#e1f5c1');
|
||||
},
|
||||
function (funcData, data, textStatus, jqXHR) {
|
||||
widgetWrapper.find('.recovery-select').val('');
|
||||
DupliJs.Pack.SetRecoveryPackageDetails(widgetWrapper, '<p class="red" >' + data.message + '</span>', '#fcc3bd');
|
||||
},
|
||||
false);
|
||||
}
|
||||
});
|
||||
|
||||
DuplicatorTooltip.reload();
|
||||
|
||||
widgetWrapper.find('.dupli-recovery-windget-refresh').off().click(function () {
|
||||
DupliJs.Pack.UpdatgeRecoveryWidget(function (funcData, data, textStatus, jqXHR) {
|
||||
DupliJs.Pack.SetRecoveryPackageDetails(widgetWrapper, funcData.widget, '#e1f5c1');
|
||||
});
|
||||
});
|
||||
|
||||
widgetWrapper.find('.dupli-recovery-download-launcher').off().click(function () {
|
||||
DupliJs.Pack.downloadLauncher();
|
||||
});
|
||||
};
|
||||
|
||||
jQuery(document).ready(function ($)
|
||||
{
|
||||
$('.dupli-recovery-widget-wrapper').each(function () {
|
||||
let widgetWrapper = jQuery(this);
|
||||
DupliJs.Pack.initRecoveryWidget(widgetWrapper);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\PackagesPageController;
|
||||
use Duplicator\Core\CapMng;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
* @var Duplicator\Package\Recovery\RecoveryPackage $recoverPackage
|
||||
*/
|
||||
$recoverPackage = $tplData['recoverPackage'];
|
||||
$packagesURL = PackagesPageController::getInstance()->getPageUrl();
|
||||
?>
|
||||
<div class="dupli-recovery-point-selector">
|
||||
<?php if (empty($tplData['recoverablePackages'])) { ?>
|
||||
<div class="dupli-notice-details">
|
||||
<div class="margin-bottom-1" >
|
||||
<b><?php _e('Would you like to create a Recovery Point before running this import?', 'duplicator-pro'); ?></b>
|
||||
</div>
|
||||
<b><?php _e('How to create:', 'duplicator-pro'); ?></b>
|
||||
<ol class="dupli-simple-style-list" >
|
||||
<li>
|
||||
<?php
|
||||
printf(
|
||||
esc_html_x(
|
||||
'Open the %1$sBackups screen%2$s and create a valid recovery Backup.',
|
||||
'1 and 2 are opening and closing anchor or link tags',
|
||||
'duplicator-pro'
|
||||
),
|
||||
'<a href="' . esc_url($packagesURL) . '" target="_blank">',
|
||||
'</a><i class="fas fa-external-link-alt fa-small" ></i>'
|
||||
);
|
||||
?>
|
||||
</li>
|
||||
<li>
|
||||
<?php _e('On the Backups screen click the Backup\'s Hamburger menu and select "Set Recovery Point".', 'duplicator-pro'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<?php
|
||||
printf(
|
||||
esc_html_x(
|
||||
'%1$sRefresh%2$s this page to show and choose the recovery point.',
|
||||
'1 and 2 are opening and closing span tags',
|
||||
'duplicator-pro'
|
||||
),
|
||||
'<span class="dupli-recovery-windget-refresh link-style">',
|
||||
'</span>'
|
||||
);
|
||||
?>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
<?php } else {
|
||||
$tooltipContent = __(
|
||||
'A Recovery Point allows one to quickly restore the site to a prior state.
|
||||
To use this, mark a Backup as the Recovery Point, then copy and save off the associated URL.
|
||||
Then, if a problem occurs, browse to the URL to launch a streamlined installer to quickly restore the site.',
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
<div class="dupli-recovery-point-selector-area-wrapper" >
|
||||
<?php if (CapMng::can(CapMng::CAP_CREATE, false)) { ?>
|
||||
<span class="dupli-opening-packages-windows" >
|
||||
<a href="<?php echo esc_url($packagesURL); ?>" >[<?php _e('Create New', 'duplicator-pro'); ?>]</a>
|
||||
</span>
|
||||
<?php } ?>
|
||||
<label>
|
||||
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
|
||||
data-tooltip-title="<?php esc_attr_e("Choose Recovery Point Archive", 'duplicator-pro'); ?>"
|
||||
data-tooltip="<?php echo esc_attr($tooltipContent); ?>">
|
||||
</i>
|
||||
<b><?php _e('Step 1 ', 'duplicator-pro'); ?>:</b> <i><?php _e('Choose Recovery Point Archive', 'duplicator-pro'); ?></i>
|
||||
</label>
|
||||
<div class="dupli-recovery-point-selector-area">
|
||||
<select class="recovery-select" name="recovery_package" >
|
||||
<option value=""> -- <?php _e('Not selected', 'duplicator-pro'); ?> -- </option>
|
||||
<?php
|
||||
$currentDay = null;
|
||||
foreach ($tplData['recoverablePackages'] as $package) {
|
||||
$packageDay = date("Y/m/d", strtotime($package['created']));
|
||||
if ($packageDay != $currentDay) {
|
||||
if (!is_null($currentDay)) {
|
||||
?>
|
||||
</optgroup>
|
||||
<?php } ?>
|
||||
<optgroup label="<?php echo esc_attr($packageDay); ?>">
|
||||
<?php
|
||||
$currentDay = $packageDay;
|
||||
}
|
||||
?>
|
||||
<option value="<?php echo $package['id']; ?>" <?php selected($tplData['recoverPackageId'], $package['id']) ?>>
|
||||
<?php echo '[' . $package['created'] . '] ' . $package['name']; ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</optgroup>
|
||||
</select>
|
||||
<button type="button" class="button secondary hollow small recovery-reset" ><?php echo _e('Reset', 'duplicator-pro'); ?></button>
|
||||
<button type="button" class="button primary small recovery-set" ><?php echo _e('Set', 'duplicator-pro'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
?>
|
||||
<div class="dupli-recovery-widget-wrapper" >
|
||||
<?php if ($tplData['displayDetails']) { ?>
|
||||
<div class="dupli-recovery-point-details margin-bottom-1">
|
||||
<?php $tplMng->render('admin_pages/tools/recovery/widget/recovery-widget-details', $tplData); ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if ($tplData['selector']) {
|
||||
$tplMng->render('admin_pages/tools/recovery/widget/recovery-widget-selector', $tplData);
|
||||
} ?>
|
||||
<div class="dupli-recovery-point-actions">
|
||||
<?php if ($tplData['recoverablePackages']) {
|
||||
$tplMng->render('admin_pages/tools/recovery/widget/recovery-widget-link-actions', $tplData);
|
||||
} ?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user