first commit

This commit is contained in:
Roman Pyrih
2026-04-21 15:48:41 +02:00
commit 7483681901
10216 changed files with 3236626 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
/**
* @package Duplicator
*/
use Duplicator\Libs\Snap\SnapWP;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
?>
<br>
<b><?php esc_html_e('Please Retry:', 'duplicator-pro'); ?></b><br>
<?php esc_html_e('Unable to perform a full scan and read JSON file, please try the following actions.', 'duplicator-pro'); ?><br>
<?php esc_html_e('1. Go back and create a root path directory filter to validate the site is scan-able.', 'duplicator-pro'); ?><br>
<?php esc_html_e('2. Continue to add/remove filters to isolate which path is causing issues.', 'duplicator-pro'); ?><br>
<?php esc_html_e('3. This message will go away once the correct filters are applied.', 'duplicator-pro'); ?><br>
<br>
<b><?php esc_html_e('Common Issues:', 'duplicator-pro'); ?></b><br>
<?php
esc_html_e(
'- On some budget hosts scanning over 30k files can lead to timeout/gateway issues.
Consider scanning only your main WordPress site and avoid trying to backup other external directories.',
'duplicator-pro'
);
?><br>
<?php
esc_html_e(
'- Symbolic link recursion can cause timeouts. Ask your server admin if any are present in the scan path.
If they are add the full path as a filter and try running the scan again.',
'duplicator-pro'
); ?><br>
<br>
<b><?php esc_html_e('Details:', 'duplicator-pro'); ?></b><br>
<?php esc_html_e('JSON Service:', 'duplicator-pro'); ?> /wp-admin/admin-ajax.php?action=duplicator_package_scan<br>
<?php esc_html_e('Scan Path:', 'duplicator-pro'); ?> [<?php echo esc_html(SnapWP::getHomePath(true)); ?>]<br><br>
<b><?php esc_html_e('More Information:', 'duplicator-pro'); ?></b><br>
<?php
printf(
esc_html__(
'Please see the online FAQ titled %1$s"How to resolve scanner warnings/errors and timeout issues?"%2$s',
'duplicator-pro'
),
'<a href="' . esc_url(DUPLICATOR_DUPLICATOR_DOCS_URL . 'how-to-resolve-scanner-warnings-errors-and-timeout-issues') . '" target="_blank">',
'</a>'
);

View File

@@ -0,0 +1,74 @@
<?php
/**
*
* @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
* @var array<string, mixed> $tplData
*/
?>
<div id="addonsites-block" class="scan-item">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Addon Sites', 'duplicator-pro');?></div>
<div id="data-arc-status-addonsites"></div>
</div>
<div class="info">
<div style="margin-bottom:10px;">
<?php esc_html_e(
'An "Addon Site" is a separate WordPress site(s) residing in subdirectories within this site.
If you confirm these to be separate sites, then it is recommended that you exclude them by checking
the corresponding boxes below and clicking the \'Add Filters & Rescan\' button. To backup the other
sites install the plugin on the sites needing to be backed-up.',
'duplicator-pro'
); ?>
</div>
<script id="hb-addon-sites" type="text/x-handlebars-template">
<div class="container">
<div class="hdrs">
<span style="font-weight:bold">
<?php esc_html_e('Quick Filters', 'duplicator-pro'); ?>
</span>
</div>
<div class="data">
{{#if ARC.FilterInfo.Dirs.AddonSites.length}}
{{#each ARC.FilterInfo.Dirs.AddonSites as |path|}}
<div class="directory horizontal-input-row">
<input type="checkbox" name="dir_paths[]" value="{{path}}" id="as_dir_{{@index}}"/>
<label for="as_dir_{{@index}}" title="{{path}}">
{{path}}
</label>
</div>
{{/each}}
{{else}}
<div class="data-padded">
<?php esc_html_e('No add on sites found.', 'duplicator-pro'); ?>
</div>
{{/if}}
</div>
</div>
<div class="apply-btn">
<div class="apply-warn">
<?php esc_html_e('*Checking a directory will exclude all items in that path recursively.', 'duplicator-pro'); ?>
</div>
<button
type="button"
class="button gray hollow tiny dupli-quick-filter-btn"
disabled="disabled"
onclick="DupliJs.Pack.applyFilters(this, 'addon')"
>
<i class="fa fa-filter fa-sm"></i> <?php esc_html_e('Add Filters &amp; Rescan', 'duplicator-pro');?>
</button>
</div>
</script>
<div id="hb-addon-sites-result" class="hb-files-style"></div>
</div>
</div>

View File

@@ -0,0 +1,172 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
use Duplicator\Libs\Snap\SnapString;
use Duplicator\Package\Archive\PackageArchive;
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
* @var \Duplicator\Package\DupPackage $package
*/
$package = $tplData['package'];
$global = GlobalEntity::getInstance();
$totalSizeMax = ($global->getBuildMode() == PackageArchive::BUILD_MODE_ZIP_ARCHIVE)
? DUPLICATOR_SCAN_SITE_ZIP_ARCHIVE_WARNING_SIZE
: DUPLICATOR_SCAN_SITE_WARNING_SIZE;
?>
<div class="scan-item">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Size Checks', 'duplicator-pro'); ?></div>
<div id="data-arc-status-size"></div>
</div>
<div class="info" id="scan-item-file-size">
<b><?php esc_html_e('Size', 'duplicator-pro'); ?>:</b> <span id="data-arc-size2"></span> &nbsp; | &nbsp;
<b><?php esc_html_e('Files', 'duplicator-pro'); ?>:</b> <span id="data-arc-files"></span> &nbsp; | &nbsp;
<b><?php esc_html_e('Directories ', 'duplicator-pro'); ?>:</b> <span id="data-arc-dirs"></span> &nbsp; | &nbsp;
<b><?php esc_html_e('Total', 'duplicator-pro'); ?>:</b> <span id="data-arc-fullcount"></span>
<br />
<?php echo wp_kses(
__('Compressing larger sites on <i>some budget hosts</i> may cause timeouts.', 'duplicator-pro'),
['i' => []]
); ?>
<i>
<a href="javascipt:void(0)" onclick="jQuery('#size-more-details').toggle(100); return false;">
[<?php esc_html_e('more details...', 'duplicator-pro'); ?>]
</a>
</i>
<div id="size-more-details">
<b><?php esc_html_e('Overview', 'duplicator-pro'); ?>:</b><br />
<?php echo wp_kses(
sprintf(
__(
'This notice is triggered at <b>%s</b> and can be ignored on most hosts.
If the build process hangs or is unable to complete then this host has strict processing limits.
Below are some options you can take to overcome constraints setup on this host.',
'duplicator-pro'
),
SnapString::byteSize($totalSizeMax)
),
['b' => []]
); ?>
<br /><br />
<b><?php esc_html_e('Timeout Options', 'duplicator-pro'); ?>: </b><br />
<ul>
<li><?php esc_html_e('Apply the "Quick Filters" below or click the back button to apply on previous page.', 'duplicator-pro'); ?> </li>
<li>
<?php esc_html_e('See the FAQ link to adjust this hosts timeout limits: ', 'duplicator-pro'); ?>
&nbsp;<a href="<?php echo esc_html(DUPLICATOR_DUPLICATOR_DOCS_URL); ?>how-to-handle-server-timeout-issues" target="_blank">
<?php esc_html_e('What can I try for Timeout Issues?', 'duplicator-pro'); ?>
</a>
</li>
</ul>
</div>
<div id="hb-files-large-result" class="dup-tree-section hb-files-style">
<div class="container">
<div class="hdrs">
<span style="font-weight:bold">
<?php esc_html_e('Quick Filters', 'duplicator-pro'); ?>
<sup>
<i
class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip-title="<?php esc_attr_e("Large Files", 'duplicator-pro'); ?>"
data-tooltip="<?php
echo wp_kses(
sprintf(
__(
'Files over %1$s are listed below. Larger files such as movies or zipped content
can cause timeout issues on some budget hosts. If you are having issues creating
a Backup try excluding the directory paths below or go back to Step 1 and add them.
<br><br><b>Right click on tree node to open the bulk actions menu</b>',
'duplicator-pro'
),
SnapString::byteSize(DUPLICATOR_SCAN_WARN_FILE_SIZE)
),
[
'br' => [],
'b' => [],
]
); ?>">
</i>
</sup>
</span>
<div class='hdrs-up-down'>
<i
class="fa fa-caret-up fa-lg dup-nav-toggle"
onclick="DupliJs.Pack.toggleAllDirPath(this, 'hide')"
title="<?php esc_attr_e("Hide All", 'duplicator-pro'); ?>">
</i>
<i
class="fa fa-caret-down fa-lg dup-nav-toggle"
onclick="DupliJs.Pack.toggleAllDirPath(this, 'show')"
title="<?php esc_attr_e("Show All", 'duplicator-pro'); ?>">
</i>
</div>
</div>
<div class="tree-nav-bar">
<div class="container">
<button
type="button"
id="hb-files-large-tree-full-load"
class="tree-full-load-button dup-tree-show-all button gray hollow small margin-bottom-0">
<?php esc_html_e('Show All', 'duplicator-pro') ?>
</button>
<span class="size"><?php esc_html_e('Size', 'duplicator-pro') ?></span>
<span class="nodes"><?php esc_html_e('Nodes', 'duplicator-pro') ?></span>
</div>
</div>
<div class="data">
<div id="hb-files-large-jstree" class="dup-tree-main-wrapper"></div>
</div>
</div>
<div class="apply-btn">
<div class="apply-warn">
<?php esc_html_e('*Checking a directory will exclude all items in that path recursively.', 'duplicator-pro'); ?>
</div>
<button
type="button"
class="button gray hollow tiny dupli-quick-filter-btn"
disabled="disabled" onclick="DupliJs.Pack.applyFilters(this, 'large')">
<i class="fa fa-filter fa-sm"></i> <?php esc_html_e('Add Filters &amp; Rescan', 'duplicator-pro'); ?>
</button>
<button
type="button"
class="button gray hollow tiny"
onclick="DupliJs.Pack.showPathsDlg('large')"
title="<?php esc_attr_e('Copy Paths to Clipboard', 'duplicator-pro'); ?>">
<i class="fa far fa-clipboard" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
</div>
<!-- =======================
DIALOG: PATHS COPY & PASTE -->
<div id="dup-archive-paths" style="display:none">
<b><i class="fa fa-folder"></i> <?php esc_html_e('Directories', 'duplicator-pro'); ?></b>
<div class="copy-butto float-right">
<button type="button" class="button secondary hollow tiny" onclick="DupliJs.Pack.copyText(this, '.arc-paths-dlg textarea.path-dirs')">
<i class="fa far fa-clipboard"></i> <?php esc_html_e('Click to Copy', 'duplicator-pro'); ?>
</button>
</div>
<textarea class="path-dirs"></textarea>
<b><i class="fa fa-files fa-sm"></i> <?php esc_html_e('Files', 'duplicator-pro'); ?></b>
<div class="copy-button float-right">
<button type="button" class="button secondary hollow tiny" onclick="DupliJs.Pack.copyText(this, '.arc-paths-dlg textarea.path-files')">
<i class="fa far fa-clipboard"></i> <?php esc_html_e('Click to Copy', 'duplicator-pro'); ?>
</button>
</div>
<textarea class="path-files"></textarea>
<small><?php esc_html_e('Copy the paths above and apply them as needed on Step 1 &gt; Archive &gt; Files section.', 'duplicator-pro'); ?></small>
</div>

View File

@@ -0,0 +1,27 @@
<?php
/**
*
* @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
* @var array<string, mixed> $tplData
*/
?>
<div class="scan-item ">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Database only', 'duplicator-pro'); ?></div>
<div id="only-db-scan-status"><div class="badge badge-warn"><?php esc_html_e("Notice", 'duplicator-pro'); ?></div></div>
</div>
<div class="info">
<?php esc_html_e("Only the database and a copy of the installer.php will be included in the Backup file.", 'duplicator-pro'); ?>
</div>
</div>

View File

@@ -0,0 +1,30 @@
<?php
/**
*
* @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
* @var array<string, mixed> $tplData
*/
?>
<div class="scan-item ">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('File checks skipped', 'duplicator-pro'); ?></div>
<div id="skip-archive-scan-status"><div class="badge badge-warn"><?php esc_html_e("Notice", 'duplicator-pro'); ?></div></div>
</div>
<div class="info">
<?php esc_html_e("All file checks are skipped. This could cause problems during extraction if problematic files are included.", 'duplicator-pro'); ?>
<br><br>
<b><?php esc_html_e("To enable, uncheck Backups > Advanced Settings > Scan File Checks > \"Skip\" to enable.", 'duplicator-pro'); ?></b>
</div>
</div>

View File

@@ -0,0 +1,77 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
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
* @var \Duplicator\Package\DupPackage $package
*/
$package = $tplData['package'];
$global = GlobalEntity::getInstance();
?>
<!-- ================================================================
ARCHIVE
================================================================ -->
<div class="details-title">
<i class="far fa-file-archive fa-sm fa-fw"></i>&nbsp;<?php esc_html_e('Archive', 'duplicator-pro'); ?>
<sup class="dup-small-ext-type">
<?php if ($package->Installer->isSecure()) : ?>
<i class="fas fa-lock fa-fw fa-sm" title="<?php esc_html_e('Requires Password to Extract', 'duplicator-pro'); ?>"></i>&nbsp;
<?php endif; ?>
<?php echo esc_html($global->getArchiveExtensionType()); ?>
</sup>
</div>
<div class="scan-header scan-item-first">
<i class="fas fa-folder-open fa-sm"></i>
<?php esc_html_e("Files", 'duplicator-pro'); ?>
<div class="scan-header-details">
<div class="dup-scan-filter-status">
<?php if ($package->isDBOnly()) { ?>
<i class="fa fa-filter fa-sm"></i> <?php esc_html_e('Database Only', 'duplicator-pro'); ?>
<?php } elseif ($package->Archive->FilterOn) { ?>
<i class="fa fa-filter fa-sm"></i> <?php esc_html_e('Enabled', 'duplicator-pro'); ?>
<?php } ?>
</div>
<div id="data-arc-size1"></div>
<i class="fa fa-question-circle data-size-help"
data-tooltip-title="<?php esc_attr_e("File Size:", 'duplicator-pro'); ?>"
data-tooltip="<?php
esc_html_e(
'The files size represents only the included files before compression is applied.
It does not include the size of the database script and in most cases the Backup size
once completed will be smaller than this number unless shell execution zip with no compression is enabled.',
'duplicator-pro'
); ?>"></i>
<div class="dup-data-size-uncompressed"><?php esc_html_e("uncompressed", 'duplicator-pro'); ?></div>
</div>
</div>
<?php if ($package->isDBOnly()) {
$tplMng->render('admin_pages/packages/scan/items/archive/files_db_only');
} elseif ($global->skip_archive_scan) {
$tplMng->render('admin_pages/packages/scan/items/archive/files_skip_scan');
} else {
// SIZE CHECKS
$tplMng->render('admin_pages/packages/scan/items/archive/files');
// ADDON SITES
$tplMng->render('admin_pages/packages/scan/items/archive/addons');
// UNREADABLE FILES
$tplMng->render('admin_pages/packages/scan/items/archive/unreadable');
} ?>
<?php if (is_multisite()) {
$tplMng->render('admin_pages/packages/scan/items/archive/multisite');
} ?>

View File

@@ -0,0 +1,82 @@
<?php
/**
*
* @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
* @var array<string, mixed> $tplData
*/
?>
<div id="network-filters-scan-item" class="scan-item">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Network Site Filters', 'duplicator-pro');?></div>
<div id="data-arc-status-network"></div>
</div>
<div class="info">
<script id="hb-filter-network-sites" type="text/x-handlebars-template">
<div class="container">
<div class="data">
{{#if ARC.Status.HasFilteredSites}}
<p class="red">
<?php esc_html_e(
"Some sites have been excluded from the network.
With this backup it will not be possible to restore the network but only perform subsite to standalone conversions.",
'duplicator-pro'
); ?>
</p>
<b><?php esc_html_e('EXCLUDED SITES', 'duplicator-pro'); ?></b>
<ol>
{{#each ARC.FilteredSites as |site|}}
<li>{{site.blogname}} </li>
{{/each}}
</ol>
{{else}}
<?php esc_html_e("No network sites has been excluded from the Backup.", 'duplicator-pro'); ?>
{{/if}}
{{#if ARC.Status.HasNotImportableSites}}
<p class="red">
<?php esc_html_e(
"Tables and/or paths have been manually excluded from some sites so the Backup will not be
compatible with the Drag and Drop import. An install using the installer.php can still be performed, however.",
'duplicator-pro'
); ?>
</p>
{{#each ARC.Subsites as |site|}}
{{#compare site.filteredTables.length '||' site.filteredPaths.length}}
<p><b>{{site.blogname}}</b></p>
<div class="subsite-filter-info">
{{#compare site.filteredTables.length '>' 0}}
<?php esc_html_e('Tables:', 'duplicator-pro'); ?>
<ol>
{{#each site.filteredTables as |filteredTable|}}
<li>{{filteredTable}}</li>
{{/each}}
</ol>
{{/compare}}
{{#compare site.filteredPaths.length '>' 0}}
<?php esc_html_e('Paths:', 'duplicator-pro'); ?>
<ol>
{{#each site.filteredPaths as |filteredPath|}}
<li>{{filteredPath}}</li>
{{/each}}
</ol>
{{/compare}}
</div>
{{/compare}}
{{/each}}
{{/if}}
</div>
</div>
</script>
<div id="hb-filter-network-sites-result"></div>
</div>
</div>

View File

@@ -0,0 +1,85 @@
<?php
/**
*
* @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
* @var array<string, mixed> $tplData
*/
?>
<div id="scan-unreadable-items" class="scan-item">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Read Checks', 'duplicator-pro');?></div>
<div id="data-arc-status-unreadablefiles"></div>
</div>
<div class="info">
<?php
echo wp_kses(
__(
'PHP is unable to read the following items and they will <u>not</u> be included in the Backup.
Please work with your host to adjust the permissions or resolve the symbolic-link(s) shown in the lists below.
If these items are not needed then this notice can be ignored.',
'duplicator-pro'
),
['u' => []]
);
?>
<script id="unreadable-files" type="text/x-handlebars-template">
<div class="container">
<div class="data-padded">
<b><?php esc_html_e('Unreadable Items:', 'duplicator-pro');?></b> <br/>
<div class="directory">
{{#if ARC.UnreadableItems}}
{{#each ARC.UnreadableItems as |uitem|}}
<i class="fa fa-lock fa-sm"></i> {{uitem}} <br/>
{{/each}}
{{else}}
<i>
<?php esc_html_e('No unreadable items found.', 'duplicator-pro'); ?>
<br>
</i>
{{/if}}
</div>
<b><?php esc_html_e('Recursive Links:', 'duplicator-pro');?></b> <br/>
<div class="directory">
{{#if ARC.RecursiveLinks}}
{{#each ARC.RecursiveLinks as |link|}}
<i class="fa fa-lock fa-sm"></i> {{link}} <br/>
{{/each}}
{{else}}
<i>
<?php esc_html_e('No recursive sym-links found.', 'duplicator-pro'); ?>
<br>
</i>
{{/if}}
</div>
<b><?php esc_html_e('Open Basedir Restricted Items:', 'duplicator-pro');?></b> <br/>
<div class="directory">
{{#if ARC.PathsOutOpenbaseDir}}
{{#each ARC.PathsOutOpenbaseDir as |openBaseDiritem|}}
<i class="fa fa-lock fa-sm"></i> {{openBaseDiritem}} <br/>
{{/each}}
{{else}}
<i>
<?php esc_html_e('No open_basedir restricted items found.', 'duplicator-pro'); ?>
<br>
</i>
{{/if}}
</div>
</div>
</div>
</script>
<div id="unreadable-files-result" class="hb-files-style"></div>
</div>
</div>

View File

@@ -0,0 +1,32 @@
<?php
/**
*
* @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
* @var array<string, mixed> $tplData
*/
?>
<div class="scan-item">
<div class="title" onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Database excluded', 'duplicator-pro');?></div>
<div id="data-db-status-size1"></div>
</div>
<div class="info">
<?php esc_html_e(
'The database is excluded from the Backup build process.
To include it make sure to check the "Database" Backup component checkbox at Step 1 of the build process.',
'duplicator-pro'
); ?>
</div>
</div>

View File

@@ -0,0 +1,72 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
use Duplicator\Libs\WpUtils\WpDbUtils;
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\DupPackage $package
*/
$package = $tplData['package'];
?>
<!-- ================================================================
DATABASE
================================================================ -->
<div class="scan-header">
<i class="fas fa-database fa-fw fa-sm"></i>
<?php esc_html_e("Database", 'duplicator-pro'); ?>
<div class="scan-header-details">
<small style="font-weight:normal; font-size:12px">
<?php if ($package->Database->Compatible) { ?>
<i style="color:maroon"><?php esc_html_e('Compatibility Mode Enabled', 'duplicator-pro'); ?></i>
<?php } ?>
</small>
<div class="dup-scan-filter-status">
<?php if ($package->Database->FilterOn) { ?>
<i class="fa fa-filter fa-sm"></i>
<?php esc_html_e('Enabled', 'duplicator-pro'); ?>
<?php } ?>
</div>
<div id="data-db-size1"></div>
<i class="fa fa-question-circle data-size-help"
data-tooltip-title="<?php esc_attr_e("Database Size:", 'duplicator-pro'); ?>"
data-tooltip="<?php
esc_html_e(
'The database size represents only the included tables. The process for gathering the size uses the query SHOW TABLE STATUS.
The overall size of the database file can impact the final size of the Backup.',
'duplicator-pro'
); ?>"></i>
<div class="dup-data-size-uncompressed"><?php esc_html_e("uncompressed", 'duplicator-pro'); ?></div>
</div>
</div>
<div id="dup-scan-db">
<?php if ($package->isDBExcluded()) {
$tplMng->render('admin_pages/packages/scan/items/database/excluded');
} else {
$tplMng->render('admin_pages/packages/scan/items/database/tables');
if (WpDbUtils::getBuildMode() == WpDbUtils::BUILD_MODE_MYSQLDUMP) {
$tplMng->render('admin_pages/packages/scan/items/database/mysqldump');
}
if (count($tplData['procedures']) > 0 || count($tplData['functions']) > 0) {
$tplMng->render('admin_pages/packages/scan/items/database/procedures');
}
if (count($tplData['triggers'])) {
$tplMng->render('admin_pages/packages/scan/items/database/triggers');
}
} ?>
</div>

View File

@@ -0,0 +1,121 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
use Duplicator\Controllers\SettingsPageController;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
$settingsPackageUrl = SettingsPageController::getInstance()->getMenuLink(SettingsPageController::L2_SLUG_PACKAGE);
?>
<div class="scan-item" id="mysqldump-limit-result"></div>
<script id="hb-mysqldump-limit-result" type="text/x-handlebars-template">
<div class="title" onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text">
<i class="fa fa-caret-right"></i> <?php esc_html_e('Mysqldump memory check', 'duplicator-pro'); ?>
</div>
<div id="data-db-status-mysqldump-limit">
{{#if DB.Status.mysqlDumpMemoryCheck}}
<div class="badge badge-pass"><?php esc_html_e('Good', 'duplicator-pro'); ?></div>
{{else}}
<div class="badge badge-warn"><?php esc_html_e('Notice', 'duplicator-pro'); ?></div>
{{/if}}
</div>
</div>
{{#if DB.Status.mysqlDumpMemoryCheck}}
<div class="info">
<p class="green">
<?php esc_html_e('The database size is within the allowed mysqldump size limit.', 'duplicator-pro'); ?>
</p>
<?php
echo wp_kses(
sprintf(
_x(
'If you encounter any issues with mysqldump please change the setting SQL Mode to PHP Code.
You can do that by opening %1$sDuplicator Pro > Settings > Backups.%2$s',
'1$s and 2$s represent opening and closing anchor tags',
'duplicator-pro'
),
'<a href="' . esc_url($settingsPackageUrl) . '" target="_blank">',
'</a>'
),
[
'a' => [
'href' => [],
'target' => [],
],
]
);
?>
</div>
{{else}}
<div class="info" style="display:block;">
<p class="red">
<?php esc_html_e('The database size exceeds the allowed mysqldump size limit.', 'duplicator-pro'); ?>
</p>
<?php
esc_html_e(
'The database size is larger than the PHP memory_limit value.
This can lead into issues when building a Backup, during which the system can run out of memory.
To fix this issue please consider doing one of the below mentioned recommendations.',
'duplicator-pro'
);
?>
<hr size="1" />
<p>
<b><?php esc_html_e('RECOMMENDATIONS:', 'duplicator-pro'); ?></b>
</p>
<ul class="dupli-simple-style-disc" >
<li>
<?php echo wp_kses(
sprintf(
_x(
'Please change the setting SQL Mode to PHP Code.
You can do that by opening %1$sDuplicator Pro > Settings > Backups.%2$s',
'%1$s and %2$s represent opening and closing anchor tags',
'duplicator-pro'
),
'<a href="' . esc_url($settingsPackageUrl) . '" target="_blank">',
'</a>'
),
[
'a' => [
'href' => [],
'target' => [],
],
]
); ?>
</li>
<li>
<?php echo wp_kses(
sprintf(
_x(
'If you want to build the backup with mysqldump, increase the PHP <b>memory_limit</b>
value in your php.ini file to at least %1$s.',
'%1$s represents the memory limit value (e.g. 256MB)',
'duplicator-pro'
),
'<b><span id="data-db-size3">{{DB.Status.requiredMysqlDumpLimit}}</span></b>'
),
[
'b' => [],
'span' => ['id' => []],
]
); ?>
</li>
</ul>
</div>
{{/if}}
</script>

View File

@@ -0,0 +1,51 @@
<?php
/**
*
* @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
* @var array<string, mixed> $tplData
*/
?>
<div class="scan-item">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Object Access', 'duplicator-pro');?></div>
<div id="data-arc-status-showcreatefunc"></div>
</div>
<div class="info">
<script id="hb-showcreatefunc-result" type="text/x-handlebars-template">
<div class="container">
<div class="data">
{{#if ARC.Status.showCreateFunc}}
<?php esc_html_e(
"The database user for this WordPress site has sufficient permissions to write stored procedures
and functions to the sql file of the archive. [The commands SHOW CREATE PROCEDURE/FUNCTION will work.]",
'duplicator-pro'
); ?>
{{else}}
<span style="color: red;">
<?php
esc_html_e(
"The database user for this WordPress site does NOT have sufficient permissions to write stored
procedures to the sql file of the archive. [The command SHOW CREATE FUNCTION will NOT work.]",
'duplicator-pro'
);
?>
</span>
{{/if}}
</div>
</div>
</script>
<div id="showcreatefunc-package-result"></div>
</div>
</div>

View File

@@ -0,0 +1,163 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined("ABSPATH") or die("");
use Duplicator\Controllers\SettingsPageController;
use Duplicator\Libs\Snap\SnapString;
/**
* Variables
*
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
* @var \Duplicator\Package\DupPackage $package
*/
$package = $tplData['package'];
$settingsPackageUrl = SettingsPageController::getInstance()->getMenuLink(SettingsPageController::L2_SLUG_PACKAGE);
/** @var wpdb $wpdb */
global $wpdb;
?>
<div class="scan-item">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Overview', 'duplicator-pro'); ?></div>
<div id="data-db-status-size1"></div>
</div>
<div class="info">
<b> <?php esc_html_e('TOTAL SIZE', 'duplicator-pro'); ?> &nbsp; &#8667; &nbsp; </b>
<b><?php esc_html_e('Size', 'duplicator-pro'); ?>:</b> <span id="data-db-size2"></span> &nbsp; | &nbsp;
<b><?php esc_html_e('Tables', 'duplicator-pro'); ?>:</b> <span id="data-db-tablecount"></span> &nbsp; | &nbsp;
<b><?php esc_html_e('Records', 'duplicator-pro'); ?>:</b> <span id="data-db-rows"></span> <br />
<?php echo wp_kses(
sprintf(
__(
'Total size and row count are approximate values. The thresholds that trigger warnings are
<i>%1$s OR %2$s records</i> total for the entire database. Large databases take time to process
and can cause issues with server timeout and memory settings on some budget hosts. If your server
supports popen or exec and mysqldump you can try to enable Shell Execution from the settings menu.',
'duplicator-pro'
),
SnapString::byteSize(DUPLICATOR_SCAN_DB_ALL_SIZE),
number_format(DUPLICATOR_SCAN_DB_ALL_ROWS)
),
['i' => []]
); ?>
<br />
<br />
<hr size="1" />
<b><?php esc_html_e('TABLE DETAILS:', 'duplicator-pro'); ?></b><br />
<?php
echo wp_kses(
sprintf(
__(
'The notices for tables are <i>%1$s, %2$s records or names with upper-case characters</i>.
Individual tables will not trigger a notice message, but can help narrow down issues if they occur later on.',
'duplicator-pro'
),
SnapString::byteSize(DUPLICATOR_SCAN_DB_TBL_SIZE),
number_format(DUPLICATOR_SCAN_DB_TBL_ROWS)
),
['i' => []]
);
?>
<p>
<b><?php echo esc_html(sprintf(__('Exclude all tables without prefix "%s"', 'duplicator-pro'), $tplData['prefix'])); ?>:</b>&nbsp;
<i class="maroon">
<?php echo ($tplData['prefixFilter'] ?
esc_html_e('Enabled', 'duplicator-pro') :
esc_html_e('Disabled', 'duplicator-pro')
); ?>
</i><br>
<?php if (is_multisite()) { ?>
<b><?php esc_html_e('Exclude not existing subsite filter', 'duplicator-pro'); ?>:</b>&nbsp;
<i class="red">
<?php echo ($tplData['prefixSubFilter'] ?
esc_html_e('Enabled', 'duplicator-pro') :
esc_html_e('Disabled', 'duplicator-pro')
); ?>
</i>
<?php } ?>
</p>
<div id="dup-scan-db-info">
<div id="data-db-tablelist"></div>
</div>
<br />
<hr size="1" />
<b><?php esc_html_e('RECOMMENDATIONS:', 'duplicator-pro'); ?></b><br />
<i>
<?php esc_html_e(
'The following recommendations are not needed unless you are having issues building or installing the Backup.',
'duplicator-pro'
); ?>
</i>
<br />
<div style="padding:5px">
<?php echo wp_kses(
sprintf(
_x(
'1. Run a %1$srepair and optimization%2$s on the table to improve the overall size and performance.',
'1$s and 2$s represent opening and closing anchor tags',
'duplicator-pro'
),
'<a href="' . admin_url('maint/repair.php') . '" target="_blank">',
'</a>'
),
[
'a' => [
'href' => [],
'target' => [],
],
]
); ?>
<br /><br />
<?php esc_html_e(
'2. Remove post revisions and stale data from tables. Tables such as logs, statistical or other non-critical data should be cleared.',
'duplicator-pro'
); ?>
<br /><br />
<?php echo wp_kses(
sprintf(
_x(
'3. %1$sEnable mysqldump%2$s if this host supports the option.',
'1$s and 2$s represent opening and closing anchor tags',
'duplicator-pro'
),
'<a href="' . esc_url($settingsPackageUrl) . '" target="_blank">',
'</a>'
),
[
'a' => [
'href' => [],
'target' => [],
],
]
); ?>
<br /><br />
<?php echo wp_kses(
sprintf(
_x(
'4. Restoring mixed-case tables can cause problems on some servers. If you experience a
problem installing the backup change the %1$s system variable on the destination site\'s MySQL Server.',
'1$s represents an anchor tag with the variable name',
'duplicator-pro'
),
'<a href="http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_lower_case_table_names" target="_blank">
lower_case_table_names</a>'
),
[
'a' => [
'href' => [],
'target' => [],
],
]
); ?>
</div>
</div>
</div>

View File

@@ -0,0 +1,43 @@
<?php
/**
*
* @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
* @var array<string, mixed> $tplData
*/
?>
<div class="scan-item">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Triggers', 'duplicator-pro');?></div>
<div id="data-arc-status-triggers"></div>
</div>
<div class="info">
<script id="hb-triggers-result" type="text/x-handlebars-template">
<div class="container">
<div class="data">
<span class="red">
<?php
esc_html_e(
"The database contains triggers which will have to be manually imported at install time.
No action needs to be performed at this time. During the install process you will be
presented with the proper trigger SQL statements that you can optionally run.",
'duplicator-pro'
); ?>
</span>
</div>
</div>
</script>
<div id="triggers-result"></div>
</div>
</div>

View File

@@ -0,0 +1,31 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined("ABSPATH") or die("");
use Duplicator\Core\Views\TplMng;
/**
* Variables
*
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var Duplicator\Core\Views\TplMng $tplMng
*/
?>
<div class="details-title">
<i class="fas fa-tasks fa-sm fa-fw"></i> <?php esc_html_e("Setup", 'duplicator-pro'); ?>
<div class="dup-more-details">
<a href="site-health.php" target="_blank" title="<?php esc_attr_e('Site Health', 'duplicator-pro'); ?>">
<i class="fas fa-file-medical-alt"></i>
</a>
</div>
</div>
<?php
TplMng::getInstance()->render('admin_pages/packages/scan/items/setup/system');
TplMng::getInstance()->render('admin_pages/packages/scan/items/setup/wordpress');
TplMng::getInstance()->render('admin_pages/packages/scan/items/setup/restore');

View File

@@ -0,0 +1,84 @@
<?php
/**
*
* @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
* @var array<string, mixed> $tplData
*/
?>
<div id="migration-status-scan-item" class="scan-item">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('Import Status', 'duplicator-pro');?></div>
<div id="data-arc-status-migratepackage"></div>
</div>
<div class="info">
<script id="hb-migrate-package-result" type="text/x-handlebars-template">
<div class="container">
<div class="data">
{{#if ARC.Status.PackageIsNotImportable}}
<hr>
<p>
<span class="maroon">
<?php esc_html_e("This Backup is not compatible with", 'duplicator-pro'); ?>
<i data-tooltip-title="<?php esc_attr_e("Drag and Drop Import", 'duplicator-pro'); ?>"
data-tooltip="<?php esc_attr_e('The Drag and Drop import method is a way to migrate Backups.
You can find it under Duplicator Pro > Import.', 'duplicator-pro'); ?>">
<u><?php esc_html_e("Drag and Drop import", 'duplicator-pro'); ?></u>.&nbsp;
</i>
<?php esc_html_e("However it can still be used to perform a database migration.", 'duplicator-pro'); ?>
</span>
{{#if ARC.Status.IsDBOnly}}
<?php
esc_attr_e(
"Database only Backups can only be installed via the installer.php file.
The Drag and Drop interface only processes Backups that have all WordPress core directories and all database tables.",
'duplicator-pro'
);
?>
{{else}}
<?php esc_attr_e(
"To make the Backup compatible with Drag and Drop import don't filter any tables or core directories.",
'duplicator-pro'
); ?>
{{/if}}
</p>
{{#if ARC.Status.HasFilteredCoreFolders}}
<p>
<b><?php esc_attr_e("FILTERED CORE DIRS:", 'duplicator-pro'); ?></b>
</p>
<ol>
{{#each ARC.FilteredCoreDirs as |dir|}}
<li>{{dir}} </li>
{{/each}}
</ol>
{{/if}}
{{#if ARC.Status.HasFilteredSiteTables}}
<b><?php esc_attr_e("FILTERED SITE TABLES:", 'duplicator-pro'); ?></b>
<div class="dup-scan-files-migrae-status">
<ol>
{{#each DB.FilteredTables as |table|}}
<li>{{table}} </li>
{{/each}}
</ol>
</div>
{{/if}}
{{else}}
<?php esc_html_e("The Backup you are about to create is compatible with Drag and Drop import.", 'duplicator-pro'); ?>
{{/if}}
</div>
</div>
</script>
<div id="migrate-package-result"></div>
</div>
</div>

View File

@@ -0,0 +1,184 @@
<?php
/**
* @package Duplicator
*/
use Duplicator\Addons\ProBase\License\License;
use Duplicator\Core\Constants;
use Duplicator\Libs\Snap\SnapOpenBasedir;
use Duplicator\Libs\Snap\SnapServer;
use Duplicator\Libs\Snap\SnapUtil;
use Duplicator\Models\DynamicGlobalEntity;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
$webServers = implode(', ', Constants::SERVER_LIST);
$serverSoftware = SnapUtil::sanitizeTextInput(INPUT_SERVER, 'SERVER_SOFTWARE', 'unknown');
$fopenEnabled = SnapServer::isURLFopenEnabled() ? '1' : '0';
$isCurlEnabled = SnapUtil::isCurlEnabled() ? __('True', 'duplicator-pro') : __('False', 'duplicator-pro');
$openBaseDir = SnapOpenBasedir::isEnabled() ? esc_html__('on', 'duplicator-pro') : esc_html__('off', 'duplicator-pro');
$maxExecutionTime = set_time_limit(0) === true ? 0 : @ini_get('max_execution_time');
$memoryLimit = @ini_get('memory_limit');
$architecture = SnapUtil::getArchitectureString();
?>
<div class="scan-item scan-item-first">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('System', 'duplicator-pro'); ?></div>
<div id="data-srv-php-all"></div>
</div>
<div class="info">
<div class="scan-system-divider"><i class="fa fa-list"></i>&nbsp; <?php esc_html_e('General Checks', 'duplicator-pro'); ?></div>
<?php if (License::can(License::CAPABILITY_BRAND)) : ?>
<span id="data-srv-brand-check"></span>&nbsp;
<b><?php esc_html_e('Brand', 'duplicator-pro'); ?>: </b>
<span id="data-srv-brand-name"><?php esc_html_e('Default', 'duplicator-pro'); ?></span>
<br />
<div class="scan-system-subnote" id="data-srv-brand-note">
<?php esc_html_e('The default content used when a brand is not defined.', 'duplicator-pro'); ?>
</div>
<hr size="1" />
<?php endif; ?>
<span id="data-srv-php-websrv"></span>
&nbsp;<b><?php esc_html_e('Web Server', 'duplicator-pro') ?>:</b>
&nbsp; <?php echo esc_html($serverSoftware); ?><br />
<div class="scan-system-subnote">
<?php esc_html_e("Supported Web Servers:", 'duplicator-pro'); ?>&nbsp;<?php echo esc_html($webServers); ?>
</div>
<hr size="1" />
<span id="data-srv-php-mysqli"></span>&nbsp;<b><?php esc_html_e('MySQLi', 'duplicator-pro'); ?></b><br />
<div class="scan-system-subnote">
<?php esc_html_e(
'Creating the Backup does not require the mysqli module. However the installer file requires
that the PHP module mysqli be installed on the server it is deployed on.',
'duplicator-pro'
); ?>
<i><a href="http://php.net/manual/en/mysqli.installation.php" target="_blank">[<?php esc_html_e('details', 'duplicator-pro'); ?>]</a></i>
</div>
<div class="scan-system-divider margin-top-1"><i class="fa fa-list"></i>&nbsp;<?php esc_html_e('PHP Checks', 'duplicator-pro'); ?></div>
<span id="data-srv-php-version"></span>&nbsp;<b><?php esc_html_e('PHP Version: ', 'duplicator-pro'); ?> </b> <?php echo PHP_VERSION; ?> <br />
<div class="scan-system-subnote">
<?php
echo esc_html(
sprintf(
__(
'The minimum PHP version supported by Duplicator is %1$s, however it is highly
recommended to use PHP %2$s or higher for improved stability.',
'duplicator-pro'
),
DUPLICATOR_PRO_PHP_MINIMUM_VERSION,
DUPLICATOR_PRO_PHP_SUGGESTED_VERSION
)
); ?>
</div>
<hr size="1" />
<span id="data-srv-php-openbase"></span>&nbsp;
<b><?php esc_html_e('PHP Open Base Dir', 'duplicator-pro'); ?>:</b>&nbsp;<?php echo esc_html($openBaseDir); ?>
<br />
<div class="scan-system-subnote">
<?php esc_html_e(
'When [open_basedir] is enabled, issues may arise if there are symbolic links pointing outside the open_basedir restrictions.
To view a list of unreadable files, please consult the Read Checks section.
If you encounter problems while building a Backup,
consider working with your server admin or hosting provider to disable this setting in the php.ini file.',
'duplicator-pro'
); ?>
&nbsp;
<i>
<a href="http://php.net/manual/en/ini.core.php#ini.open-basedir" target="_blank">[<?php esc_html_e('details', 'duplicator-pro'); ?>]</a>
</i>
<br />
</div>
<hr size="1" />
<span id="data-srv-php-maxtime"></span>&nbsp;
<b><?php esc_html_e('PHP Max Execution Time', 'duplicator-pro'); ?>:</b>&nbsp; <?php echo esc_html($maxExecutionTime); ?>
<br />
<div class="scan-system-subnote">
<?php
esc_html(
sprintf(
__(
'Issues might occur for larger Backups when the [max_execution_time] value in the php.ini is too low.
The minimum recommended timeout is "%1$s" seconds or higher.
An attempt is made to override this value if the server allows it. A value of 0 (recommended) indicates that PHP has no time limits.',
'duplicator-pro'
),
DUPLICATOR_SCAN_TIMEOUT
)
); ?>
&nbsp;
<i>
<a href="http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time" target="_blank">
[<?php esc_html_e('details', 'duplicator-pro'); ?>]
</a>
</i>
</div>
<hr size="1" />
<span id="data-srv-php-minmemory"></span>&nbsp;
<b><?php esc_html_e('PHP Memory Limit', 'duplicator-pro'); ?>:</b>&nbsp; <?php echo esc_html($memoryLimit); ?>
<br />
<div class="scan-system-subnote">
<?php
echo wp_kses(
sprintf(
_x(
'Issues might occur for larger Backups when the [memory_limit] value in the php.ini is too low.
The minimum recommended memory limit is "%1$s" or higher. An attempt is made to override this value if the server allows it.
To manually increase the memory limit have a look at this %2$s[FAQ item]%3$s',
'1: memory limit, 2: link start, 3: link end',
'duplicator-pro'
),
DUPLICATOR_MIN_MEMORY_LIMIT,
"<i><a href='" . DUPLICATOR_DUPLICATOR_DOCS_URL . "how-to-manage-server-resources-cpu-memory-disk' target='_blank'>",
"</a></i>"
),
[
'a' => [
'href' => [],
'target' => [],
],
'i' => [],
]
); ?>
</div>
<hr size="1" />
<span id="data-srv-php-arch64bit"></span>&nbsp;
<b><?php esc_html_e('PHP 64 Bit Architecture', 'duplicator-pro'); ?>:</b>&nbsp; <?php echo esc_html($architecture); ?><br />
<div class="scan-system-subnote">
<?php
echo wp_kses(
sprintf(
_x(
'Servers that run a PHP 32-bit architecture are not capable of creating Backups larger than 2GB.
If you need to create a Backup that is larger than 2GB in size talk with your host or server admin
to change your version of PHP to 64-bit. %1$s[FAQ item]%2$s',
'1: link start, 2: link end',
'duplicator-pro'
),
"<i><a href='" . DUPLICATOR_DUPLICATOR_DOCS_URL . "how-to-resolve-file-io-related-build-issues' target='_blank'>",
"</a></i>"
),
[
'a' => [
'href' => [],
'target' => [],
],
'i' => [],
]
); ?>
</div>
<br />
</div>
</div>

View File

@@ -0,0 +1,136 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined("ABSPATH") or die("");
use Duplicator\Addons\ProBase\License\License;
/**
* Variables
*
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
?>
<div class="scan-item">
<div class='title' onclick="DupliJs.Pack.toggleScanItem(this);">
<div class="text"><i class="fa fa-caret-right"></i> <?php esc_html_e('WordPress', 'duplicator-pro'); ?></div>
<div id="data-srv-wp-all"></div>
</div>
<div class="info">
<span id="data-srv-wp-version"></span>&nbsp;
<b><?php esc_html_e('WordPress Version', 'duplicator-pro'); ?>:</b>&nbsp;<?php echo esc_html(get_bloginfo('version')); ?> <br />
<hr size="1" /><span id="data-srv-wp-core"></span>&nbsp;<b> <?php esc_html_e('Core Files', 'duplicator-pro'); ?></b> <br />
<?php if (count($tplData['filteredCoreDirs']) > 0) : ?>
<div id="data-srv-wp-core-missing-dirs">
<?php echo wp_kses(
__(
"The core WordPress directories below will <u>not</u> be included in the archive.
These paths are required for WordPress to function!",
'duplicator-pro'
),
['u' => []]
); ?>
<br />
<?php foreach ($tplData['filteredCoreDirs'] as $coreDir) : ?>
<b class="margin-left-1"><i class="fa fa-exclamation-circle scan-warn margin-right-1"></i><?php echo esc_html($coreDir); ?></b><br />
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if (count($tplData['filteredCoreFiles']) > 0) : ?>
<div id="data-srv-wp-core-missing-dirs">
<?php echo wp_kses(
__(
"The core WordPress files below will <u>not</u> be included in the archive.
These files are required for WordPress to function!",
'duplicator-pro'
),
['u' => []]
); ?>
<br />
<?php foreach ($tplData['filteredCoreFiles'] as $coreFile) : ?>
<b class="margin-left-1"><i class="fa fa-exclamation-circle scan-warn margin-right-1"></i><?php echo esc_html($coreFile); ?></b>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if (count($tplData['filteredCoreDirs']) > 0 || count($tplData['filteredCoreFiles']) > 0) : ?>
<div class="scan-system-subnote">
<?php esc_html_e(
'Note: Please change the file and directory filters if you wish to include the WordPress core files
otherwise the data will have to be manually copied to the new location for the site to function properly.',
'duplicator-pro'
); ?>
</div>
<?php endif; ?>
<?php if (empty($tplData['filteredCoreDirs']) && empty($tplData['filteredCoreFiles'])) : ?>
<div class="scan-system-subnote">
<?php esc_html_e(
"If the scanner is unable to locate the wp-config.php file in the root directory,
then you will need to manually copy it to its new location.
This check will also look for core WordPress paths that should be included in the archive for WordPress to work correctly.",
'duplicator-pro'
); ?>
</div>
<?php endif; ?>
<?php if (!is_multisite()) { ?>
<hr size="1" />
<span>
<div class="dup-scan-good"><i class="fa fa-check"></i></div>
</span>
<b> <?php esc_html_e('Multisite: N/A', 'duplicator-pro'); ?></b> <br />
<div class="scan-system-subnote">
<?php esc_html_e('Multisite was not detected on this site. It is currently configured as a standard WordPress site.', 'duplicator-pro'); ?>
<i><a href='https://codex.wordpress.org/Create_A_Network' target='_blank'> [<?php esc_html_e('details', 'duplicator-pro'); ?>]</a></i>
</div>
<?php } elseif (License::can(License::CAPABILITY_MULTISITE_PLUS)) { ?>
<hr size="1" />
<span>
<div class="dup-scan-good"><i class="fa fa-check"></i></div>
</span>
<b> <?php esc_html_e('Multisite: Detected', 'duplicator-pro'); ?></b> <br />
<div class="scan-system-subnote">
<?php esc_html_e('This license level has full access to all Multisite Plus+ features.', 'duplicator-pro'); ?>
</div>
<?php } else { ?>
<hr size="1" />
<span>
<div class="dup-scan-warn"><i class="fa fa-exclamation-triangle fa-sm"></i></div>
</span>
<b><?php esc_html_e('Multisite: Detected', 'duplicator-pro'); ?> </b> <br />
<div class="scan-system-subnote">
<?php esc_html(
sprintf(
__(
'Duplicator Pro is at the %1$s license level which allows for backups and migrations of an entire Multisite network.&nbsp;',
'duplicator-pro'
),
License::getLicenseToString()
)
); ?>
<br>
<?php echo wp_kses(
__(
"To unlock all <b>Multisite Plus</b> features please upgrade the license before building a Backup.",
'duplicator-pro'
),
['b' => []]
); ?>
<br />
<a href="<?php echo esc_url(License::getUpsellURL()); ?>" target='_blank'>
<?php esc_html_e('Upgrade Here', 'duplicator-pro'); ?>
</a>&nbsp;|&nbsp;
<a href="<?php echo esc_html(DUPLICATOR_DUPLICATOR_DOCS_URL); ?>how-does-duplicator-handle-multisite-support" target="_blank">
<?php esc_html_e('Multisite Plus Feature Overview', 'duplicator-pro'); ?>
</a>
</div>
<?php } ?>
</div>
</div>

View File

@@ -0,0 +1,124 @@
<?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
*/
use Duplicator\Controllers\PackagesPageController;
use Duplicator\Core\Controllers\ControllersManager;
$blur = $tplData['blur'];
$package_list_url = ControllersManager::getMenuLink(ControllersManager::PACKAGES_SUBMENU_SLUG);
?>
<form
id="form-duplicator"
class="<?php echo ($blur ? 'dup-mock-blur' : ''); ?> scan-result"
method="post"
action="<?php echo esc_attr($package_list_url); ?>"
>
<?php PackagesPageController::getInstance()->getActionByKey(PackagesPageController::ACTION_CREATE_FROM_TEMP)->getActionNonceFileds(); ?>
<div id="dup-progress-area">
<!-- PROGRESS BAR -->
<div class="dup-progress-bar-area">
<div class="dupli-title" >
<?php esc_html_e('Scanning Site', 'duplicator-pro'); ?>
</div>
<div class="dupli-meter-wrapper" >
<div class="dupli-meter green dupli-fullsize">
<span></span>
</div>
<span class="text"></span>
</div>
<b><?php esc_html_e('Please Wait...', 'duplicator-pro'); ?></b><br/><br/>
<i><?php esc_html_e('Keep this window open during the scan process.', 'duplicator-pro'); ?></i><br/>
<i><?php esc_html_e('This can take several minutes.', 'duplicator-pro'); ?></i><br/>
</div>
<!-- SCAN DETAILS REPORT -->
<div id="dup-msg-success" style="display:none">
<div style="text-align:center">
<div class="dup-hdr-success">
<i class="far fa-check-square fa-nr"></i> <?php esc_html_e('Scan Complete', 'duplicator-pro'); ?>
</div>
<div id="dup-msg-success-subtitle">
<?php esc_html_e("Process Time:", 'duplicator-pro'); ?> <span id="data-rpt-scantime"></span>
</div>
</div>
<div class="details">
<?php $tplMng->render('admin_pages/packages/scan/items/setup/main'); ?>
<br/>
<?php $tplMng->render('admin_pages/packages/scan/items/archive/main'); ?>
<?php $tplMng->render('admin_pages/packages/scan/items/database/main'); ?>
</div>
</div>
<!-- ERROR MESSAGE -->
<div id="dup-msg-error" style="display:none">
<div class="dup-hdr-error"><i class="fa fa-exclamation-circle"></i> <?php esc_html_e('Scan Error', 'duplicator-pro'); ?></div>
<i><?php esc_html_e('Please try again!', 'duplicator-pro'); ?></i><br/>
<div style="text-align:left">
<b><?php esc_html_e("Server Status:", 'duplicator-pro'); ?></b> &nbsp;
<div id="dup-msg-error-response-status" style="display:inline-block"></div><br/>
<b><?php esc_html_e("Error Message:", 'duplicator-pro'); ?></b>
<div id="dup-msg-error-response-text"></div>
</div>
</div>
</div>
<!-- WARNING CONTINUE -->
<div id="dupli-scan-warning-continue">
<div class="msg2">
<?php esc_html_e("Scan checks are not required to pass, however they could cause issues on some systems.", 'duplicator-pro'); ?>
<br/>
<?php esc_html_e("Please review the details for each section by clicking on the detail title.", 'duplicator-pro'); ?>
</div>
</div>
<div id="dupli-confirm-area">
<?php esc_html_e('Do you want to continue?', 'duplicator-pro'); ?>
<br/>
<?php esc_html_e('At least one or more checkboxes were checked in "Quick Filters".', 'duplicator-pro') ?>
<br/>
<i style="font-weight:normal">
<?php esc_html_e('To apply a "Quick Filter" click the "Add Filters & Rescan" button', 'duplicator-pro') ?>
</i><br/>
<input
type="checkbox"
id="dupli-confirm-check"
onclick="jQuery('#dup-build-button').removeAttr('disabled');"
class="margin-bottom-0"
>
<?php esc_html_e('Yes. Continue without applying any file filters.', 'duplicator-pro') ?>
</div>
<div class="dup-button-footer" style="display:none">
<input
type="button"
class="button hollow secondary small dup-go-back-to-new1"
value="&#9664; <?php esc_html_e("Back", 'duplicator-pro') ?>"
>
<input
type="button"
class="button hollow secondary small"
value="<?php esc_attr_e("Rescan", 'duplicator-pro') ?>"
onclick="DupliJs.Pack.reRunScanner()"
>
<input
type="button"
onclick="DupliJs.Pack.startBuild();"
class="button primary small"
id="dup-build-button"
value='<?php esc_attr_e("Create Backup", 'duplicator-pro') ?> &#9654'
>
</div>
</form>
<?php $tplMng->render('admin_pages/packages/scan/scripts'); ?>

View File

@@ -0,0 +1,922 @@
<?php
/**
* @package Duplicator
*/
use Duplicator\Ajax\ServicesPackage;
use Duplicator\Controllers\PackagesPageController;
use Duplicator\Libs\Snap\SnapWP;
use Duplicator\Views\UI\UiDialog;
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
*/
$alert2 = new UiDialog();
$alert2->height = 485;
$alert2->width = 650;
$alert2->title = __('Copy Quick Filter Paths', 'duplicator-pro');
$alert2->boxClass = 'arc-paths-dlg';
$alert2->message = "";
$alert2->initAlert();
$alert3 = new UiDialog();
$alert3->title = __('WARNING!', 'duplicator-pro');
$alert3->message = __('Manual copy of selected text required on this browser.', 'duplicator-pro');
$alert3->initAlert();
$alert4 = new UiDialog();
$alert4->title = $alert3->title;
$alert4->message = __('Error applying filters. Please go back to Step 1 to add filter manually!', 'duplicator-pro');
$alert4->initAlert();
$messageText = $tplMng->render('admin_pages/packages/scan/error_message', [], false);
?>
<script>
jQuery(document).ready(function($) {
var large_tree = $('#hb-files-large-jstree').length ? $('#hb-files-large-jstree') : null;
Handlebars.registerHelper('stripWPRoot', function(path) {
return path.replace('<?php echo esc_js(SnapWP::getHomePath(true)) ?>', '');
});
Handlebars.registerHelper('ifAllOr', function(v1, v2, v3, options) {
if (v1 || v2 || v3) {
return options.fn(this);
}
return options.inverse(this);
});
Handlebars.registerHelper('compare', function(v1, operator, v2, options) {
'use strict';
var operators = {
'==': v1 == v2 ? true : false,
'===': v1 === v2 ? true : false,
'!=': v1 != v2 ? true : false,
'!==': v1 !== v2 ? true : false,
'>': v1 > v2 ? true : false,
'>=': v1 >= v2 ? true : false,
'<': v1 < v2 ? true : false,
'<=': v1 <= v2 ? true : false,
'||': v1 || v2 ? true : false,
'&&': v1 && v2 ? true : false
}
if (operators.hasOwnProperty(operator)) {
if (operators[operator]) {
return options.fn(this);
}
return options.inverse(this);
}
return console.error('Error: Expression "' + operator + '" not found');
});
//Opens a dialog to show scan details
DupliJs.Pack.filesOff = function(dir) {
var $checks = $(dir).parent('div.directory').find('div.files input[type="checkbox"]');
$(dir).is(':checked') ?
$.each($checks, function() {
$(this).attr({
disabled: true,
checked: false,
title: "<?php esc_html_e('Directory applied filter set.', 'duplicator-pro'); ?>"
});
}) :
$.each($checks, function() {
$(this).removeAttr('disabled checked title');
});
}
DupliJs.Pack.FilterButton = {
loading: function(btn) {
$(btn).html('<i class="fas fa-circle-notch fa-spin"></i> <?php esc_html_e('Initializing Please Wait...', 'duplicator-pro'); ?>');
$(btn).prop('disabled', true);
$('#dup-build-button').prop('disable', true);
},
reset: function(btn) {
$(btn).html('<i class="fa fa-filter fa-sm"></i> <?php esc_html_e("Add Filters &amp; Rescan", "duplicator-pro"); ?>');
$(btn).prop('disabled', true);
$('#dup-build-button').prop('disable', false);
}
};
//Opens a dialog to show scan details
DupliJs.Pack.showPathsDlg = function(type) {
var filters = DupliJs.Pack.getFiltersLists(type);
var dirFilters = filters.dir;
var fileFilters = filters.file;
var $dirs = $('#dup-archive-paths textarea.path-dirs');
var $files = $('#dup-archive-paths textarea.path-files');
(dirFilters.length > 0) ?
$dirs.text(dirFilters.join(";\n")): $dirs.text("<?php esc_html_e('No directories have been selected!', 'duplicator-pro'); ?>");
(fileFilters.length > 0) ?
$files.text(fileFilters.join(";\n")): $files.text("<?php esc_html_e('No files have been selected!', 'duplicator-pro'); ?>");
$('.arc-paths-dlg').html($('#dup-archive-paths').html());
<?php $alert2->showAlert(); ?>
return;
};
//Toggles a directory path to show files
DupliJs.Pack.toggleDirPath = function(item) {
var $dir = $(item).parents('div.directory');
var $files = $dir.find('div.files');
var $arrow = $dir.find('i.dup-nav');
if ($files.is(":hidden")) {
$arrow.addClass('fa-caret-down').removeClass('fa-caret-right');
$files.show();
} else {
$arrow.addClass('fa-caret-right').removeClass('fa-caret-down');
$files.hide(250);
}
}
//Toggles a directory path to show files
DupliJs.Pack.toggleAllDirPath = function(chkBox, toggle) {
(toggle == 'hide') ?
$('#hb-files-large-jstree').jstree().close_all(): $('#hb-files-large-jstree').jstree().open_all();
}
DupliJs.Pack.copyText = function(btn, query) {
$(query).select();
try {
document.execCommand('copy');
$(btn).css({
color: '#fff',
backgroundColor: 'green'
});
$(btn).text("<?php esc_html_e('Copied to Clipboard!', 'duplicator-pro'); ?>");
} catch (err) {
<?php $alert3->showAlert(); ?>
}
}
DupliJs.Pack.getFiltersLists = function(type) {
var result = {
'dir': [],
'file': []
};
switch (type) {
case 'large':
console.log(large_tree);
if (large_tree) {
$.each(large_tree.jstree("get_checked", null, true), function(index, value) {
var original = large_tree.jstree(true).get_node(value).original;
if (original.type.startsWith('folder')) {
result.dir.push(original.fullPath);
} else {
result.file.push(original.fullPath);
}
});
}
break;
case 'addon':
var id = '#hb-addon-sites-result';
if ($(id).length) {
$(id + " input[name='dir_paths[]']:checked").each(function() {
result.dir.push($(this).val());
});
$(id + " input[name='file_paths[]']:checked").each(function() {
result.file.push($(this).val());
});
}
break;
}
return result;
};
DupliJs.Pack.applyFilters = function(btn, type) {
var filterButton = btn;
var filters = DupliJs.Pack.getFiltersLists(type);
var dirFilters = filters.dir;
var fileFilters = filters.file;
if (dirFilters.length === 0 && fileFilters.length === 0) {
alert('No filter selected');
return false;
}
dirFilters = dirFilters.map(function(path) {
return path.slice(-1) !== '\/' ? path + '\/' : path;
});
DupliJs.Pack.FilterButton.loading(filterButton);
var data = {
action: 'duplicator_add_quick_filters',
nonce: <?php echo json_encode(wp_create_nonce('duplicator_add_quick_filters')); ?>,
dir_paths: dirFilters.join(";"),
file_paths: fileFilters.join(";")
};
$.ajax({
type: "POST",
cache: false,
dataType: 'json',
url: ajaxurl,
timeout: 100000,
data: data,
complete: function() {},
success: function(data) {
DupliJs.Pack.reRunScanner(function() {
DupliJs.Pack.FilterButton.reset(filterButton);
DupliJs.Pack.fullLoadButtonInit();
});
},
error: function(data) {
console.log(data);
<?php $alert4->showAlert(); ?>
}
});
return false;
};
DupliJs.Pack.treeContextMenu = function(node) {
var items = {};
if (node.type.startsWith('folder')) {
items = {
selectAll: {
label: "<?php esc_html_e('Select all childs files and folders', 'duplicator-pro'); ?>",
action: function(obj) {
$(obj.reference).parent().find('> .jstree-children .warning-node > .jstree-anchor:not(.jstree-checked) .jstree-checkbox')
.each(function() {
var _this = $(this);
if (_this.parents('.selected-node').length === 0) {
_this.trigger('click');
}
});
}
},
selectAllFiles: {
label: "<?php esc_html_e('Select only all childs files', 'duplicator-pro'); ?>",
action: function(obj) {
$(obj.reference).parent().find('> .jstree-children .file-node.warning-node > .jstree-anchor:not(.jstree-checked) .jstree-checkbox')
.each(function() {
var _this = $(this);
if (_this.parents('.selected-node').length === 0) {
_this.trigger('click');
}
});
}
},
unselectAll: {
label: "<?php esc_html_e('Unselect all childs elements', 'duplicator-pro'); ?>",
action: function(obj) {
$(obj.reference).parent().find('> .jstree-children .jstree-node > .jstree-anchor.jstree-checked .jstree-checkbox').trigger('click');
}
}
};
}
return items;
};
DupliJs.Pack.getTreeFolderUrlData = function(folder, excludeList) {
if (excludeList === undefined) {
excludeList = [];
}
return {
'nonce': <?php echo json_encode(wp_create_nonce('duplicator_get_folder_children')); ?>,
'action': 'duplicator_get_folder_children',
'folder': folder,
'exclude': excludeList
};
};
DupliJs.Pack.getTreeFolderUrl = function(folder, excludeList) {
return ajaxurl + '?' + $.param(DupliJs.Pack.getTreeFolderUrlData(folder, excludeList));
};
DupliJs.Pack.fullLoadNodes = null;
DupliJs.Pack.fullLoadFolder = function(tree, index, sectionContainer) {
if (Array.isArray(DupliJs.Pack.fullLoadNodes) && index < DupliJs.Pack.fullLoadNodes.length) {
var parent = DupliJs.Pack.fullLoadNodes[index];
if (index === 0 && sectionContainer) {
sectionContainer.append('<div class="tree-loader" >' +
'<div class="container-wrapper" >' +
'<i class="fa fa-cog fa-lg fa-spin"></i> <span></span>' +
'</div>' +
'</div>');
}
sectionContainer.find('.tree-loader span').text("<?php echo esc_js(__('Loading ', 'duplicator-pro')) ?>" + parent.original.fullPath);
} else {
DupliJs.Pack.fullLoadNodes = null;
if (sectionContainer) {
sectionContainer.find('.tree-loader').remove();
}
return;
}
var excludeList = [];
var parentClass = parent.li_attr.class;
if (parentClass.indexOf('root-node') !== -1 && parentClass.indexOf('no-warnings') !== -1) {
tree.delete_node(parent.children[0]);
} else {
for (i = 0; i < parent.children.length; i++) {
excludeList.push(tree.get_node(parent.children[i]).original.fullPath.replace(/^.*[\\\/]/, ''));
}
}
var data = DupliJs.Pack.getTreeFolderUrlData(parent.original.fullPath, excludeList);
$.ajax({
type: "GET",
cache: false,
data: data,
dataType: "json",
url: ajaxurl,
timeout: 100000,
//data: data,
complete: function() {},
success: function(data) {
try {
for (i = 0; i < data.length; i++) {
tree.create_node(parent, data[i]);
}
DupliJs.Pack.fullLoadFolder(tree, index + 1, sectionContainer);
} catch (err) {
console.error(err);
console.error('JSON parse failed for response data: ' + respData);
console.log(respData);
<?php $alert4->showAlert(); ?>
return false;
}
},
error: function(data) {
console.log(data);
<?php $alert4->showAlert(); ?>
}
});
};
function resetTreeLoadButton() {
$('.tree-full-load-button')
.removeClass('isLoaded dup-tree-hide-all')
.addClass('dup-tree-show-all')
.text("<?php echo esc_js(__('show all', 'duplicator-pro')); ?>")
}
DupliJs.Pack.fullLoadButtonInit = function() {
resetTreeLoadButton();
$('.tree-full-load-button')
.off()
.click(function() {
var sectionContainer = $(this).closest('.dup-tree-section').find('> .container');
var cObj = $(this);
var domTree = sectionContainer.find(".dup-tree-main-wrapper");
var tree = domTree.jstree(true);
if (cObj.hasClass('dup-tree-show-all')) {
cObj.removeClass('dup-tree-show-all')
.addClass('dup-tree-hide-all')
.text("<?php echo esc_js(__('show warning only', 'duplicator-pro')) ?>");
if (!cObj.hasClass('isLoaded')) {
cObj.addClass('isLoaded');
DupliJs.Pack.fullLoadNodes = [];
domTree.find(".folder-node[data-full-loaded=false]").each(function() {
var parent = tree.get_node($(this));
if (parent.state.loaded === false) {
// If loaded it is false the folder has never been opened then it will be loaded by jstree if it is opened.
return;
}
DupliJs.Pack.fullLoadNodes.push(parent);
});
if (DupliJs.Pack.fullLoadNodes.length) {
DupliJs.Pack.fullLoadFolder(tree, 0, sectionContainer);
} else {
DupliJs.Pack.fullLoadNodes = null;
}
} else {
domTree.find(".root-node .jstree-node:not(.warning-childs):not(.warning-node)").each(function() {
// don't use the tree functions show_node and hide_node are too slow.
$(this).removeClass('jstree-hidden');
});
}
} else {
cObj.removeClass('dup-tree-hide-all').addClass('dup-tree-show-all')
.text("<?php echo esc_js(__('show all', 'duplicator-pro')); ?>");
domTree.find(".root-node .jstree-node:not(.warning-node):not(.warning-childs)").each(function() {
// don't use the tree functions show_node and hide_node are too slow.
$(this).addClass('jstree-hidden');
});
}
// recalculate the last child manually
domTree.find(".jstree-children").each(function() {
$(this).find('> li:not(.jstree-hidden)').removeClass('jstree-last').last().addClass('jstree-last');
});
});
};
DupliJs.Pack.initTree = function(tree, data, filterBtn) {
var treeObj = tree;
var nameData = data;
console.log('nameData', nameData);
treeObj.jstree('destroy');
treeObj.jstree({
'core': {
"check_callback": true,
'cache': false,
//'data' : nameData,
"themes": {
"name": "snap",
"dots": true,
"icons": true,
"stripes": true,
},
'data': {
'url': function(node) {
var folder = (node.id === '#') ? '' : node.original.fullPath;
return DupliJs.Pack.getTreeFolderUrl(folder);
},
'data': function(node) {
return {
'id': node.id
};
}
}
},
'types': {
"folder": {
"icon": "jstree-icon jstree-folder",
"li_attr": {
"class": 'folder-node'
}
},
"file": {
"icon": "jstree-icon jstree-file",
"li_attr": {
"class": 'file-node'
}
},
"info-text": {
"icon": "jstree-noicon",
"li_attr": {
"class": 'info-node'
}
}
},
"checkbox": {
// a boolean indicating if checkboxes should be visible (can be changed at a later time using
// `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`.
visible: true,
// a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`.
three_state: false,
// a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`.
whole_node: false,
keep_selected_style: false, // a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`.
// This setting controls how cascading and undetermined nodes are applied.
// If 'up' is in the string - cascading up is enabled, if 'down' is in the string - cascading down is enabled,
// if 'undetermined' is in the string - undetermined nodes will be used.
// If `three_state` is set to `true` this setting is automatically set to 'up+down+undetermined'. Defaults to ''.
cascade: '',
// This setting controls if checkbox are bound to the general tree selection or
// to an internal array maintained by the checkbox plugin. Defaults to `true`, only set to `false` if you know exactly what you are doing.
tie_selection: false,
cascade_to_disabled: false, // This setting controls if cascading down affects disabled checkboxes
cascade_to_hidden: false //This setting controls if cascading down affects hidden checkboxes
},
"contextmenu": {
"items": DupliJs.Pack.treeContextMenu
},
"plugins": [
"checkbox",
"contextmenu",
"types",
//"dnd",
//"massload",
//"search",
//"sort",
//"state",
//"types",
//"unique",
//"wholerow",
"changed",
//"conditionalselect"
]
}).on('check_node.jstree', function(e, data) {
treeObj.find('#' + data.node.id).addClass('selected-node');
filterBtn.prop("disabled", false);
}).on('uncheck_node.jstree', function(e, data) {
treeObj.find('#' + data.node.id).removeClass('selected-node');
if (treeObj.jstree("get_selected").length === 0) {
filterBtn.prop("disabled", true);
}
}).on('ready.jstree', function() {
// insert data
tree.jstree(true).create_node(null, nameData);
});
};
DupliJs.Pack.initArchiveFilesData = function(data) {
//TOTAL SIZE
$('#data-arc-size1').text(data.ARC.Size || errMsg);
$('#data-arc-size2').text(data.ARC.Size || errMsg);
$('#data-arc-files').text(data.ARC.FileCount || errMsg);
$('#data-arc-dirs').text(data.ARC.DirCount || errMsg);
$('#data-arc-fullcount').text(data.ARC.FullCount || errMsg);
//LARGE FILES
if ($("#hb-files-large-result").length) {
DupliJs.Pack.initTree(
large_tree,
data.ARC.FilterInfo.TreeSize,
$("#hb-files-large-result .dupli-quick-filter-btn")
);
}
//ADDON SITES
if ($("#hb-addon-sites").length) {
var template = $('#hb-addon-sites').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('#hb-addon-sites-result').html(html);
}
//UNREADABLE FILES
if ($("#unreadable-files").length) {
var template = $('#unreadable-files').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('#unreadable-files-result').html(html);
}
//SCANNER DETAILS: Dirs
if ($("#hb-filter-file-list").length) {
var template = $('#hb-filter-file-list').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('div.hb-filter-file-list-result').html(html);
}
//NETWORK SITES
if ($("#hb-filter-network-sites").length) {
var template = $('#hb-filter-network-sites').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('#hb-filter-network-sites-result').html(html);
}
//MIGRATE PACKAGE
if ($("#hb-migrate-package-result").length) {
var template = $('#hb-migrate-package-result').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('#migrate-package-result').html(html);
}
//Security Plugins
if ($("#hb-dup-security-plugins").length) {
var template = $('#hb-dup-security-plugins').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('#dup-security-plugins').html(html);
}
//SHOW CREATE
if ($("#hb-showcreatefunc-result").length) {
var template = $('#hb-showcreatefunc-result').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('#showcreatefunc-package-result').html(html);
}
//TRIGGERS
if ($("#hb-triggers-result").length) {
var template = $('#hb-triggers-result').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('#triggers-result').html(html);
}
//MYSQLDUMP LIMIT
if ($("#hb-mysqldump-limit-result").length) {
var template = $('#hb-mysqldump-limit-result').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('#mysqldump-limit-result').html(html);
}
DuplicatorTooltip.reload();
};
DupliJs.Pack.fullLoadButtonInit();
$("#form-duplicator").on('change', "#hb-files-large-result input[type='checkbox'], #hb-addon-sites-result input[type='checkbox']", function() {
if ($("#hb-addon-sites-result input[type='checkbox']:checked").length) {
var addon_disabled_prop = false;
} else {
var addon_disabled_prop = true;
}
$("#hb-addon-sites-result .dupli-quick-filter-btn").prop("disabled", addon_disabled_prop);
});
DupliJs.Pack.WebServiceStatus = {
Pass: <?php echo json_encode(ServicesPackage::EXEC_STATUS_PASS); ?>,
Warn: <?php echo json_encode(ServicesPackage::EXEC_STATUS_WARN); ?>, //deprecated
Error: <?php echo json_encode(ServicesPackage::EXEC_STATUS_FAIL); ?>,
MoreToScan: <?php echo json_encode(ServicesPackage::EXEC_STATUS_MORE_TO_SCAN); ?>,
ScheduleRunning: <?php echo json_encode(ServicesPackage::EXEC_STATUS_SCHEDULE_RUNNING); ?>
}
let errorMessage = <?php echo json_encode($messageText); ?>;
let scanTimeoutInSec = <?php echo json_encode(GlobalEntity::getInstance()->php_max_worker_time_in_sec); ?>;
let scanTimeout = (scanTimeoutInSec + 10) * 1000; // Add 10 seconds to the backend timeout
DupliJs.Pack.runScanner = function(callbackOnSuccess, firstChunk = false) {
DupliJs.Util.ajaxWrapper({
action: 'duplicator_package_scan',
firstChunk: firstChunk,
nonce: <?php echo json_encode(wp_create_nonce('duplicator_package_scan')); ?>
},
function(result, data, funcData, textStatus, jqXHR) {
var status = funcData.Status || 3;
var message = funcData.Message ||
"Unable to read JSON from service. <br/> See: /wp-admin/admin-ajax.php?action=duplicator_package_scan";
if (status == DupliJs.Pack.WebServiceStatus.MoreToScan) {
console.log('Continue with next scan chunk...');
DupliJs.Pack.runScanner(callbackOnSuccess);
return;
}
// Scan finished, parse results
if (status == DupliJs.Pack.WebServiceStatus.Pass) {
DupliJs.Pack.loadScanData(funcData);
if (typeof callbackOnSuccess === "function") {
callbackOnSuccess(funcData);
}
$('.dup-button-footer').show();
} else if (status == DupliJs.Pack.WebServiceStatus.ScheduleRunning) {
console.log('Scan is already running...');
window.location.href = <?php echo json_encode(PackagesPageController::getInstance()->getPackageBuildS1Url()); ?>;
} else {
$('.dup-progress-bar-area, #dup-build-button').hide();
$('#dup-msg-error-response-status').html(status);
$('#dup-msg-error-response-text').html(message + errorMessage);
$('#dup-msg-error').show();
$('.dup-button-footer').show();
}
},
function(result, data, funcData, textStatus, jqXHR) {
var status = data.status + ' -' + data.statusText;
$('.dup-progress-bar-area, #dup-build-button').hide();
$('#dup-msg-error-response-status').html(status)
$('#dup-msg-error-response-text').html(data.message + errorMessage);
$('#dup-msg-error, .dup-button-footer').show();
console.log(data);
}, {
showProgress: false,
timeout: scanTimeout
}
);
}
DupliJs.Pack.reRunScanner = function(callbackOnSuccess) {
$('#dup-msg-success,#dup-msg-error,.dup-button-footer,#dupli-confirm-area').hide();
$('#dupli-confirm-check').prop('checked', false);
$('.dup-progress-bar-area').show();
$('#dupli-scan-warning-continue').hide();
resetTreeLoadButton();
DupliJs.Pack.runScanner(callbackOnSuccess, true);
}
DupliJs.Pack.loadScanData = function(data) {
try {
var errMsg = "unable to read";
$('.dup-progress-bar-area').hide();
//****************
// BRAND
// #data-srv-brand-check
// #data-srv-brand-name
// #data-srv-brand-note
$("#data-srv-brand-name").text(data.SRV.Brand.Name);
if (data.SRV.Brand.LogoImageExists) {
$("#data-srv-brand-note").html(data.SRV.Brand.Notes);
} else {
$("#data-srv-brand-note")
.html(`<?php
esc_html_e(
"WARNING! Logo images no longer can be found inside brand. Please edit this brand and place new images.
After that you can build your Backup with this brand.",
"duplicator-pro"
); ?>`);
}
//****************
//REPORT
var base = $('#data-rpt-scanfile').attr('href');
$('#data-rpt-scanfile').attr('href', base + '&scanfile=' + data.RPT.ScanFile);
$('#data-rpt-scantime').text(data.RPT.ScanTime || 0);
DupliJs.Pack.initArchiveFilesData(data);
DupliJs.Pack.setScanStatus(data);
//Addon Sites
if (data.ARC.FilterInfo.Dirs.AddonSites !== undefined && data.ARC.FilterInfo.Dirs.AddonSites.length > 0) {
$("#addonsites-block").show();
}
$('#dup-msg-success').show();
//****************
//DATABASE
var html = "";
var DB_TableRowMax = <?php echo (int) DUPLICATOR_SCAN_DB_TBL_ROWS; ?>;
var DB_TableSizeMax = <?php echo (int) DUPLICATOR_SCAN_DB_TBL_SIZE; ?>;
if (data.DB.DBExcluded && data.DB.Status.Success) {
$('#data-db-size1').text(data.DB.Size || errMsg);
} else if (data.DB.Status.Success) {
$('#data-db-size1').text(data.DB.Size || errMsg);
$('#data-db-size2').text(data.DB.Size || errMsg);
$('#data-db-rows').text(data.DB.Rows || errMsg);
$('#data-db-tablecount').text(data.DB.TableCount || errMsg);
//Table Details
if (data.DB.TableList == undefined || data.DB.TableList.length == 0) {
html = '<?php esc_html_e("Unable to report on any tables", 'duplicator-pro') ?>';
} else {
$.each(data.DB.TableList, function(i) {
html += '<b>' + i + '</b><br/>';
html += '<table><tr>';
$.each(data.DB.TableList[i], function(key, val) {
switch (key) {
case 'Case':
color = (val == 1) ? 'maroon' : 'black';
html += '<td style="color:' + color + '"><?php echo esc_js(__('Uppercase:', 'duplicator-pro')) ?> ' + val + '</td>';
break;
case 'Rows':
color = (val > DB_TableRowMax) ? 'red' : 'black';
html += '<td style="color:' + color + '"><?php echo esc_js(__('Rows:', 'duplicator-pro')) ?> ' + val + '</td>';
break;
case 'USize':
color = (parseInt(val) > DB_TableSizeMax) ? 'red' : 'black';
html += '<td style="color:' + color + '">';
html += '<?php echo esc_js(__('Size:', 'duplicator-pro')) ?> ' + data.DB.TableList[i]['Size'];
html += '</td>';
break;
}
});
html += '</tr></table>';
});
}
$('#data-db-tablelist').html(html);
} else {
html = '<?php esc_html_e("Unable to report on database stats", 'duplicator-pro') ?>';
$('#dup-scan-db').html(html);
}
var isWarn = false;
for (key in data.ARC.Status) {
if (!data.ARC.Status[key]) {
isWarn = true;
}
}
if (!isWarn) {
if (!data.DB.Status.Size) {
isWarn = true;
}
}
if (!isWarn && !data.DB.Status.Rows) {
isWarn = true;
}
if (!isWarn && !data.SRV.PHP.ALL) {
isWarn = true;
}
if (!isWarn && (data.SRV.WP.version == false || data.SRV.WP.core == false)) {
isWarn = true;
}
if (isWarn) {
$('#dupli-scan-warning-continue').show();
} else {
$('#dupli-scan-warning-continue').hide();
$('#dup-build-button').prop("disabled", false);
}
} catch (err) {
err += '<br/> Please try again!'
$('#dup-msg-error-response-status').html("n/a")
$('#dup-msg-error-response-text').html(err);
$('#dup-msg-error, .dup-button-footer').show();
$('#dup-build-button').hide();
}
}
//Starts the build process
DupliJs.Pack.startBuild = function() {
// disable to prevent double click
$('#dup-build-button').prop('disabled', true);
if ($('#dupli-confirm-check').is(":checked")) {
$('#form-duplicator').submit();
}
var sizeChecks = $('#hb-files-large-jstree').length ? $('#hb-files-large-jstree').jstree(true).get_checked() : 0;
var addonChecks = $('#hb-addon-sites-result input:checked');
var utf8Checks = $('#hb-files-utf8-jstree').length ? $('#hb-files-utf8-jstree').jstree(true).get_checked() : 0;
if (sizeChecks.length > 0 || addonChecks.length > 0 || utf8Checks.length > 0) {
$('#dupli-confirm-area').show();
} else {
$('#form-duplicator').submit();
}
}
//Toggles each scan item to hide/show details
DupliJs.Pack.toggleScanItem = function(item) {
var $info = $(item).parents('div.scan-item').children('div.info');
var $text = $(item).find('div.text i.fa');
if ($info.is(":hidden")) {
$text.addClass('fa-caret-down').removeClass('fa-caret-right');
$info.show();
} else {
$text.addClass('fa-caret-right').removeClass('fa-caret-down');
$info.hide(250);
}
}
//Set Good/Warn Badges and checkboxes
DupliJs.Pack.setScanStatus = function(data) {
let subTestSelectorMappings = {
'#data-srv-php-websrv': data.SRV.PHP.websrv,
'#data-srv-php-openbase': data.SRV.PHP.openbase || !data.ARC.PathsOutOpenbaseDir.length,
'#data-srv-php-maxtime': data.SRV.PHP.maxtime,
'#data-srv-php-minmemory': data.SRV.PHP.minMemory,
'#data-srv-php-arch64bit': data.SRV.PHP.arch64bit,
'#data-srv-php-mysqli': data.SRV.PHP.mysqli,
'#data-srv-php-openssl': data.SRV.PHP.openssl,
'#data-srv-php-allowurlfopen': data.SRV.PHP.allowurlfopen,
'#data-srv-php-curlavailable': data.SRV.PHP.curlavailable,
'#data-srv-php-version': data.SRV.PHP.version,
'#data-srv-wp-version': data.SRV.WP.version,
'#data-srv-brand-check': data.SRV.Brand.LogoImageExists,
'#data-srv-wp-core': data.SRV.WP.core
};
for (let selector in subTestSelectorMappings) {
if (subTestSelectorMappings[selector]) {
$(selector).html('<div class="scan-good"><i class="fa fa-check"></i></div>');
} else {
$(selector).html('<div class="scan-warn"><i class="fa fa-exclamation-triangle fa-sm"></i></div>');
}
}
let testSelectorMappings = {
'#data-srv-php-all': data.SRV.PHP.ALL,
'#data-srv-wp-all': data.SRV.WP.ALL,
'#data-arc-status-size': data.ARC.Status.Size,
'#data-arc-status-unreadablefiles': data.ARC.Status.UnreadableItems,
'#data-arc-status-showcreatefunc': data.ARC.Status.showCreateFuncStatus,
'#data-arc-status-network': data.ARC.Status.Network,
'#data-arc-status-triggers': data.DB.Status.Triggers,
'#data-arc-status-migratepackage': !data.ARC.Status.PackageIsNotImportable,
'#data-arc-status-addonsites': data.ARC.Status.AddonSites,
'#data-db-status-size1': data.DB.DBExcluded && data.DB.Status.Success ? data.DB.Status.Excluded : data.DB.Status.Size,
}
const GoodText = "<?php esc_html_e('Good', 'duplicator-pro'); ?>";
const WarnText = "<?php esc_html_e('Notice', 'duplicator-pro'); ?>";
for (let selector in testSelectorMappings) {
if (testSelectorMappings[selector]) {
$(selector).html(`<div class="badge badge-pass">${GoodText}</div>`);
} else {
$(selector).html(`<div class="badge badge-warn">${WarnText}</div>`);
}
}
}
//Allows user to continue with build if warnings found
DupliJs.Pack.warningContinue = function(checkbox) {
($(checkbox).is(':checked')) ?
$('#dup-build-button').prop('disabled', false): $('#dup-build-button').prop('disabled', true);
}
//Page Init:
DupliJs.Pack.runScanner(null, true);
$('.dup-go-back-to-new1').click(function(event) {
event.preventDefault();
window.location.href = <?php echo json_encode(PackagesPageController::getInstance()->getPackageBuildS1Url()); ?>;
});
});
</script>

View File

@@ -0,0 +1,45 @@
<?php
/**
* @package Duplicator
*/
use Duplicator\Core\Controllers\ControllersManager;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
*/
?>
<form
id="form-duplicator scan-result"
method="post"
action="<?php echo esc_attr(ControllersManager::getMenuLink(ControllersManager::PACKAGES_SUBMENU_SLUG)); ?>"
>
<!-- ERROR MESSAGE -->
<div id="dup-msg-error">
<div class="dup-hdr-error"><i class="fa fa-exclamation-circle"></i> <?php esc_html_e('Input fields not valid', 'duplicator-pro'); ?></div>
<i><?php esc_html_e('Please try again!', 'duplicator-pro'); ?></i><br/>
<div style="text-align:left">
<b><?php esc_html_e("Server Status:", 'duplicator-pro'); ?></b> &nbsp;
<div id="dup-msg-error-response-status" style="display:inline-block"></div><br/>
<b><?php esc_html_e("Error Message:", 'duplicator-pro'); ?></b>
<div id="dup-msg-error-response-text">
<ul>
<?php $tplData['validator']->getErrorsFormat("<li>%s</li>"); ?>
</ul>
</div>
</div>
</div>
<input
type="button"
value="&#9664; <?php esc_html_e("Back", 'duplicator-pro') ?>"
class="button hollow secondary dup-go-back-to-new1"
>
</form>