first commit
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
use Duplicator\Addons\ProBase\License\License;
|
||||
use Duplicator\Libs\WpUtils\WpUtilsMultisite;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
if (!is_multisite()) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="filter-mu-tab-content <?php echo (License::can(License::CAPABILITY_MULTISITE_PLUS) ? '' : 'disabled'); ?>">
|
||||
<div style="max-width:900px">
|
||||
<?php if (!License::can(License::CAPABILITY_MULTISITE_PLUS)) { ?>
|
||||
<div class="dupli-panel-optional-txt alert-disabled" style="text-align: center">
|
||||
<b><?php esc_html_e("Notice:", 'duplicator-pro'); ?></b>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__(
|
||||
'This option isn\'t available at the %1$s license level.',
|
||||
'duplicator-pro'
|
||||
),
|
||||
esc_html(License::getLicenseToString())
|
||||
);
|
||||
?>
|
||||
<br>
|
||||
<?php
|
||||
printf(
|
||||
esc_html_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>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php
|
||||
echo '<b>' . esc_html__("Overview:", 'duplicator-pro') . '</b><br/>';
|
||||
esc_html_e(
|
||||
"When you want to move a full multisite network or convert a subsite to a standalone site just
|
||||
create a standard Backup like you would with a single site.
|
||||
Then browse to the installer and choose either 'Restore entire multisite network' or 'Convert subsite into a standalone site'.
|
||||
These options will be present on Step 1 of the installer when restoring a Multisite Backup.",
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<table class="mu-opts">
|
||||
<tr>
|
||||
<td>
|
||||
<b><?php esc_html_e("Included Sub-Sites", 'duplicator-pro'); ?>:</b><br />
|
||||
<select name="mu-include[]" id="mu-include" multiple="true" class="mu-selector">
|
||||
<?php
|
||||
$subsites = License::can(License::CAPABILITY_MULTISITE_PLUS) ? WpUtilsMultisite::getSubsites() : [];
|
||||
foreach ($subsites as $site) {
|
||||
echo "<option value='" . (int) $site->id . "'>" . esc_html($site->domain . $site->path) . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" id="mu-exclude-btn" class="mu-push-btn"><i class="fa fa-chevron-right"></i></button>
|
||||
<br />
|
||||
<button type="button" id="mu-include-btn" class="mu-push-btn"><i class="fa fa-chevron-left"></i></button>
|
||||
</td>
|
||||
<td>
|
||||
<b><?php esc_html_e("Excluded Sub-Sites", 'duplicator-pro'); ?>:</b><br />
|
||||
<select name="mu-exclude[]" id="mu-exclude" multiple="true" class="mu-selector"></select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="dupli-panel-optional-txt" style="text-align: left">
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__(
|
||||
"<u><b>Important:</b></u> Full network restoration is an installer option only if you include <b>all</b> subsites.
|
||||
If any subsites are filtered then you may only restore individual subsites as standalones sites at install-time.",
|
||||
'duplicator-pro'
|
||||
),
|
||||
[
|
||||
'b' => [],
|
||||
'u' => [],
|
||||
]
|
||||
);
|
||||
?>
|
||||
<br />
|
||||
<br />
|
||||
<?php
|
||||
esc_html_e(
|
||||
"This section allows you to control which sub-sites of a multisite network you want to include within your Backup.
|
||||
The 'Included Sub-Sites' will also be available to choose from at install time.",
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
<br />
|
||||
<?php
|
||||
esc_html_e(
|
||||
"By default all Backups are included. The ability to exclude sub-sites are intended to help shrink your Backup if needed.",
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
use Duplicator\Package\NameFormat;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
$nameFormat = $tplData['nameFormat'];
|
||||
$notes = $tplData['notes'];
|
||||
|
||||
$helpContent = $tplMng->render('admin_pages/packages/setup/name-format-help', [], false);
|
||||
?>
|
||||
|
||||
<div>
|
||||
<label for="package-name-format" class="lbl-larger large">
|
||||
<?php esc_html_e('Backup Name Format', 'duplicator-pro') ?>:
|
||||
</label>
|
||||
<i
|
||||
class="fa-solid fa-question-circle fa-sm dark-gray-color"
|
||||
data-tooltip-title="<?php esc_attr_e("Backup name format", 'duplicator-pro'); ?>"
|
||||
data-tooltip="<?php echo esc_attr($helpContent); ?>"
|
||||
data-tooltip-width="400"
|
||||
></i>
|
||||
|
||||
<div class="dup-notes-add">
|
||||
<button
|
||||
type="button"
|
||||
onClick="jQuery('#dup-notes-area').toggle()"
|
||||
class="clear button gray xtiny margin-bottom-0"
|
||||
title="<?php esc_attr_e('Add Notes', 'duplicator-pro') ?>"
|
||||
>
|
||||
<i class="far fa-edit"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="display-flex" >
|
||||
<input
|
||||
type="text"
|
||||
id="package-name-format"
|
||||
name="package_name_format"
|
||||
class="margin-0"
|
||||
data-parsley-errors-container="#template_package_name_error_container"
|
||||
data-parsley-required="true"
|
||||
value="<?php echo esc_attr($nameFormat); ?>"
|
||||
autocomplete="off"
|
||||
>
|
||||
<select class="dup-format-name-tags width-medium margin-left-1 margin-0 secondary-color secondary-border-color" >
|
||||
<option value="" selected >
|
||||
<?php esc_html_e('Dynamic Tags', 'duplicator-pro') ?>
|
||||
</option>
|
||||
<?php foreach (NameFormat::FORMATS as $format) { ?>
|
||||
<option value="%<?php echo esc_attr($format); ?>%">
|
||||
%<?php echo esc_html($format); ?>%
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div id="template_package_name_error_container" class="duplicator-error-container"></div>
|
||||
|
||||
<div id="dup-notes-area">
|
||||
<label class="lbl-larger large">
|
||||
<?php esc_html_e('Notes', 'duplicator-pro') ?>:
|
||||
</label><br/>
|
||||
<textarea
|
||||
id="package-notes"
|
||||
name="package-notes"
|
||||
maxlength="300"
|
||||
><?php echo esc_html($notes); ?></textarea>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function($) {
|
||||
$('.dup-format-name-tags').change(function(e) {
|
||||
e.stopPropagation();
|
||||
|
||||
if ($(this).val() === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
let input = $('#package-name-format');
|
||||
let currentValue = input.val();
|
||||
let newValue = currentValue + $(this).val();
|
||||
input.val(newValue);
|
||||
|
||||
$(this).val('');
|
||||
});
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
use Duplicator\Package\NameFormat;
|
||||
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
|
||||
*/
|
||||
|
||||
?>
|
||||
<p>
|
||||
<?php esc_html_e(
|
||||
'It is possible to customize the name of the backups using a fixed part and dynamic parts through tags.
|
||||
The available tags are as follows:',
|
||||
'duplicator-pro'
|
||||
); ?>
|
||||
|
||||
<ul>
|
||||
<?php foreach (NameFormat::getTagsDescriptions() as $tag => $description) : ?>
|
||||
<li>
|
||||
<strong>%<?php echo esc_html($tag); ?>%</strong> - <?php echo esc_html($description); ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
__(
|
||||
'Important: <b>Backup date and time expressed in UTC</b> (Coordinated Universal Time).
|
||||
The displayed date corresponds to the server\'s international time, independent of local time zones.',
|
||||
'duplicator-pro'
|
||||
),
|
||||
ViewHelper::GEN_KSES_TAGS
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php esc_html_e(
|
||||
'Here are some examples of name formats:',
|
||||
'duplicator-pro'
|
||||
); ?>
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<strong>%year%%month%%day%_%sitetitle%</strong> -
|
||||
<?php esc_html_e('Backup name with date and site title (\'It\'s the default)', 'duplicator-pro'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<strong>%year%%month%%day%_%hour%%minute%%second%_mytext_</strong> -
|
||||
<?php esc_html_e('Backup name with date and time and fixed text', 'duplicator-pro'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<strong>%year%%month%%day%_%schedulename%</strong> -
|
||||
<?php esc_html_e('Backup name with date and schedule name', 'duplicator-pro'); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
@@ -0,0 +1,265 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
use Duplicator\Controllers\ToolsPageController;
|
||||
use Duplicator\Core\MigrationMng;
|
||||
use Duplicator\Libs\Snap\FunctionalityCheck;
|
||||
use Duplicator\Libs\WpUtils\WpArchiveUtils;
|
||||
use Duplicator\Libs\WpUtils\WpDbUtils;
|
||||
use Duplicator\Package\BuildRequirements;
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string,mixed> $tplData
|
||||
* @var array<string,mixed> $requirements
|
||||
*/
|
||||
$requirements = $tplData['requirements'];
|
||||
|
||||
if ($requirements['Success']) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="dup-box dup-requirements-wrapper">
|
||||
<div class="dup-box-title">
|
||||
<i class="far fa-check-circle"></i>
|
||||
<?php esc_html_e("Requirements:", 'duplicator-pro'); ?> <div class="dup-sys-fail">Fail</div>
|
||||
<button class="dup-box-arrow">
|
||||
<span class="screen-reader-text">
|
||||
<?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Requirements:', 'duplicator-pro') ?>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dup-box-panel">
|
||||
<div class="dup-sys-section">
|
||||
<i><?php esc_html_e("System requirements must pass for the Duplicator to work properly. Click each link for details.", 'duplicator-pro'); ?></i>
|
||||
</div>
|
||||
|
||||
<!-- PHP SUPPORT -->
|
||||
<div class='dup-sys-req'>
|
||||
<div class='dup-sys-title'>
|
||||
<a><?php esc_html_e('PHP Support', 'duplicator-pro'); ?></a>
|
||||
<div><?php echo esc_html($requirements['PHP']['ALL']); ?></div>
|
||||
</div>
|
||||
<div class="dup-sys-info dup-info-box">
|
||||
<table class="dup-sys-info-results">
|
||||
<tr>
|
||||
<td>
|
||||
<?php esc_html_e('PHP Version', 'duplicator-pro'); ?> [<?php echo esc_html(phpversion()); ?>]
|
||||
</td>
|
||||
<td><?php echo esc_html($requirements['PHP']['VERSION']); ?></td>
|
||||
</tr>
|
||||
<?php foreach (BuildRequirements::getFunctionalitiesCheckList() as $func) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
switch ($func->getType()) {
|
||||
case FunctionalityCheck::TYPE_FUNCTION:
|
||||
esc_html_e('Function', 'duplicator-pro');
|
||||
break;
|
||||
case FunctionalityCheck::TYPE_CLASS:
|
||||
esc_html_e('Class', 'duplicator-pro');
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Invalid item type');
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo esc_url($func->link); ?>" target="_blank">
|
||||
<?php echo esc_html($func->getItemKey()); ?>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($func->check()) {
|
||||
echo esc_html_e('Pass', 'duplicator-pro');
|
||||
} elseif ($func->isRequired()) {
|
||||
echo esc_html_e('Fail', 'duplicator-pro');
|
||||
} else {
|
||||
echo esc_html_e('Warning', 'duplicator-pro');
|
||||
}
|
||||
if (strlen($func->troubleshoot) > 0) {
|
||||
echo ' ';
|
||||
echo wp_kses(
|
||||
$func->troubleshoot,
|
||||
[
|
||||
'a' => [
|
||||
'href' => [],
|
||||
'target' => [],
|
||||
],
|
||||
'i' => [
|
||||
'class' => [],
|
||||
'style' => [],
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<small>
|
||||
<?php
|
||||
printf(
|
||||
esc_html__(
|
||||
"PHP versions %s+ including the listed functions are required for the plugin to create a Backup.
|
||||
For additional information see our online technical FAQs.",
|
||||
'duplicator-pro'
|
||||
),
|
||||
esc_html(DUPLICATOR_PRO_PHP_MINIMUM_VERSION)
|
||||
);
|
||||
?>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PERMISSIONS -->
|
||||
<div class='dup-sys-req'>
|
||||
<div class='dup-sys-title'>
|
||||
<a><?php esc_html_e('Permissions', 'duplicator-pro'); ?></a>
|
||||
<div><?php echo esc_html($requirements['IO']['ALL']); ?></div>
|
||||
</div>
|
||||
<div class="dup-sys-info dup-info-box">
|
||||
<b><?php esc_html_e("Required Paths", 'duplicator-pro'); ?></b>
|
||||
<div style="padding:3px 0px 0px 15px">
|
||||
<?php
|
||||
printf("<b>%s</b> [%s] <br/>", esc_html($requirements['IO']['WPROOT']), esc_html(WpArchiveUtils::getArchiveListPaths('home')));
|
||||
printf("<b>%s</b> [%s] <br/>", esc_html($requirements['IO']['SSDIR']), esc_html(DUPLICATOR_SSDIR_PATH));
|
||||
printf("<b>%s</b> [%s] <br/>", esc_html($requirements['IO']['SSTMP']), esc_html(DUPLICATOR_SSDIR_PATH_TMP));
|
||||
?>
|
||||
</div>
|
||||
|
||||
<small>
|
||||
<?php
|
||||
esc_html_e(
|
||||
"Permissions can be difficult to resolve on some systems. If the plugin can not read the above paths here
|
||||
are a few things to try. 1) Set the above paths to have permissions of 755 for directories and 644 for files.
|
||||
You can temporarily try 777 however, be sure you don’t leave them this way.
|
||||
2) Check the owner/group settings for both files and directories.
|
||||
The PHP script owner and the process owner are different. The script owner owns the PHP script but the process owner
|
||||
is the user the script is running as, thus determining its capabilities/privileges in the file system.
|
||||
For more details contact your host or server administrator or visit the 'Help' menu under Duplicator for additional online resources.",
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SERVER SUPPORT -->
|
||||
<div class='dup-sys-req'>
|
||||
<div class='dup-sys-title'>
|
||||
<a><?php esc_html_e('Server Support', 'duplicator-pro'); ?></a>
|
||||
<div><?php echo esc_html($requirements['SRV']['ALL']); ?></div>
|
||||
</div>
|
||||
<div class="dup-sys-info dup-info-box">
|
||||
<table class="dup-sys-info-results">
|
||||
<tr>
|
||||
<td><?php printf("%s [%s]", esc_html__("MySQL Version", 'duplicator-pro'), esc_html(WpDbUtils::getVersion())); ?></td>
|
||||
<td><?php echo esc_html($requirements['SRV']['MYSQL_VER']); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<small>
|
||||
<?php esc_html_e(
|
||||
"MySQL version 5.0+ or better is required. Contact your server administrator and request MySQL Server 5.0+ be installed.",
|
||||
'duplicator-pro'
|
||||
); ?>
|
||||
</small>
|
||||
<hr>
|
||||
<table class="dup-sys-info-results">
|
||||
<tr>
|
||||
<td><a href="https://www.php.net/manual/en/mysqli.real-escape-string.php" target="_blank">mysqli_real_escape_string</a></td>
|
||||
<td><?php echo esc_html($requirements['SRV']['MYSQL_ESC']); ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<small>
|
||||
<?php esc_html_e(
|
||||
"The function mysqli_real_escape_string is not working properly.
|
||||
Please consult host support and ask them to switch to a different PHP version or configuration.",
|
||||
'duplicator-pro'
|
||||
); ?>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- INSTALLATION FILES -->
|
||||
<div class='dup-sys-req'>
|
||||
<div class='dup-sys-title'>
|
||||
<a><?php esc_html_e('Installation Files', 'duplicator-pro'); ?></a>
|
||||
<div><?php echo esc_html($requirements['RES']['INSTALL']); ?></div>
|
||||
</div>
|
||||
<div class="dup-sys-info dup-info-box">
|
||||
<?php
|
||||
if ($requirements['RES']['INSTALL'] == 'Pass') :
|
||||
esc_html_e("No reserved installation files were found from a previous install. You are clear to create a new Backup.", 'duplicator-pro');
|
||||
else :
|
||||
?>
|
||||
<form method="post" action="<?php echo esc_url(ToolsPageController::getInstance()->getCleanFilesAcrtionUrl()); ?>">
|
||||
<?php
|
||||
esc_html_e(
|
||||
"An installer file(s) was found in the WordPress root directory.
|
||||
To archive your data correctly please remove any of these files and try creating your Backup again.",
|
||||
'duplicator-pro'
|
||||
);
|
||||
?><br />
|
||||
<b><?php esc_html_e('Installer file names include', 'duplicator-pro'); ?></b>
|
||||
<ul>
|
||||
<?php foreach (MigrationMng::checkInstallerFilesList() as $filePath) { ?>
|
||||
<li>
|
||||
<?php echo esc_html($filePath); ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<input
|
||||
type='submit'
|
||||
class='button action'
|
||||
value='<?php esc_attr_e('Remove Files Now', 'duplicator-pro') ?>'
|
||||
style='font-size:10px; margin-top:5px;'>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ONLINE SUPPORT -->
|
||||
<div class="dup-sys-contact">
|
||||
<?php
|
||||
printf(
|
||||
"<i class='fa fa-question-circle'></i> %s <a href='" . esc_attr(DUPLICATOR_TECH_FAQ_URL) . "' target='_blank'>[%s]</a>",
|
||||
esc_html__("For additional help please see the ", 'duplicator-pro'),
|
||||
esc_html__("online FAQs", 'duplicator-pro')
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
//INIT
|
||||
jQuery(document).ready(function($) {
|
||||
DupliJs.Pack.ToggleSystemDetails = function(anchor) {
|
||||
$(anchor).parent().siblings('.dup-sys-info').toggle();
|
||||
}
|
||||
|
||||
//Init: Toogle for system requirment detial links
|
||||
$('.dup-sys-title a').each(function() {
|
||||
$(this).attr('href', 'javascript:void(0)');
|
||||
$(this).click(function() {
|
||||
DupliJs.Pack.ToggleSystemDetails(this);
|
||||
});
|
||||
$(this).prepend("<span class='ui-icon ui-icon-triangle-1-e dup-toggle' />");
|
||||
});
|
||||
|
||||
//Init: Color code Pass/Fail/Warn items
|
||||
$('.dup-sys-title div').each(function() {
|
||||
$(this).addClass(($(this).text() == 'Pass') ? 'dup-sys-pass' : 'dup-sys-fail');
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
use Duplicator\Views\UI\UiViewState;
|
||||
use Duplicator\Models\GlobalEntity;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
|
||||
$global = GlobalEntity::getInstance();
|
||||
$boxOpened = UiViewState::getValue('dup-pack-storage-panel');
|
||||
?>
|
||||
<div class="dup-box" id="dup-pack-storage-panel-area">
|
||||
<div class="dup-box-title" id="dupli-store-title">
|
||||
<i class="fas fa-server fa-sm"></i>
|
||||
<?php esc_html_e('Storage', 'duplicator-pro') ?> <sup id="dupli-storage-title-count" class="dup-box-title-badge"></sup>
|
||||
<button class="dup-box-arrow">
|
||||
<span class="screen-reader-text">
|
||||
<?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Storage Options', 'duplicator-pro') ?>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="dup-pack-storage-panel" class="dup-box-panel <?php echo ($boxOpened ? '' : 'no-display'); ?>">
|
||||
<p>
|
||||
<?php esc_html_e('Choose the storage location(s) where the Backup and Installer files will be saved.', 'duplicator-pro') ?>
|
||||
</p>
|
||||
<?php $tplMng->render(
|
||||
'parts/storage/select_list',
|
||||
[
|
||||
'selectedStorageIds' => $global->getManualModeStorageIds(),
|
||||
'recoveryPointMsg' => true,
|
||||
]
|
||||
); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
DupliJs.Pack.UpdateStorageCount = function() {
|
||||
var store_count = $('#dup-pack-storage-panel input[name="_storage_ids[]"]:checked').length;
|
||||
$('#dupli-storage-title-count').html('(' + store_count + ')');
|
||||
(store_count == 0) ?
|
||||
$('#dupli-storage-title-count').css({
|
||||
'color': 'red',
|
||||
'font-weight': 'bold'
|
||||
}): $('#dupli-storage-title-count').css({
|
||||
'color': '#444',
|
||||
'font-weight': 'normal'
|
||||
});
|
||||
}
|
||||
|
||||
$('#dup-pack-storage-panel input[name="_storage_ids[]"]').on('change', function() {
|
||||
DupliJs.Pack.UpdateStorageCount();
|
||||
});
|
||||
});
|
||||
|
||||
//INIT
|
||||
jQuery(document).ready(function($) {
|
||||
DupliJs.Pack.UpdateStorageCount();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
echo esc_html(
|
||||
__('When enabled the archive file will be encrypted with a password that is required to open.', 'duplicator-pro') . ' ' .
|
||||
__('The installer will also prompt for the password at install time.', 'duplicator-pro') . ' ' .
|
||||
__('Encryption is a general deterrent and should not be substituted for properly keeping your files secure.', 'duplicator-pro') . ' ' .
|
||||
__('Be sure to remove all installer files when the install process is completed.', 'duplicator-pro')
|
||||
);
|
||||
?>
|
||||
<ul>
|
||||
<li>
|
||||
<b>
|
||||
<?php esc_html_e('None:', 'duplicator-pro'); ?>
|
||||
</b>
|
||||
<?php esc_html_e(
|
||||
"No protection system activated! The installer or archive files can be accessed by any resource that knows the full URL to either file.",
|
||||
'duplicator-pro'
|
||||
); ?>
|
||||
</li>
|
||||
<li>
|
||||
<b>
|
||||
<?php esc_html_e('Installer password:', 'duplicator-pro'); ?>
|
||||
</b>
|
||||
<?php esc_html_e(
|
||||
'The archive is NOT encrypted. When the installer starts, it will prompt for a password to prevent anyone from running the installer.',
|
||||
'duplicator-pro'
|
||||
); ?>
|
||||
</li>
|
||||
<li>
|
||||
<b>
|
||||
<?php esc_html_e('Archive encryption:', 'duplicator-pro'); ?>
|
||||
</b>
|
||||
<?php
|
||||
esc_html_e(
|
||||
'The archive IS encrypted with a password, and the installer will ask for a password when started.',
|
||||
'duplicator-pro'
|
||||
);
|
||||
esc_html_e(
|
||||
'This option is the recommended maximum level of security.',
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -0,0 +1,374 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
use Duplicator\Controllers\PackagesPageController;
|
||||
use Duplicator\Controllers\ToolsPageController;
|
||||
use Duplicator\Libs\WpUtils\WpDbUtils;
|
||||
use Duplicator\Package\PackageUtils;
|
||||
use Duplicator\Models\TemplateEntity;
|
||||
use Duplicator\Views\UI\UiDialog;
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var \Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string,mixed> $tplData
|
||||
* @var array<string,mixed> $requirements
|
||||
*/
|
||||
$requirements = $tplData['requirements'];
|
||||
/** @var bool */
|
||||
$blur = $tplData['blur'];
|
||||
|
||||
$manual_template = TemplateEntity::getManualTemplate();
|
||||
$templates = TemplateEntity::getAll();
|
||||
$default_name1 = PackageUtils::getDefaultPackageName();
|
||||
$default_name2 = PackageUtils::getDefaultPackageName(false);
|
||||
$default_notes = $manual_template->notes;
|
||||
$dbbuild_mode = WpDbUtils::getBuildMode();
|
||||
|
||||
$templatesUrl = ToolsPageController::getInstance()->getMenuLink(ToolsPageController::L2_SLUG_TEMPLATE);
|
||||
$templateEditBaseUrl = ToolsPageController::getTemplateEditURL();
|
||||
|
||||
|
||||
$tplMng->render('admin_pages/packages/setup/section-requirements');
|
||||
$form_action_url = PackagesPageController::getInstance()->getPackageBuildS2Url();
|
||||
?>
|
||||
<form
|
||||
id="dup-form-opts"
|
||||
class="<?php echo ($blur ? 'dup-mock-blur' : ''); ?>"
|
||||
method="post"
|
||||
action="<?php echo esc_attr($form_action_url); ?>"
|
||||
data-parsley-validate data-parsley-ui-enabled="true">
|
||||
<?php $tplMng->getAction(PackagesPageController::ACTION_UPDATE_TEMPLATE)->getActionNonceFileds(); ?>
|
||||
<div class="dupli-general-area">
|
||||
<?php
|
||||
$tplMng->render(
|
||||
'admin_pages/packages/setup/name-format-controls',
|
||||
[
|
||||
'nameFormat' => '',
|
||||
'notes' => '',
|
||||
]
|
||||
);
|
||||
?>
|
||||
<div>
|
||||
<label for="template_id" class="lbl-larger large">
|
||||
<?php esc_html_e('Template', 'duplicator-pro') ?>:
|
||||
</label>
|
||||
<i class="fa-solid fa-question-circle fa-sm dark-gray-color margin-bottom-0"
|
||||
data-tooltip-title="<?php esc_attr_e("Apply Template", 'duplicator-pro'); ?>"
|
||||
data-tooltip="<?php
|
||||
esc_attr_e(
|
||||
'An optional template configuration that can be applied to this backup setup.
|
||||
An [Unassigned] template will retain the settings from the last scan/build.',
|
||||
'duplicator-pro'
|
||||
); ?>">
|
||||
</i>
|
||||
|
||||
<div class="float-right">
|
||||
<a
|
||||
href="<?php echo esc_url($templatesUrl); ?>"
|
||||
class="clear button gray xtiny margin-bottom-0"
|
||||
title="<?php esc_attr_e("List All Templates", 'duplicator-pro') ?>">
|
||||
<i class="fa-regular fa-clone"></i>
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
onclick="DupliJs.Pack.EditTemplate()"
|
||||
class="clear button gray xtiny margin-bottom-0"
|
||||
title="<?php esc_attr_e("Edit Selected Template", 'duplicator-pro') ?>">
|
||||
<i class="fa-solid fa-pen-to-square"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<select
|
||||
data-parsley-ui-enabled="false"
|
||||
onChange="DupliJs.Pack.EnableTemplate();"
|
||||
name="template_id" id="template_id"
|
||||
aria-label="Prefill option with selected template">
|
||||
<option value="<?php echo intval($manual_template->getId()); ?>"><?php echo '[' . esc_html__('Unassigned', 'duplicator-pro') . ']' ?></option>
|
||||
<?php
|
||||
if (count($templates) == 0) {
|
||||
?>
|
||||
<option value="-1">
|
||||
<?php echo esc_html_e('No Templates', 'duplicator-pro'); ?>
|
||||
</option>
|
||||
<?php
|
||||
} else {
|
||||
foreach ($templates as $template) {
|
||||
if ($template->is_manual) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<option value="<?php echo (int) $template->getId(); ?>">
|
||||
<?php echo esc_html($template->name); ?>
|
||||
</option>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$tplMng->render('admin_pages/packages/setup/section_storages');
|
||||
$tplMng->render(
|
||||
'parts/packages/filters/section_filters',
|
||||
[
|
||||
'isTemplateEdit' => false,
|
||||
'template' => null,
|
||||
]
|
||||
);
|
||||
$tplMng->render('parts/packages/filters/section_installer');
|
||||
?>
|
||||
|
||||
<div class="dup-button-footer">
|
||||
<input
|
||||
type="button"
|
||||
value="<?php esc_attr_e("Reset", 'duplicator-pro') ?>"
|
||||
class="button hollow secondary small" <?php echo ($requirements['Success']) ? '' : 'disabled="disabled"'; ?>
|
||||
onClick="DupliJs.Pack.ResetSettings()">
|
||||
<input
|
||||
id="button-next"
|
||||
type="submit"
|
||||
value="<?php esc_attr_e("Next", 'duplicator-pro') ?> ▶"
|
||||
class="button primary small" <?php echo ($requirements['Success']) ? '' : 'disabled="disabled"'; ?>>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- CACHE PROTECTION: If the back-button is used from the scanner page then we need to
|
||||
refresh page in-case any filters where set while on the scanner page -->
|
||||
<form id="cache_detection">
|
||||
<input type="hidden" id="cache_state" name="cache_state" value="" />
|
||||
</form>
|
||||
<?php
|
||||
$confirm1 = new UiDialog();
|
||||
$confirm1->title = __('Would you like to continue', 'duplicator-pro');
|
||||
$confirm1->message = __('This will clear all of the current backup settings.', 'duplicator-pro');
|
||||
$confirm1->progressText = __('Please Wait...', 'duplicator-pro');
|
||||
$confirm1->jsCallback = 'DupliJs.Pack.ResetSettingsRun()';
|
||||
$confirm1->initConfirm();
|
||||
?>
|
||||
<script>
|
||||
jQuery(function($) {
|
||||
var packageTemplates = <?php TemplateEntity::getTemplatesFrontendListData(); ?>
|
||||
|
||||
DupliJs.Pack.BeforeSubmit = function(e) {
|
||||
$('#mu-exclude option').each(function() {
|
||||
$(this).prop('selected', true);
|
||||
});
|
||||
|
||||
DupliJs.Pack.FillExcludeTablesList();
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
$('#dup-form-opts').submit(function() {
|
||||
return DupliJs.Pack.BeforeSubmit();
|
||||
})
|
||||
|
||||
// Template-specific Functions
|
||||
DupliJs.Pack.GetTemplateById = function(templateId) {
|
||||
for (var i = 0; i < packageTemplates.length; i++) {
|
||||
var currentTemplate = packageTemplates[i];
|
||||
if (currentTemplate.id == templateId) {
|
||||
return currentTemplate;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
$.fn.selectOption = function(val) {
|
||||
this.val(val)
|
||||
.find('option')
|
||||
.prop('selected', false)
|
||||
.parent()
|
||||
.find('option[value="' + val + '"]')
|
||||
.prop('selected', true)
|
||||
.parent()
|
||||
.trigger('change');
|
||||
return this;
|
||||
};
|
||||
|
||||
DupliJs.Pack.PopulateCurrentTemplate = function() {
|
||||
var selectedId = $('#template_id').val();
|
||||
var selectedTemplate = DupliJs.Pack.GetTemplateById(selectedId);
|
||||
if (selectedTemplate != null) {
|
||||
let formatInput = $('#package-name-format');
|
||||
formatInput.val(selectedTemplate.package_name_format)
|
||||
if (selectedTemplate.is_manual) {
|
||||
name = '<?php echo esc_js(PackageUtils::getDefaultPackageName()); ?>';
|
||||
}
|
||||
|
||||
$("#package-notes").val(selectedTemplate.notes);
|
||||
|
||||
$("#files-filter-on").prop("checked", selectedTemplate.archive_filter_on);
|
||||
$("#filter-names").prop("checked", selectedTemplate.archive_filter_names);
|
||||
|
||||
//Add trailing slash to directories to differentiate between files and directories
|
||||
let filterDirs = selectedTemplate.archive_filter_dirs.split(';').join(";\n");
|
||||
let filterFiles = selectedTemplate.archive_filter_files.split(';').join(";\n")
|
||||
let separator = filterDirs.length > 0 && filterFiles.length > 0 ? ";\n" : '';
|
||||
|
||||
$("#filter-paths").val(filterDirs + separator + filterFiles);
|
||||
$("#filter-exts").val(selectedTemplate.archive_filter_exts);
|
||||
$("#dbfilter-on").prop("checked", selectedTemplate.database_filter_on);
|
||||
$("#db-prefix-filter").prop("checked", selectedTemplate.databasePrefixFilter);
|
||||
$("#db-prefix-sub-filter").prop("checked", selectedTemplate.databasePrefixSubFilter);
|
||||
|
||||
$(".dup-components-checkbox").each(function(i, component) {
|
||||
$(component).prop("checked", false);
|
||||
});
|
||||
|
||||
selectedTemplate.components.forEach(function(component) {
|
||||
$("#" + component).prop("checked", true);
|
||||
});
|
||||
|
||||
DupliJs.Pack.ToggleDBOnly()
|
||||
DupliJs.Pack.SetComponentsSelect();
|
||||
|
||||
if (typeof selectedTemplate.filter_sites != 'undefined' && selectedTemplate.filter_sites.length > 0) {
|
||||
for (var i = 0; i < selectedTemplate.filter_sites.length; i++) {
|
||||
var site_id = selectedTemplate.filter_sites[i];
|
||||
var exclude_option = $('#mu-include').find("option[value=" + site_id + "]").first();
|
||||
console.log(exclude_option.html());
|
||||
$("#mu-exclude").append(exclude_option.clone());
|
||||
exclude_option.remove();
|
||||
}
|
||||
}
|
||||
|
||||
//-- cPanel
|
||||
$("#cpnl-enable").prop("checked", selectedTemplate.installer_opts_cpnl_enable);
|
||||
$("#cpnl-host").val(selectedTemplate.installer_opts_cpnl_host);
|
||||
$("#cpnl-user").val(selectedTemplate.installer_opts_cpnl_user);
|
||||
|
||||
$('.secure-on-input-wrapper input').prop("checked", false);
|
||||
$('.secure-on-input-wrapper input[value=' + selectedTemplate.installer_opts_secure_on + ']:enabled').prop("checked", true);
|
||||
$("#skipscan").prop("checked", selectedTemplate.installer_opts_skip_scan);
|
||||
$("#secure-pass").val(selectedTemplate.installerPassowrd);
|
||||
$("#cpnl-dbaction").selectOption(selectedTemplate.installer_opts_cpnl_db_action);
|
||||
$("#cpnl-dbhost").val(selectedTemplate.installer_opts_cpnl_db_host);
|
||||
$("#cpnl-dbname").val(selectedTemplate.installer_opts_cpnl_db_name);
|
||||
$("#cpnl-dbuser").val(selectedTemplate.installer_opts_cpnl_db_user);
|
||||
|
||||
//-- Brand
|
||||
let installer_opts_brand = selectedTemplate.installer_opts_brand;
|
||||
installer_opts_brand_id = [];
|
||||
x = 0;
|
||||
|
||||
// most tricky thing - setup proper brand on emplate change
|
||||
if (typeof selectedTemplate.installer_opts_brand != 'undefined') {
|
||||
if (selectedTemplate.installer_opts_brand <= 0) {
|
||||
installer_opts_brand = -1;
|
||||
} else if (selectedTemplate.installer_opts_brand > 0) {
|
||||
installer_opts_brand = Number(selectedTemplate.installer_opts_brand);
|
||||
}
|
||||
}
|
||||
|
||||
// find, fix deleted brands and setup default
|
||||
for (var i = 0; i < packageTemplates.length; i++) {
|
||||
if (
|
||||
typeof packageTemplates[i].installer_opts_brand != 'undefined' &&
|
||||
null != packageTemplates[i].installer_opts_brand &&
|
||||
packageTemplates[i].installer_opts_brand != 0
|
||||
) {
|
||||
installer_opts_brand_id[x] = Number(packageTemplates[i].installer_opts_brand);
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
$("#brand").selectOption(installer_opts_brand);
|
||||
|
||||
//-- Database
|
||||
if (selectedTemplate.database_filter_tables.length) {
|
||||
let databaseFilterTables = selectedTemplate.database_filter_tables.split(",");
|
||||
let tablesToExclude = $("#dup-db-tables-exclude");
|
||||
|
||||
tablesToExclude.find(".dup-pseudo-checkbox").each(function() {
|
||||
let node = $(this);
|
||||
if (databaseFilterTables.includes(node.data('value'))) {
|
||||
node.addClass('checked');
|
||||
} else {
|
||||
node.removeClass('checked');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#dbhost").val(selectedTemplate.installer_opts_db_host);
|
||||
$("#dbname").val(selectedTemplate.installer_opts_db_name);
|
||||
$("#dbuser").val(selectedTemplate.installer_opts_db_user);
|
||||
|
||||
} else {
|
||||
console.log("Template ID doesn't exist?? " + selectedId);
|
||||
}
|
||||
|
||||
//Default to Installer cPanel tab if used
|
||||
$('#cpnl-enable').is(":checked") ? $('#dupli-cpnl-tab-lbl').trigger("click") : $('#dupli-bsc-tab-lbl').trigger("click");
|
||||
};
|
||||
|
||||
|
||||
DupliJs.Pack.ResetSettings = function() {
|
||||
<?php $confirm1->showConfirm(); ?>
|
||||
};
|
||||
|
||||
DupliJs.Pack.ResetSettingsRun = function() {
|
||||
$('#dup-form-opts')[0].reset();
|
||||
setTimeout(function() {
|
||||
tb_remove();
|
||||
}, 800);
|
||||
}
|
||||
|
||||
DupliJs.Pack.EditTemplate = function() {
|
||||
var manualTemplateID = <?php echo (int) $manual_template->getId(); ?>;
|
||||
var templateID = $('#template_id').val();
|
||||
var url;
|
||||
|
||||
if (templateID <= 0 || templateID == manualTemplateID) {
|
||||
url = <?php echo json_encode($templatesUrl); ?>;
|
||||
} else {
|
||||
url = <?php echo json_encode($templateEditBaseUrl); ?> + '&package_template_id=' + templateID;
|
||||
}
|
||||
window.open(url, 'edit-template');
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
//INIT
|
||||
jQuery(document).ready(function($) {
|
||||
DupliJs.Pack.checkPageCache = function() {
|
||||
var $state = $('#cache_state');
|
||||
if ($state.val() == "") {
|
||||
$state.val("fresh-load");
|
||||
} else {
|
||||
$state.val("cached");
|
||||
<?php $redirect = PackagesPageController::getInstance()->getPackageBuildS1Url(); ?>
|
||||
window.location.href = '<?php echo esc_js($redirect); ?>';
|
||||
}
|
||||
}
|
||||
|
||||
DupliJs.Pack.EnableTemplate = function() {
|
||||
$('#dupli-template-specific-area').show(0);
|
||||
DupliJs.Pack.PopulateCurrentTemplate();
|
||||
//DupliJs.Pack.ToggleInstallerPassword();
|
||||
DupliJs.EnableInstallerPassword();
|
||||
DupliJs.Pack.ToggleFileFilters();
|
||||
DupliJs.Pack.ToggleDBFilters();
|
||||
DupliJs.Pack.ToggleActiveThemes();
|
||||
DupliJs.Pack.ToggleActivePlugins();
|
||||
DupliJs.Pack.ToggleDBExcluded();
|
||||
DupliJs.Pack.ToggleNoPrefixTables(false);
|
||||
DupliJs.Pack.ToggleNoSubsiteExistsTables(false);
|
||||
}
|
||||
|
||||
DupliJs.Pack.checkPageCache();
|
||||
DupliJs.Pack.EnableTemplate();
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user