first commit

This commit is contained in:
2026-04-20 13:11:14 +02:00
commit e0b63ca5f9
7793 changed files with 1844488 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
defined("ABSPATH") or die("");
use Duplicator\Controllers\ToolsPageController;
use Duplicator\Core\Controllers\ControllersManager;
use Duplicator\Core\Views\TplMng;
?>
<?php TplMng::getInstance()->render('admin_pages/diagnostics/purge_orphans_message'); ?>
<?php TplMng::getInstance()->render('admin_pages/diagnostics/clean_tmp_cache_message'); ?>
<?php TplMng::getInstance()->render('parts/migration/migration-message'); ?>
<form id="dup-settings-form" action="<?php echo ControllersManager::getCurrentLink(); ?>" method="post">
<?php
include_once(DUPLICATOR____PATH . '/views/tools/diagnostics/inc.data.php');
include_once(DUPLICATOR____PATH . '/views/tools/diagnostics/inc.settings.php');
include_once(DUPLICATOR____PATH . '/views/tools/diagnostics/inc.validator.php');
include_once(DUPLICATOR____PATH . '/views/tools/diagnostics/inc.phpinfo.php');
?>
</form>
<?php
$deleteOptConfirm = new DUP_PRO_UI_Dialog();
$deleteOptConfirm->title = __('Are you sure you want to delete?', 'duplicator-pro');
$deleteOptConfirm->message = __('Delete this option value.', 'duplicator-pro');
$deleteOptConfirm->progressText = __('Removing, Please Wait...', 'duplicator-pro');
$deleteOptConfirm->jsCallback = 'DupPro.Settings.DeleteThisOption(this)';
$deleteOptConfirm->initConfirm();
$removeCacheConfirm = new DUP_PRO_UI_Dialog();
$removeCacheConfirm->title = __('This process will remove all build cache files.', 'duplicator-pro');
$removeCacheConfirm->message = __('Be sure no packages are currently building or else they will be cancelled.', 'duplicator-pro');
$removeCacheConfirm->progressText = $deleteOptConfirm->progressText;
$removeCacheConfirm->jsCallback = 'DupPro.Tools.ClearBuildCacheRun()';
$removeCacheConfirm->initConfirm();
?>
<script>
jQuery(document).ready(function ($) {
DupPro.Tools.removeInstallerFiles = function () {
window.location = <?php echo json_encode(ToolsPageController::getInstance()->getCleanFilesAcrtionUrl()); ?>;
return false;
};
DupPro.Tools.ClearBuildCache = function () {
<?php $removeCacheConfirm->showConfirm(); ?>
};
DupPro.Tools.ClearBuildCacheRun = function () {
window.location = <?php echo json_encode(ToolsPageController::getInstance()->getRemoveCacheActionUrl()); ?>;
};
});
</script>

View File

@@ -0,0 +1,123 @@
<?php
use Duplicator\Addons\ProBase\License\License;
use Duplicator\Controllers\ToolsPageController;
use Duplicator\Core\CapMng;
use Duplicator\Core\MigrationMng;
defined("ABSPATH") or die("");
global $wpdb;
$orphaned_filepaths = DUP_PRO_Server::getOrphanedPackageFiles();
$view_state = DUP_PRO_UI_ViewState::getArray();
$ui_css_data_panel = (isset($view_state['dup-settings-diag-opts-panel']) && $view_state['dup-settings-diag-opts-panel']) ? 'display:block' : 'display:none';
$ui_css_data_panel = (isset($_GET['orphanpurge']) && $_GET['orphanpurge'] == '1') ? 'display:block' : $ui_css_data_panel;
?>
<!-- ==============================
STORED DATA -->
<div class="dup-box">
<div class="dup-box-title">
<i class="fas fa-th-list fa-sm"></i>
<?php esc_html_e("Data Cleanup", 'duplicator-pro'); ?>
<button class="dup-box-arrow">
<span class="screen-reader-text"><?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Stored Data', 'duplicator-pro') ?></span>
</button>
</div>
<div class="dup-box-panel" id="dup-settings-diag-opts-panel" style="<?php echo esc_attr($ui_css_data_panel) ?>" >
<table class="dpro-reset-opts">
<tr valign="top">
<td>
<button
type="button"
class="dpro-store-fixed-btn button button-small"
id="dpro-remove-installer-files-btn"
onclick="DupPro.Tools.removeInstallerFiles()"
>
<?php esc_html_e("Delete Installation Files", 'duplicator-pro'); ?>
</button>
</td>
<td>
<?php esc_html_e("Removes all reserved installation files.", 'duplicator-pro'); ?>
<a href="javascript:void(0)" onclick="jQuery('#dpro-tools-delete-moreinfo').toggle()">[<?php esc_html_e("more info", 'duplicator-pro'); ?>]</a>
<br/>
<div id="dpro-tools-delete-moreinfo">
<p>
<?php
esc_html_e(
"Clicking on the 'Remove Installation Files' button will remove the following installation files.
These files are typically from a previous Duplicator install.
If you are unsure of the source, please validate the files.
These files should never be left on production systems for security reasons.
Below is a list of all the installation files used by Duplicator.
Please be sure these are removed from your server.",
'duplicator-pro'
);
?>
<p>
<p>
<?php
foreach (MigrationMng::getGenericInstallerFiles() as $instFileName) {
?>
<span class="success">
<?php echo esc_html($instFileName); ?>
</span><br>
<?php
}
?>
</p>
</div>
</td>
</tr>
<?php if (CapMng::can(CapMng::CAP_CREATE, false)) { ?>
<tr valign="top">
<td>
<a
type="button"
class="dpro-store-fixed-btn button button-small"
href="<?php echo esc_url(ToolsPageController::getInstance()->getPurgeOrphanActionUrl()); ?>"
>
<?php esc_html_e("Delete Package Orphans", 'duplicator-pro'); ?>
</a>
</td>
<td>
<?php esc_html_e("Removes all package files NOT found in the packages screen.", 'duplicator-pro'); ?>
<a href="javascript:void(0)" onclick="jQuery('#dpro-tools-delete-orphans-moreinfo').toggle()">[<?php esc_html_e("more info", 'duplicator-pro'); ?>]</a>
<br/>
<div id="dpro-tools-delete-orphans-moreinfo">
<?php
if (count($orphaned_filepaths) > 0) {
esc_html_e(
"Clicking on the 'Delete Package Orphans' button will remove the following files.
Orphaned files are typically generated from previous installations of Duplicator.
They may also exist if they did not get properly removed when they were selected from the main packages screen.
The files below are no longer associated with active packages in the main Packages screen and should be safe to remove.
<b>IMPORTANT: Don't click button if you want to retain any of the following files:</b>",
'duplicator-pro'
);
echo "<br/><br/>";
foreach ($orphaned_filepaths as $filepath) {
echo "<div class='failed'><i class='fa fa-exclamation-triangle'></i> " . esc_html($filepath) . " </div>";
}
} else {
esc_html_e('No orphaned package files found.', 'duplicator-pro');
}
?>
</div>
</td>
</tr>
<tr>
<td>
<button type="button" class="dpro-store-fixed-btn button button-small" onclick="DupPro.Tools.ClearBuildCache()">
<?php esc_html_e("Clear Build Cache", 'duplicator-pro'); ?>
</button>
</td>
<td><?php esc_html_e('Removes all build data from:', 'duplicator-pro'); ?> [<?php echo esc_html(DUPLICATOR_PRO_SSDIR_PATH_TMP); ?>].</td>
</tr>
<?php } ?>
</table>
</div>
</div>
<br/>

View File

@@ -0,0 +1,32 @@
<?php
use Duplicator\Libs\Snap\SnapUtil;
defined("ABSPATH") or die("");
ob_start();
SnapUtil::phpinfo();
$serverinfo = preg_replace('/.*<body>(.*?)<\/body>.*/s', '$1', ob_get_clean());
?>
<!-- ==============================
PHP INFORMATION -->
<div class="dup-box">
<div class="dup-box-title">
<i class="fa fa-info-circle"></i>
<?php esc_html_e("PHP Information", 'duplicator-pro'); ?>
<button class="dup-box-arrow">
<span class="screen-reader-text"><?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('PHP Information', 'duplicator-pro') ?></span>
</button>
</div>
<div class="dup-box-panel" style="display:none">
<div id="dup-phpinfo" style="width:95%">
<?php
echo "<div id='dpro-phpinfo'>{$serverinfo}</div>";
$serverinfo = null;
?>
</div><br/>
</div>
</div>
<br/>

View File

@@ -0,0 +1,358 @@
<?php
/**
* Standard: PSR-2 (almost)
*
* @link http://www.php-fig.org/psr/psr-2
*
* @package DUP_PRO
* @subpackage classes/package
* @copyright (c) 2019, Snapcreek LLC
* @license https://opensource.org/licenses/GPL-3.0 GNU Public License
* @since 1.0.0
*/
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
use Duplicator\Addons\ProBase\License\License;
use Duplicator\Addons\ProBase\LicensingController;
use Duplicator\Libs\Shell\Shell;
use Duplicator\Libs\Snap\SnapIO;
use Duplicator\Libs\Snap\SnapUtil;
global $wp_version;
$view_state = DUP_PRO_UI_ViewState::getArray();
$ui_css_srv_panel = (isset($view_state['dup-settings-diag-srv-panel']) && $view_state['dup-settings-diag-srv-panel']) ? 'display:block' : 'display:none';
$dbvar_maxtime = DUP_PRO_DB::getVariable('wait_timeout');
$dbvar_maxpacks = DUP_PRO_DB::getVariable('max_allowed_packet');
$dbvar_maxtime = is_null($dbvar_maxtime) ? __("unknow", 'duplicator-pro') : $dbvar_maxtime;
$dbvar_maxpacks = is_null($dbvar_maxpacks) ? __("unknow", 'duplicator-pro') : $dbvar_maxpacks;
$home_path = duplicator_pro_get_home_path();
$space = SnapIO::diskTotalSpace($home_path);
$space_free = SnapIO::diskFreeSpace($home_path);
if ($space > 0 && $space_free >= 0) {
$perc = round((100 / $space) * $space_free, 2);
} else {
$perc = -1;
}
$mysqldumpPath = DUP_PRO_DB::getMySqlDumpPath();
$mysqlDumpSupport = ($mysqldumpPath) ? $mysqldumpPath : 'Path Not Found';
$client_ip_address = DUP_PRO_Server::getClientIP();
$error_log_path = ini_get('error_log');
$timezone_string = function_exists('wp_timezone_string') ? wp_timezone_string() : __('Unknown', 'duplicator-pro');
?>
<!-- ==============================
SERVER SETTINGS -->
<div class="dup-box">
<div class="dup-box-title">
<i class="fas fa-tachometer-alt"></i>
<?php esc_html_e("Server Settings", 'duplicator-pro') ?>
<button class="dup-box-arrow">
<span class="screen-reader-text"><?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Server Settings', 'duplicator-pro') ?></span>
</button>
</div>
<div class="dup-box-panel" id="dup-settings-diag-srv-panel" style="<?php echo esc_attr($ui_css_srv_panel); ?>">
<table class="widefat" cellspacing="0">
<tr>
<td class='dpro-settings-diag-header' colspan="2"><?php esc_html_e("General", 'duplicator-pro'); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Duplicator Version", 'duplicator-pro'); ?></td>
<td>
<?php echo esc_html(DUPLICATOR_PRO_VERSION); ?> -
<small>
<i>
<a href="<?php echo esc_url(LicensingController::getForceUpgradeCheckURL()); ?>">
<?php esc_html_e("Check WordPress updates", 'duplicator-pro'); ?>
</a>
</i>
</small>
</td>
</tr>
<tr>
<td><?php esc_html_e("Operating System", 'duplicator-pro'); ?></td>
<td><?php echo esc_html(PHP_OS); ?></td>
</tr>
<tr>
<td><?php _e('Timezone', 'duplicator-pro'); ?></td>
<td><?php echo esc_html($timezone_string); ?> &nbsp; <small><i>This is a <a href='options-general.php'>WordPress setting</a></i></small></td>
</tr>
<tr>
<td><?php _e('Server Time', 'duplicator-pro'); ?></td>
<td><?php echo esc_html(current_time("Y-m-d H:i:s")); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Web Server", 'duplicator-pro'); ?></td>
<td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Loaded PHP INI", 'duplicator-pro'); ?></td>
<td><?php echo php_ini_loaded_file(); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Server IP", 'duplicator-pro'); ?></td>
<?php
if (isset($_SERVER['SERVER_ADDR'])) {
$server_address = $_SERVER['SERVER_ADDR'];
} elseif (isset($_SERVER['SERVER_NAME']) && function_exists('gethostbyname')) {
$server_address = gethostbyname($_SERVER['SERVER_NAME']);
} else {
$server_address = __("Can't detect", 'duplicator-pro');
}
?>
<td><?php echo esc_html($server_address); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Outbound IP", 'duplicator-pro'); ?></td>
<?php
$outbound_ip = DUP_PRO_Server::getOutboundIP();
if ($outbound_ip === false) {
$outbound_ip = __("Can't detect", 'duplicator-pro');
}
?>
<td><?php echo esc_html($outbound_ip); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Client IP", 'duplicator-pro'); ?></td>
<td><?php echo esc_html($client_ip_address); ?></td>
</tr>
<tr style="font-style: italic">
<td>
<?php esc_html_e("Host", 'duplicator-pro'); ?><br/>
<small><?php esc_html_e("version scope", 'duplicator-pro'); ?></small>
</td>
<td>
<?php
$url = parse_url(get_site_url(), PHP_URL_HOST);
echo esc_url($url);
?>
<br/>
<small><?php echo "WP-" . esc_html($wp_version) . ", DP-" . esc_html(DUPLICATOR_PRO_VERSION) . " | PHP-" . esc_html(phpversion()) . ', DB-' . esc_html(DUP_PRO_DB::getVersion()); ?></small>
</td>
</tr>
<tr>
<td class='dpro-settings-diag-header' colspan="2">WordPress</td>
</tr>
<tr>
<td><?php esc_html_e("Version", 'duplicator-pro'); ?></td>
<td><?php echo esc_html($wp_version); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Langugage", 'duplicator-pro'); ?></td>
<td><?php bloginfo('language'); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Charset", 'duplicator-pro'); ?></td>
<td><?php bloginfo('charset'); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Memory Limit ", 'duplicator-pro'); ?></td>
<td><?php echo esc_html(WP_MEMORY_LIMIT); ?> (<?php
esc_html_e("Max", 'duplicator-pro');
echo '&nbsp;' . esc_html(WP_MAX_MEMORY_LIMIT);
?>)</td>
</tr>
<tr>
<td><?php esc_html_e("Managed hosting ", 'duplicator-pro'); ?></td>
<td><?php
echo (DUP_PRO_Custom_Host_Manager::getInstance()->isManaged() === false) ?
__('No managed hosting detected', 'duplicator-pro') :
implode(', ', DUP_PRO_Custom_Host_Manager::getInstance()->getActiveHostings());
?>
</td>
</tr>
<tr>
<td class='dpro-settings-diag-header' colspan="2">PHP</td>
</tr>
<tr>
<td><?php esc_html_e("Version", 'duplicator-pro'); ?></td>
<td><?php echo esc_html(phpversion()); ?></td>
</tr>
<tr>
<td>SAPI</td>
<td><?php echo PHP_SAPI ?></td>
</tr>
<tr>
<td><?php esc_html_e("User", 'duplicator-pro'); ?></td>
<td><?php echo DUP_PRO_Server::getCurrentUser(); ?></td>
</tr>
<tr>
<td><a href="http://php.net/manual/en/features.safe-mode.php" target="_blank"><?php esc_html_e("Safe Mode", 'duplicator-pro'); ?></a></td>
<td>
<?php
echo (((strtolower(@ini_get('safe_mode')) == 'on') || (strtolower(@ini_get('safe_mode')) == 'yes') ||
(strtolower(@ini_get('safe_mode')) == 'true') || (ini_get("safe_mode") == 1 ))) ? __('On', 'duplicator-pro') : __('Off', 'duplicator-pro');
?>
</td>
</tr>
<tr>
<td><a href="http://www.php.net/manual/en/ini.core.php#ini.memory-limit" target="_blank"><?php esc_html_e("Memory Limit", 'duplicator-pro'); ?></a></td>
<?php
$memory_limit = @ini_get('memory_limit');
?>
<td><?php echo empty($memory_limit) ? '' : esc_html($memory_limit); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Memory In Use", 'duplicator-pro'); ?></td>
<td><?php echo esc_html(size_format(@memory_get_usage(true), 2)); ?></td>
</tr>
<tr>
<td><a href="http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time" target="_blank"><?php esc_html_e("Max Execution Time", 'duplicator-pro'); ?></a></td>
<td>
<?php
echo esc_html(@ini_get('max_execution_time'));
$try_update = set_time_limit(0);
$try_update = $try_update ? 'is dynamic' : 'value is fixed';
echo " (default) - {$try_update}";
$tipCont = __(
'If the value shows dynamic then this means its possible for PHP to run longer than the default.
If the value is fixed then PHP will not be allowed to run longer than the default.',
'duplicator-pro'
);
?>
<i class="fa fa-question-circle data-size-help"
data-tooltip-title="<?php esc_attr_e("Max Execution Time", 'duplicator-pro'); ?>"
data-tooltip="<?php echo esc_attr($tipCont); ?>"></i>
</td>
</tr>
<tr>
<td><a href="http://php.net/manual/en/ini.core.php#ini.open-basedir" target="_blank"><?php esc_html_e("open_basedir", 'duplicator-pro'); ?></a></td>
<td>
<?php
$open_base_set = @ini_get('open_basedir');
echo empty($open_base_set) ? __('Off', 'duplicator-pro') : esc_html($open_base_set);
?>
</td>
</tr>
<tr>
<td><a href="http://us3.php.net/shell_exec" target="_blank"><?php esc_html_e("Shell (shell_exec)", 'duplicator-pro'); ?></a></td>
<td><?php echo (!Shell::hasDisabledFunctions('shell_exec')) ? esc_html__("Is Supported", 'duplicator-pro') : esc_html__("Not Supported", 'duplicator-pro'); ?></td>
</tr>
<tr>
<td><a href="http://us3.php.net/popen" target="_blank"><?php esc_html_e("Shell (popen)", 'duplicator-pro'); ?></a></td>
<td><?php echo (!Shell::hasDisabledFunctions('popen')) ? esc_html__("Is Supported", 'duplicator-pro') : esc_html__("Not Supported", 'duplicator-pro'); ?></td>
</tr>
<tr>
<td><a href="https://www.php.net/manual/en/function.exec.php" target="_blank"><?php esc_html_e("Shell (exec)", 'duplicator-pro'); ?></a></td>
<td><?php echo !Shell::hasDisabledFunctions('exec') ? esc_html__("Is Supported", 'duplicator-pro') : esc_html__("Not Supported", 'duplicator-pro'); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Shell Exec Zip", 'duplicator-pro'); ?></td>
<td><?php echo (DUP_PRO_Zip_U::getShellExecZipPath() != null) ? esc_html__("Is Supported", 'duplicator-pro') : esc_html__("Not Supported", 'duplicator-pro'); ?></td>
</tr>
<tr>
<td><a href="https://suhosin.org/stories/index.html" target="_blank"><?php esc_html_e("Suhosin Extension", 'duplicator-pro'); ?></a></td>
<td><?php echo Shell::isSuhosinEnabled() ? esc_html__("Enabled", 'duplicator-pro') : esc_html__("Disabled", 'duplicator-pro'); ?></td>
</tr>
<tr>
<td>Architecture</td>
<td>
<?php echo SnapUtil::getArchitectureString(); ?>
</td>
</tr>
<tr>
<td><?php esc_html_e("Error Log File ", 'duplicator-pro'); ?></td>
<td><?php echo esc_html($error_log_path); ?></td>
</tr>
<tr>
<td class='dpro-settings-diag-header' colspan="2">MySQL</td>
</tr>
<tr>
<td><?php esc_html_e("Version", 'duplicator-pro'); ?></td>
<td><?php echo DUP_PRO_DB::getVersion() ?></td>
</tr>
<tr>
<td><?php esc_html_e("Charset", 'duplicator-pro'); ?></td>
<td><?php echo DB_CHARSET ?></td>
</tr>
<tr>
<td><a href="http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_wait_timeout" target="_blank"><?php esc_html_e("Wait Timeout", 'duplicator-pro'); ?></a></td>
<td><?php echo esc_html($dbvar_maxtime); ?></td>
</tr>
<tr>
<td style="white-space:nowrap"><a href="http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_max_allowed_packet" target="_blank"><?php esc_html_e("Max Allowed Packets", 'duplicator-pro'); ?></a></td>
<td><?php echo esc_html($dbvar_maxpacks); ?></td>
</tr>
<tr>
<td><a href="http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html" target="_blank"><?php esc_html_e("msyqldump Path", 'duplicator-pro'); ?></a></td>
<td><?php echo esc_html($mysqlDumpSupport); ?></td>
</tr>
<tr>
<td class='dpro-settings-diag-header' colspan="2"><?php esc_html_e("Paths info", 'duplicator-pro'); ?></td>
</tr
<tr>
<td><?php esc_html_e("Target root path", 'duplicator-pro'); ?></a></td>
<td><?php echo esc_html(DUP_PRO_Archive::getTargetRootPath()); ?></td>
</tr>
<?php
$scanPaths = DUP_PRO_Archive::getScanPaths();
foreach ($scanPaths as $path) {
?>
<tr>
<td><?php echo esc_html__("Scan path", 'duplicator-pro'); ?></a></td>
<td><?php echo esc_html($path); ?></td>
</tr>
<?php
}
?>
<tr><td>&nbsp;</td><td></td></tr>
<?php
$originalPaths = DUP_PRO_Archive::getOriginalPaths();
foreach ($originalPaths as $key => $value) {
?>
<tr>
<td><?php echo esc_html__("Original ", 'duplicator-pro') . $key; ?></a></td>
<td><?php echo esc_html($value); ?></td>
</tr>
<?php
}
?>
<tr><td>&nbsp;</td><td></td></tr>
<?php
$archivePaths = DUP_PRO_Archive::getArchiveListPaths();
foreach ($archivePaths as $key => $value) {
?>
<tr>
<td><?php echo esc_html__("Archive ", 'duplicator-pro') . $key; ?></a></td>
<td><?php echo esc_html($value); ?></td>
</tr>
<?php
} ?>
<tr>
<td class='dpro-settings-diag-header' colspan="2"><?php esc_html_e("URLs info", 'duplicator-pro'); ?></td>
</tr>
<?php
$urls = DUP_PRO_Archive::getOriginalUrls();
foreach ($urls as $key => $value) {
?>
<tr>
<td><?php echo esc_html__("URL ", 'duplicator-pro') . $key; ?></a></td>
<td><?php echo esc_html($value); ?></td>
</tr>
<?php
} ?>
<?php if ($space >= 0) : ?>
<tr>
<td class='dpro-settings-diag-header' colspan="2"><?php esc_html_e("Server Disk", 'duplicator-pro'); ?></td>
</tr>
<tr valign="top">
<td><?php esc_html_e('Free space', 'duplicator-pro'); ?></td>
<td>
<?php echo $perc; ?>% -- <?php echo esc_html(DUP_PRO_U::byteSize($space_free)); ?> from <?php echo esc_html(DUP_PRO_U::byteSize($space)); ?>
<br/>
<small>
<?php esc_html_e("Note: This value is the physical servers hard-drive allocation.", 'duplicator-pro'); ?> <br/>
<?php esc_html_e("On shared hosts check your control panel for the 'TRUE' disk space quota value.", 'duplicator-pro'); ?>
</small>
</td>
</tr>
<?php endif; ?>
</table>
<br/>
</div>
</div>
<br/>

View File

@@ -0,0 +1,195 @@
<?php
use Duplicator\Core\CapMng;
defined("ABSPATH") or die("");
if (!CapMng::can(CapMng::CAP_CREATE, false)) {
return;
}
?>
<style>
div#hb-result {padding: 10px 5px 0 5px; line-height:20px; font-size: 12px}
</style>
<!-- ==========================================
THICK-BOX DIALOGS: -->
<?php
$confirm1 = new DUP_PRO_UI_Dialog();
$confirm1->title = __('Run Validator', 'duplicator-pro');
$confirm1->message = __('This will run the scan validation check. This may take several minutes. Do you want to Continue?', 'duplicator-pro');
$confirm1->progressOn = false;
$confirm1->jsCallback = 'DupPro.Tools.runScanValidator()';
$confirm1->initConfirm();
?>
<!-- ==============================
SCAN VALIDATOR -->
<div class="dup-box">
<div class="dup-box-title">
<i class="far fa-check-square"></i>
<?php esc_html_e("Scan Validator", 'duplicator-pro'); ?>
<button class="dup-box-arrow">
<span class="screen-reader-text">
<?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Scan Validator', 'duplicator-pro') ?>
</span>
</button>
</div>
<div class="dup-box-panel" style="display: none;">
<?php
esc_html_e(
"This utility will help to find unreadable files and sys-links in your environment that can lead to issues during the scan process.",
'duplicator-pro'
);
echo ' ';
esc_html_e(
"The utility will also shows how many files and directories you have in your system. This process may take several minutes to run.",
'duplicator-pro'
);
echo ' ';
esc_html_e(
"If there is a recursive loop on your system then the process has a built in check to stop after a large set
of files and directories have been scanned.",
'duplicator-pro'
);
echo ' ';
esc_html_e(
"A message will show indicated that that a scan depth has been reached.
If you have issues with the package scanner (step 2) during the build process then try to add
The paths below to your file filters to allow the scanner to finish.",
'duplicator-pro'
);
?>
<br/><br/>
<button id="scan-run-btn" type="button" class="button button-large button-primary" onclick="DupPro.Tools.ConfirmScanValidator()">
<?php esc_html_e("Run Scan Integrity Validation", 'duplicator-pro'); ?>
</button>
<script id="hb-template" type="text/x-handlebars-template">
<b><?php esc_html_e('Scan Paths:', 'duplicator-pro'); ?></b><br/>
{{#if scanData.scanPaths}}
{{#each scanData.scanPaths}}
&nbsp; &nbsp; {{@index}} : {{this}}<br/>
{{/each}}
{{else}}
<i><?php esc_html_e('Empty scan path', 'duplicator-pro'); ?></i> <br/>
{{/if}}
<br/>
<b><?php esc_html_e('Scan Results', 'duplicator-pro'); ?></b><br/>
<table>
<tr>
<td><b><?php esc_html_e('Files:', 'duplicator-pro'); ?></b></td>
<td>{{scanData.fileCount}} </td>
<td> &nbsp; </td>
<td><b><?php esc_html_e('Dirs:', 'duplicator-pro'); ?></b></td>
<td>{{scanData.dirCount}} </td>
</tr>
</table>
<br/>
<b>Unreadable Dirs/Files:</b> <br/>
{{#if scanData.unreadable}}
{{#each scanData.unreadable}}
&nbsp; &nbsp; {{@index}} : {{this}}<br/>
{{/each}}
{{else}}
<i><?php esc_html_e('No Unreadable items found', 'duplicator-pro'); ?></i> <br/>
{{/if}}
<br/>
<b><?php esc_html_e('Symbolic Links:', 'duplicator-pro'); ?></b> <br/>
{{#if scanData.symLinks}}
{{#each scanData.symLinks}}
&nbsp; &nbsp; {{@index}} : {{this}}<br/>
{{/each}}
{{else}}
<i>No Sym-links found</i> <br/>
<small> <?php esc_html_e("Note: Symlinks are not discoverable on Windows OS with PHP", 'duplicator-pro'); ?></small> <br/>
{{/if}}
<br/>
<b>Directory Name Checks:</b> <br/>
{{#if scanData.nameTestDirs}}
{{#each scanData.nameTestDirs}}
&nbsp; &nbsp; {{@index}} : {{this}}<br/>
{{/each}}
{{else}}
<i><?php esc_html_e('No name check warnings located for directory paths', 'duplicator-pro'); ?></i> <br/>
{{/if}}
<br/>
<b>File Name Checks:</b> <br/>
{{#if scanData.nameTestFiles}}
{{#each scanData.nameTestFiles}}
&nbsp; &nbsp; {{@index}} : {{this}}<br/>
{{/each}}
{{else}}
<i><?php esc_html_e('No name check warnings located for directory paths', 'duplicator-pro'); ?></i> <br/>
{{/if}}
<br/>
</script>
<div id="hb-result"></div>
</div>
</div>
<br/>
<script>
jQuery(document).ready(function($)
{
DupPro.Tools.ConfirmScanValidator = function()
{
<?php $confirm1->showConfirm(); ?>
}
//Run request to: admin-ajax.php?action=DUP_CTRL_Tools_runScanValidator
DupPro.Tools.runScanValidator = function()
{
tb_remove();
var data = {
action : 'DUP_PRO_CTRL_Tools_runScanValidator',
nonce: '<?php echo wp_create_nonce('DUP_PRO_CTRL_Tools_runScanValidator'); ?>',
'scan-recursive': 1
};
$('#hb-result').html('<?php esc_html_e("Scanning Environment... This may take a few minutes.", 'duplicator-pro'); ?>');
$('#scan-run-btn').html('<i class="fas fa-circle-notch fa-spin fa-fw"></i> Running Please Wait...');
$.ajax({
type: "POST",
url: ajaxurl,
dataType: "text",
data: data,
success: function(respData) {
try {
var data = DupPro.parseJSON(respData);
} catch(err) {
console.error(err);
console.error('JSON parse failed for response data: ' + respData);
console.log(respData);
return false;
}
DupPro.Tools.IntScanValidator(data);
},
error: function(data) {console.log(data)},
done: function(data) {console.log(data)}
});
}
//Process Ajax Template
DupPro.Tools.IntScanValidator= function(data)
{
var template = $('#hb-template').html();
var templateScript = Handlebars.compile(template);
var html = templateScript(data);
$('#hb-result').html(html);
$('#scan-run-btn').html('<?php esc_html_e("Run Scan Integrity Validation", 'duplicator-pro'); ?>');
}
});
</script>

View File

@@ -0,0 +1,3 @@
<?php
//silent

View File

@@ -0,0 +1,263 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
use Duplicator\Controllers\SettingsPageController;
use Duplicator\Core\Controllers\ControllersManager;
use Duplicator\Controllers\ToolsPageController;
use Duplicator\Core\CapMng;
$trace_log_filepath = DUP_PRO_Log::getTraceFilepath();
$trace_filename = basename($trace_log_filepath);
$logs = ToolsPageController::getLogsList();
$global = DUP_PRO_Global_Entity::getInstance();
$logname = (isset($_GET['logname'])) ? trim($_GET['logname']) : "";
$refresh = (isset($_POST['refresh']) && $_POST['refresh'] == 1) ? 1 : 0;
$auto = (isset($_POST['auto']) && $_POST['auto'] == 1) ? 1 : 0;
//Check for invalid file
if (isset($_GET['logname'])) {
$validFiles = array_map('basename', $logs);
if (validate_file($logname, $validFiles) > 0) {
unset($logname);
}
unset($validFiles);
}
if (!isset($logname) || !$logname) {
$logname = (count($logs) > 0) ? basename($logs[0]) : "";
}
$nocache = @date("ymdHis");
$logurl = DUPLICATOR_PRO_SSDIR_URL . "/{$logname}?{$nocache}";
$logurl_base = DUPLICATOR_PRO_SSDIR_URL . "/{$logname}";
$logfound = (strlen($logname) > 0) ? true : false;
?>
<style>
span#dup-refresh-count {display:inline;}
table#dpro-log-pnls {width:100%;}
td#dpro-log-pnl-left {width:80%; vertical-align: top}
td#dpro-log-pnl-left div.name {float:left; margin: 0px 0px 5px 5px; font-weight: bold}
td#dpro-log-pnl-left div.opts {float:right;}
td#dpro-log-pnl-right {vertical-align: top; padding:5px 0 0 15px; max-width: 375px;}
iframe#dpro-log-content {padding:5px; background: #fff; min-height:500px; width:99%; border:1px solid silver}
/* OPTIONS */
div.dpro-opts-items {border:1px solid silver; background: #efefef; padding: 5px; border-radius: 4px; margin:2px 0px 10px -2px; }
div.dpro-log-hdr {font-weight: bold; font-size:16px; padding:2px; }
div.dpro-log-hdr small{font-weight:normal; font-style: italic}
div.dpro-log-file-list {font-family:monospace;line-height: 24px}
div.dpro-log-file-list a span{display: inline-block; white-space: nowrap; text-overflow: ellipsis; max-width: 375px; line-height:20px; overflow:hidden}
div.dpro-log-file-list span {color:green}
div.dup-opts-items {border:1px solid silver; background: #efefef; padding: 5px; border-radius: 4px; margin:2px 0px 10px -2px;}
label#dup-auto-refresh-lbl {display: inline-block;}
div#dpro-monitor-trace-area {bottom:70px}
</style>
<script>
jQuery(document).ready(function ($)
{
DupPro.Tools.FullLog = function () {
var $panelL = $('#dpro-log-pnl-left');
var $panelR = $('#dpro-log-pnl-right');
if ($panelR.is(":visible")) {
$panelR.hide(400);
$panelL.css({width: '100%'});
} else {
$panelR.show(200);
$panelL.css({width: '75%'});
}
}
DupPro.Tools.Refresh = function () {
$('#refresh').val(1);
$('#dup-form-logs').submit();
}
DupPro.Tools.RefreshAuto = function () {
if ($("#dup-auto-refresh").is(":checked")) {
$('#auto').val(1);
startTimer();
} else {
$('#auto').val(0);
}
}
DupPro.Tools.WinResize = function () {
var height = $(window).height() - 210;
$("#dpro-log-content").css({height: height + 'px'});
}
var duration = 9;
var count = duration;
var timerInterval;
function timer() {
count = count - 1;
$("#dup-refresh-count").html(count.toString());
if (!$("#dup-auto-refresh").is(":checked")) {
clearInterval(timerInterval);
$("#dup-refresh-count").text(count.toString().trim());
return;
}
if (count <= 0) {
count = duration + 1;
DupPro.Tools.Refresh();
}
}
function startTimer() {
timerInterval = setInterval(timer, 1000);
}
//INIT Events
$(window).resize(DupPro.Tools.WinResize);
$('#dup-options').click(DupPro.Tools.FullLog);
$("#dup-refresh").click(DupPro.Tools.Refresh);
$("#dup-auto-refresh").click(DupPro.Tools.RefreshAuto);
$("#dup-refresh-count").html(duration.toString());
//INIT
DupPro.Tools.WinResize();
<?php if ($refresh) : ?>
//Scroll to Bottom
$('#dpro-log-content').on('load', function() {
var $contents = $('#dpro-log-content').contents();
$contents.scrollTop($contents.height());
});
<?php if ($auto) : ?>
$("#dup-auto-refresh").prop('checked', true);
DupPro.Tools.RefreshAuto();
<?php endif; ?>
<?php endif; ?>
// formatting log
$('#dpro-log-content').on('load', function() {
$('#dpro-log-content').contents().find("head")
.append($("<style type='text/css'>pre {line-height: 2;white-space: pre;}</style>"));
});
});
</script>
<form id="dup-form-logs" method="post" action="">
<input type="hidden" id="refresh" name="refresh" value="<?php echo ($refresh) ? 1 : 0 ?>" />
<input type="hidden" id="auto" name="auto" value="<?php echo ($auto) ? 1 : 0 ?>" />
<?php if (!$logfound) : ?>
<div style="padding:20px">
<h2><?php esc_html_e("Log file not found or unreadable", 'duplicator-pro') ?>.</h2>
<?php esc_html_e("Try to create a package, since no log files were found in the snapshots directory ending in *_log.txt", 'duplicator-pro') ?>.<br/><br/>
<?php esc_html_e("Reasons for log file not showing", 'duplicator-pro') ?>: <br/>
- <?php esc_html_e("The web server does not support returning .txt file extensions", 'duplicator-pro') ?>. <br/>
- <?php esc_html_e("The snapshots directory does not have the correct permissions to write files. Try setting the permissions to 755", 'duplicator-pro') ?>. <br/>
- <?php esc_html_e("The process that PHP runs under does not have enough permissions to create files. Please contact your hosting provider for more details", 'duplicator-pro') ?>. <br/>
</div>
<?php else : ?>
<table id="dpro-log-pnls">
<tr>
<td id="dpro-log-pnl-left">
<div class="name"><i class="fas fa-file-contract fa-fw"></i> <?php echo basename($logurl); ?></div>
<div class="opts"><a href="javascript:void(0)" id="dup-options"><?php esc_html_e("Options", 'duplicator-pro') ?> <i class="fa fa-angle-double-right"></i></a> &nbsp;</div>
<br style="clear:both" />
<iframe id="dpro-log-content" src="<?php echo esc_url($logurl); ?>" ></iframe>
</td>
<td id="dpro-log-pnl-right">
<h2><?php esc_html_e("Options", 'duplicator-pro') ?></h2>
<div class="dpro-opts-items">
<input type="button" class="button button-small" id="dup-refresh" value="<?php esc_attr_e("Refresh", 'duplicator-pro') ?>" /> &nbsp;
<div style="display:inline-block;margin-top:1px;">
<input type='checkbox' id="dup-auto-refresh" style="margin-top:3px" />
<label id="dup-auto-refresh-lbl" for="dup-auto-refresh">
<?php esc_html_e("Auto Refresh", 'duplicator-pro') ?> [<span id="dup-refresh-count"></span>]
</label>
</div>
</div>
<div class="dpro-log-hdr">
<?php esc_html_e('Trace Log:', 'duplicator-pro') ?> &nbsp;
<span style="font-size:11px; font-weight: normal">
<?php
$trace_on = get_option('duplicator_pro_trace_log_enabled', false);
$txt_clear_trace = esc_html__('Clear', 'duplicator-pro');
$txt_profile = '';
$html = "";
if (CapMng::can(CapMng::CAP_SETTINGS, false)) {
if (!$trace_on) {
$url = SettingsPageController::getInstance()->getTraceActionUrl(true);
$html = '<a href="' . esc_url($url) . '" target="_blank">' . __("Turn On", 'duplicator-pro') . $txt_profile . '</a>';
} else {
$url = SettingsPageController::getInstance()->getTraceActionUrl(false);
$html = '<a href="' . esc_url($url) . '" target="_blank">' . __("Turn Off", 'duplicator-pro') . $txt_profile . '</a>';
}
$html .= " | ";
}
if (CapMng::can(CapMng::CAP_CREATE, false)) {
$html .= "<a href='javascript:void(0)' onclick='DupPro.UI.ClearTraceLog(1);'>{$txt_clear_trace}</a>";
}
echo $html;
?>
</span>
</div>
<div class="dpro-log-file-list">
<?php
$trace_log_filepath = DUP_PRO_Log::getTraceFilepath();
if (file_exists($trace_log_filepath)) {
$time = date('m/d/y h:i:s', @filemtime($trace_log_filepath));
} else {
$time = __('No trace log found', 'duplicator-pro');
}
$active_filename = basename($logurl_base);
$trace_log_url = ControllersManager::getMenuLink(ControllersManager::TOOLS_SUBMENU_SLUG, ToolsPageController::L2_SLUG_DISAGNOSTIC, ToolsPageController::L3_SLUG_DISAGNOSTIC_LOG, array('logname' => $trace_filename));
$is_trace_active = ($active_filename == $trace_filename);
echo ($is_trace_active)
? '<div class="dpro-trace-log-link-green"><i class="fa fa-caret-right"></i> ' . $time . '</div>'
: '<a href="' . esc_url($trace_log_url) . '">' . $time . '</a>';
?>
</div>
<br/>
<div class="dpro-log-hdr">
<?php esc_html_e('Package Logs', 'duplicator-pro'); ?>
<small><?php esc_html_e('Top 20', 'duplicator-pro'); ?></small>
</div>
<div class="dpro-log-file-list" style="white-space: nowrap">
<?php
$count = 0;
$active = basename($logurl_base);
foreach ($logs as $log) {
$time = date('m/d/y h:i:s', filemtime($log));
$name = sanitize_text_field(basename($log));
$url = ControllersManager::getMenuLink(ControllersManager::TOOLS_SUBMENU_SLUG, ToolsPageController::L2_SLUG_DISAGNOSTIC, ToolsPageController::L3_SLUG_DISAGNOSTIC_LOG, array('logname' => $name));
if ($name !== $trace_filename) {
$shortname = substr($name, 0, 15) . '***.log';
echo ($active == $name)
? '<span title="' . esc_attr($name) . '"><i class="fa fa-caret-right"></i> ' . $time . '-' . $shortname . '</span><br/>'
: '<a href="' . esc_url($url) . '" title="' . esc_attr($name) . '">' . $time . '-' . $shortname . '</a><br/>';
if ($count > 20) {
break;
}
$count++;
}
}
?>
</div>
</td>
</tr>
</table>
<?php endif; ?>
</form>

View File

@@ -0,0 +1,39 @@
<?php
defined("ABSPATH") or die("");
wp_enqueue_script('dup-handlebars');
?>
<style>
<?php echo isset($css_hide_msg) ? $css_hide_msg : ''; ?>
div#message {margin:0px 0px 10px 0px}
td.dpro-settings-diag-header {background-color:#D8D8D8; font-weight: bold; border-style: none; color:black}
table.widefat th {font-weight:bold; }
table.widefat td {padding:2px 2px 2px 8px; }
table.widefat td:nth-child(1) {width:10px;}
table.widefat td:nth-child(2) {padding-left: 20px; width:100% !important}
textarea.dup-opts-read {width:100%; height:40px; font-size:12px}
.dpro-store-fixed-btn {
min-width: 165px;
text-align: center
}
div.success,span.success {color:#4A8254}
div.failed {color:red}
table.dpro-reset-opts td:first-child {
font-weight: bold
}
table.dpro-reset-opts td {
padding: 0 10px 10px 0;
}
div#dpro-tools-delete-moreinfo {display: none; padding: 5px 0 0 20px; border:1px solid #dfdfdf; border-radius: 5px; padding:10px; margin:5px; width:98% }
div#dpro-tools-delete-orphans-moreinfo {display: none; padding: 5px 0 0 20px; border:1px solid #dfdfdf; border-radius: 5px; padding:10px; margin:5px; width:98% }
/*PHP_INFO*/
div#dpro-phpinfo {padding:10px 5px;}
div#dpro-phpinfo table {padding:1px; background:#dfdfdf; -webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px; width:100% !important; box-shadow:0 8px 6px -6px #777;}
div#dpro-phpinfo td, th {padding:3px; background:#fff; -webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;}
div#dpro-phpinfo tr.h img {display:none;}
div#dpro-phpinfo tr.h td {background:none;}
div#dpro-phpinfo tr.h th {text-align:center; background-color:#efefef;}
div#dpro-phpinfo td.e {font-weight:bold}
</style>

View File

@@ -0,0 +1,382 @@
<?php
defined("ABSPATH") or die("");
if (isset($_POST['clear_log']) && $_POST['clear_log'] == 'true') {
DUP_PRO_PHP_Log::clear_log();
}
$refresh = (isset($_POST['refresh']) && $_POST['refresh'] == 1) ? 1 : 0;
$auto = (isset($_POST['auto']) && $_POST['auto'] == 1) ? 1 : 0;
$filter = (isset($_POST['filter'])) ? $_POST['filter'] : '';
$error = false;
$lines = 200;
$log_path = DUP_PRO_PHP_Log::get_path(null, true);
$error_log = DUP_PRO_PHP_Log::get_log($lines, "M d, H:i:s");
$log_path_size = 0;
if ($log_path !== false) {
$log_path_size = @filesize($log_path);
if (!is_readable($log_path)) {
$error = sprintf(
__(
"PHP error log is available on location %s but is not readable. Try setting the permissions to 755.",
'duplicator-pro'
),
'<b>' . esc_html($log_path) . '</b>'
);
} elseif ($error_log === false) {
if ($log_path > (PHP_INT_MAX / 2)) {
$error = sprintf(
__(
"PHP error log is available on location %1\$s but can't be read because file size is over %2\$s. You must open this file manualy.",
'duplicator-pro'
),
'<b>' . esc_html($log_path) . '</b>',
'<b>' . DUP_PRO_U::byteSize($log_path_size) . '</b>'
);
} else {
$error = sprintf(
__(
"PHP error log is available on location %s but can't be read because some unexpected error. Try to open file manually and investigate all problems what can cause this error.",
'duplicator-pro'
),
'<b>' . esc_html($log_path) . '</b>'
);
}
} else {
}
} else {
$error = __('This can be good for you because there is no errors.', 'duplicator-pro') . '<br><br>';
$error .= sprintf(
__(
'But if you in any case experience some errors and not see log here,
that mean your error log file is placed on some unusual location or can\'t be created because some %1$s setup.
In that case you must open %2$s file and define %3$s or call your system administrator to setup it properly.',
'duplicator-pro'
),
"<b><i>php.ini</i></b>",
"<b><i>php.ini</i></b>",
"<code>error_log</code>"
) .
'<br><br>';
$error .= sprintf(
__('It would be great if you define new error log path to be inside root of your WordPress installation ( %1$s ) and name of file to be %2$s. That will solve this problem.', 'duplicator-pro'),
'<i><b>' . duplicator_pro_get_home_path() . '</b></i>',
'<b>error.log</b>'
);
}
if ($error) : ?>
<h2><?php
if ($log_path !== false) {
esc_html_e("Log file is found but have error or is unreadable", 'duplicator-pro');
} else {
esc_html_e("PHP error log not found", 'duplicator-pro');
}
?></h2>
<?php echo $error; ?>
<?php else : ?>
<style>
span#dup-refresh-count {display:inline;}
table#dpro-log-pnls {width:100%;}
td#dpro-log-pnl-left div.opts {float:right;}
td#dpro-log-pnl-left {width:80%; vertical-align: top}
td#dpro-log-pnl-right {vertical-align: top; padding:5px 0 0 15px; max-width: 375px;}
td#dpro-log-pnl-left div.name{float:left;margin:0 0 5px 5px;font-weight:700}
#error-log{width:100%;border:none;table-layout:fixed;border-spacing:0}
#error-log td,#error-log th{padding:8px 10px;border:none}
#error-log th{border-bottom:1px solid #e1e1e1;font-weight:600;text-align:center;color:#000}
#error-log th:last-child{padding-right:2.1%}
#error-log td{text-align:left;vertical-align:top}
div.tableContainer{clear:both;border:1px solid #ccc;height:500px;overflow:auto;width:100%;padding-bottom:35px;background:#fff}
/* Reset overflow value to hidden for all non-IE browsers. */
html>body div.tableContainer {overflow: hidden; width: 100%;}
div.tableContainer #error-log {float: left;}
#error-log tr{width:100%;}
#error-log thead tr {position: relative;}
#error-log tbody {display: block; height: 500px; overflow: auto; width: 100%}
html>body #error-log thead {display: table; overflow: auto; width: 100%}
#error-log td ul{padding:10px 15px; background: rgba(200, 200, 200, 0.1); color:#000; box-shadow:#ccc 0px 0px 1px; -webkit-box-shadow:#ccc 0px 0px 1px; -ms-box-shadow:#ccc 0px 0px 1px; -o-box-shadow:#ccc 0px 0px 1px; }
#error-log td ul li+li{margin-top:15px;}
#error-log td ul li.title{font-weight: bold;}
.info{display: inline-table; border-bottom:1px dotted #ccc; cursor:pointer;}
div.dpro-opts-items {border:1px solid silver; background: #efefef; padding: 5px; border-radius: 4px; margin:2px 0px 10px -2px; }
div.dpro-log-hdr {font-weight: bold; font-size:16px; padding:2px; }
div.dpro-log-hdr small{font-weight:normal; font-style: italic}
</style>
<table id="dpro-log-pnls">
<tr>
<td id="dpro-log-pnl-left">
<div class="name"><i class="fas fa-file-contract fa-fw"></i> <?php echo esc_html($log_path); ?></div>
<div class="opts"><a href="javascript:void(0)" id="dup-options"><?php esc_html_e('Options', 'duplicator-pro'); ?> <i class="fa fa-angle-double-right"></i></a> &nbsp;</div>
<div id="tableContainer" class="tableContainer">
<table class="wp-list-table fixed striped" id="error-log">
<thead>
<tr>
<th scope="col" style="width: 10%; text-align: center"><?php esc_html_e('Date', 'duplicator-pro'); ?></th>
<th scope="col" style="width: 8%; text-align: center"><?php esc_html_e('Type', 'duplicator-pro'); ?></th>
<th scope="col" style="width: 34%;"><?php esc_html_e('Error', 'duplicator-pro'); ?></th>
<th scope="col" style="width: 30%;"><?php esc_html_e('File', 'duplicator-pro'); ?></th>
<th scope="col" style="width: 6%;"><?php esc_html_e('Line', 'duplicator-pro'); ?></th>
</tr>
</thead>
<tbody id="the-list"<?php echo (count($error_log) === 0) ? ' style="overflow: hidden;"' : ''; ?>>
<?php if (count($error_log) === 0) : ?>
<tr style="width:100%; display:table">
<td colspan="5" style="width:100%; display:table"><h3><?php esc_html_e('PHP Error Log is empty.', 'duplicator-pro'); ?></h3></td>
</tr>
<?php else : ?>
<?php foreach ($error_log as $line => $log) : ?>
<tr>
<td scope="col" style="width: 15%; text-align: center">
<b class="info" title="<?php echo date("Y-m-d H:i:s T (P)", strtotime($log['dateTime'])); ?>">
<?php echo esc_html($log['dateTime']); ?>
</b>
</td>
<td scope="col" style="width: 8%; text-align: center"><?php echo esc_html($log['type']); ?></td>
<td scope="col" style="width: 35.5%;">
<?php echo esc_html($log['message']); ?>
<?php if (count($log['stackTrace']) > 0) : ?>
<ul>
<li class="title"><?php esc_html_e('Stack trace:', 'duplicator-pro'); ?></li>
<?php foreach ($log['stackTrace'] as $i => $trace) : ?>
<li><b>#<?php echo esc_html($i); ?></b> <?php echo esc_html($trace); ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</td>
<td scope="col" style="width: 35.5%;"><?php echo esc_html($log['file']); ?></td>
<td scope="col" style="width: 6%; text-align: center"><?php echo esc_html($log['line']); ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</td>
<td id="dpro-log-pnl-right">
<h2><?php esc_html_e("Options", 'duplicator-pro') ?></h2>
<form id="dup-form-logs" method="post" action="">
<div class="dpro-opts-items">
<strong><?php esc_html_e('PHP Error Filter:', 'duplicator-pro'); ?></strong>
<select type="text" id="filter" name="filter" style="width:100%;">
<option value="">--- <?php esc_html_e('None', 'duplicator-pro'); ?> ---</option>
<?php
foreach (
array(
'WARNING' => __('Warnings', 'duplicator-pro'),
'NOTICE' => __('Notices', 'duplicator-pro'),
'FATAL' => __('Fatal Error', 'duplicator-pro'),
'SYNTAX' => __('Syntax Error', 'duplicator-pro'),
'EXCEPTION' => __('Exceptions', 'duplicator-pro'),
) as $option => $name
) :
?>
<option value="<?php echo esc_attr($option); ?>"<?php echo ($filter == $option ? ' selected' : ''); ?>><?php echo esc_html($name); ?></option>
<?php endforeach; ?>
</select>
<hr>
<input type="button" class="button button-small" id="dup-refresh" value="<?php esc_attr_e("Refresh", 'duplicator-pro') ?>" /> &nbsp;
<div style="display:inline-block;margin-top:1px;">
<input type='checkbox' id="dup-auto-refresh" style="margin-top:3px" />
<label id="dup-auto-refresh-lbl" for="dup-auto-refresh">
<?php esc_html_e("Auto Refresh", 'duplicator-pro') ?> [<span id="dup-refresh-count"></span>]
</label>
</div>
</div>
<input type="hidden" id="refresh" name="refresh" value="<?php echo ($refresh) ? 1 : 0 ?>" />
<input type="hidden" id="auto" name="auto" value="<?php echo ($auto) ? 1 : 0 ?>" />
</form>
<div class="dpro-log-file-list">
<div style="color:green"><i class="fa fa-caret-right"></i> <?php
echo DUP_PRO_PHP_Log::get_filename($log_path);
echo ' (', DUP_PRO_U::byteSize($log_path_size),') &nbsp;|&nbsp; ';
echo date("Y-m-d H:i:s", filemtime($log_path));
?></div>
</div>
<?php if (isset($line) && $line + 30 > $lines) : ?>
<br>
<div style="color:#cc0000">
<i class="fa fa-info-circle"></i> <?php printf(__("You see only last %1\$s logs inside %2\$s file.", 'duplicator-pro'), $line, esc_html(DUP_PRO_PHP_Log::get_filename($log_path))); ?>
</div>
<?php endif; ?>
<?php if (isset($line)) : ?>
<br>
<form id="dup-form-clear-log" method="post" action="">
<button class="button" type="button" onclick="return DupPro.Tools.ClearLog();"><?php esc_html_e('Clear Log', 'duplicator-pro'); ?></button>
<input type="hidden" id="clear_log" name="clear_log" value="true" />
</form>
<?php endif; ?>
</td>
</tr>
</table>
<?php
$confirm1 = new DUP_PRO_UI_Dialog();
$confirm1->title = __('Clear PHP Log?', 'duplicator-pro');
$confirm1->message = __('Are you sure you want to clear PHP log??', 'duplicator-pro');
$confirm1->message .= '<br/>';
$confirm1->message .= '<small><i>' . __('Note: This action will delete all data and can\'t be stopped.', 'duplicator-pro') . '</i></small>';
$confirm1->progressText = __('Clear PHP log, Please Wait...', 'duplicator-pro');
$confirm1->jsCallback = 'DupPro.Tools.ClearLogSubmit()';
$confirm1->initConfirm();
?>
<script>
jQuery(document).ready(function ($)
{
var duration = 9,
count = duration,
timerInterval;
DupPro.Tools.errorFilter = function() {
// Declare variables
var input, filter, table, tr, td, i;
input = $("#filter");
filter = input.val().toUpperCase();
table = $("#error-log");
tr = table.find("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "block";
} else {
tr[i].style.display = "none";
}
}
}
}
$("#dup-refresh-count").html(duration);
function timer() {
count = count - 1;
$("#dup-refresh-count").html(count.toString());
if (!$("#dup-auto-refresh").is(":checked")) {
clearInterval(timerInterval);
$("#dup-refresh-count").text(count.toString().trim());
return;
}
if (count <= 0) {
count = duration + 1;
DupPro.Tools.Refresh();
}
}
function startTimer() {
timerInterval = setInterval(timer, 1000);
}
DupPro.Tools.ClearLogSubmit = function() {
$('#dup-form-clear-log').submit();
}
DupPro.Tools.ClearLog = function() {
<?php $confirm1->showConfirm(); ?>
}
DupPro.Tools.Refresh = function () {
$('#refresh').val(1);
$('#dup-form-logs').submit();
}
DupPro.Tools.RefreshAuto = function () {
if ($("#dup-auto-refresh").is(":checked")) {
$('#auto').val(1);
startTimer();
} else {
$('#auto').val(0);
}
}
DupPro.Tools.FullLog = function () {
var $panelL = $('#dpro-log-pnl-left');
var $panelR = $('#dpro-log-pnl-right');
if ($panelR.is(":visible")) {
$panelR.hide(400);
$panelL.css({width: '100%'});
} else {
$panelR.show(200);
$panelL.css({width: '75%'});
}
}
/* TABLE SIZE */
DupPro.Tools.TableSize = function() {
var size = [],
offset = ($('#tableContainer').width() - $($('#error-log tbody tr').get(0)).width()) / ($('#error-log th').length);
$('#error-log th').each(function(i,$this) {
size[i] = $($this).width();
});
$('#error-log tr').each(function(x,$tr) {
$($tr).find('td').each(function(i,$this) {
$($this).width(size[i]+offset);
});
});
};
DupPro.Tools.BoxHeight = function() {
var position = $('#tableContainer').position(),
winHeight = $(window).height(),
height = (winHeight - position.top - $("#wpfooter").height()) - 55;
if(height >= 500) {
$('#error-log tbody, div.tableContainer').height(height);
}
};
<?php if (count($error_log) > 0) : ?>
DupPro.Tools.TableSize();
DupPro.Tools.BoxHeight();
<?php endif; ?>
$(window).resize(function() {
<?php if (count($error_log) > 0) : ?>
DupPro.Tools.TableSize();
DupPro.Tools.BoxHeight();
<?php endif; ?>
});
$('#dup-options').click(function() {
DupPro.Tools.FullLog();
DupPro.Tools.TableSize();
});
$("#dup-refresh").click(DupPro.Tools.Refresh);
$("#dup-auto-refresh").click(DupPro.Tools.RefreshAuto);
$("#filter").on('input change select', function(){
DupPro.Tools.errorFilter();
});
DupPro.Tools.errorFilter();
<?php if ($auto) : ?>
$("#dup-auto-refresh").prop('checked', true);
DupPro.Tools.RefreshAuto();
<?php endif; ?>
});
</script>
<?php endif;

View File

@@ -0,0 +1,122 @@
<?php
defined("ABSPATH") or die("");
use Duplicator\Addons\ProBase\LicensingController;
use Duplicator\Core\Controllers\ControllersManager;
$thanks_display = 'none';
$error_display = 'none';
$form_display = 'block';
$message = '';
$settingsLicensingUrl = ControllersManager::getMenuLink(
ControllersManager::SETTINGS_SUBMENU_SLUG,
LicensingController::L2_SLUG_LICENSING
);
?>
<style>
div.dup-support-all {font-size:13px; line-height:20px;}
div.dup-support-txts-links {width:100%;font-size:14px; font-weight:bold; line-height:26px; text-align:center}
div.dup-support-hlp-area {width:375px; height:160px; float:left; border:1px solid #dfdfdf; border-radius:4px; margin:10px; line-height:18px;box-shadow: 0 8px 6px -6px #ccc;}
table.dup-support-hlp-hdrs {border-collapse:collapse; width:100%; border-bottom:1px solid #dfdfdf}
table.dup-support-hlp-hdrs {background-color:#efefef;}
div.dup-support-hlp-hdrs {
font-weight:bold; font-size:17px; height: 35px; padding:5px 5px 5px 10px;
background-image:-ms-linear-gradient(top, #FFFFFF 0%, #DEDEDE 100%);
background-image:-moz-linear-gradient(top, #FFFFFF 0%, #DEDEDE 100%);
background-image:-o-linear-gradient(top, #FFFFFF 0%, #DEDEDE 100%);
background-image:-webkit-gradient(linear, left top, left bottom, color-stop(0, #FFFFFF), color-stop(1, #DEDEDE));
background-image:-webkit-linear-gradient(top, #FFFFFF 0%, #DEDEDE 100%);
background-image:linear-gradient(to bottom, #FFFFFF 0%, #DEDEDE 100%);
}
div.dup-support-hlp-hdrs div {padding:5px; margin:4px 20px 0px -20px; text-align: center;}
div.dup-support-hlp-txt{padding:10px 4px 4px 4px; text-align:center}
</style>
<div class="dup-support-all">
<div style="display:<?php echo $form_display; ?>;">
<div style="width:800px; margin:auto; margin-top: 20px">
<!-- HELP LINKS -->
<div class="dup-support-hlp-area" >
<div class="dup-support-hlp-hdrs">
<i class="fas fa-cube fa-2x fa-pull-left"></i>
<div><?php esc_html_e('Knowledgebase', 'duplicator-pro') ?></div>
</div>
<div class="dup-support-hlp-txt">
<?php esc_html_e('Complete Online Documentation', 'duplicator-pro'); ?><br/>
<select id="dup-support-kb-lnks" style="margin-top:18px; font-size:16px; min-width: 170px">
<option value="NULL"> <?php esc_html_e('Choose A Section', 'duplicator-pro') ?> </option>
<option value="<?php echo DUPLICATOR_PRO_BLOG_URL; ?>knowledge-base-article-categories/quick-start/"><?php esc_html_e('Quick Start', 'duplicator-pro') ?></option>
<option value="<?php echo DUPLICATOR_PRO_DUPLICATOR_DOCS_URL; ?>"><?php esc_html_e('User Guide', 'duplicator-pro') ?></option>
<option value="<?php echo DUPLICATOR_PRO_TECH_FAQ_URL; ?>"><?php esc_html_e('FAQs', 'duplicator-pro') ?></option>
<option value="<?php echo DUPLICATOR_PRO_DUPLICATOR_DOCS_URL; ?>changelog/"><?php esc_html_e('Change Log', 'duplicator-pro') ?></option>
<option value="<?php echo esc_url(DUPLICATOR_PRO_BLOG_URL . 'my-account'); ?>"><?php esc_html_e('Dashboard', 'duplicator-pro') ?></option>
</select>
</div>
</div>
<!-- ONLINE SUPPORT -->
<div style="margin: auto; height: 350px; text-align: center">
<!-- HELP TICKET-->
<div class="dup-support-hlp-area">
<div class="dup-support-hlp-hdrs">
<i class="far fa-lightbulb fa-2x fa-pull-left"></i>
<div><?php esc_html_e('Submit Help Ticket', 'duplicator-pro') ?></div>
</div>
<div class="dup-support-hlp-txt">
<?php esc_html_e("Submit support ticket to Duplicator Pro support.", 'duplicator-pro'); ?> <br/>
<i>
<?php esc_html_e("Please have your", 'duplicator-pro'); ?>
<a class="dup-license-page-link" href="<?php echo esc_url($settingsLicensingUrl); ?>">
<?php esc_html_e("license key", 'duplicator-pro'); ?>
</a>
<?php esc_html_e("ready to enter ticket.", 'duplicator-pro'); ?>
</i>
<br/><br/>
<div class="dup-support-txts-links">
<button
class="button button-primary button-large"
data-dup-open-window="<?php echo esc_attr('https://duplicator.com/my-account/support/'); ?>"
data-dup-window-name="<?php echo esc_attr('Duplicator Pro Support'); ?>"
>
<?php esc_html_e('Get Support!', 'duplicator-pro') ?>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="margin-top:112px; text-align:center; display:<?php echo $thanks_display; ?>">
<p style="margin-bottom:0px; font-size:32px"><?php esc_html_e('Thanks, we\'ll get back to you shortly.', 'duplicator-pro'); ?></p>
<p style="font-size:12px">
<?php esc_html_e('*Contact support@duplicator.com if you don\'t get a confirmation email within an hour.', 'duplicator-pro'); ?>
</p>
</div>
<div style="margin-top:112px; text-align:center; display:<?php echo $error_display; ?>">
<p style="margin-bottom:0px; font-size:32px"><?php esc_html_e('There was a problem sending the email.', 'duplicator-pro'); ?></p>
<p>
<?php esc_html_e("We had a problem sending the support email. Instead, send your problem or question to", 'duplicator-pro') ?>
<a href='mailto:support@duplicator.com' target='_blank'>support@duplicator.com.</a>
</p>
<p style='font-weight:bold'><?php echo $message; ?></p>
</div>
</div><br/><br/><br/><br/>
<script>
jQuery(document).ready(function ($) {
//ATTACHED EVENTS
jQuery('#dup-support-kb-lnks').change(function () {
if (jQuery(this).val() != "NULL")
window.open(jQuery(this).val())
});
});
</script>

View File

@@ -0,0 +1,3 @@
<?php
//silent

View File

@@ -0,0 +1,10 @@
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
?><div class="dup-pro-recovery-message" >
<p class="recovery-reset-message-error">
<i class="fa fa-exclamation-triangle"></i> <b><?php _e('Recovery Point reset issue!', 'duplicator-pro'); ?></b>
<p>
<p class="recovery-error-message">
<!-- here is set the message received from the server -->
</p>
</div>

View File

@@ -0,0 +1,7 @@
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
?><div class="dup-pro-recovery-message" >
<p class="recovery-reset-message-ok">
<?php _e('The Recovery Point has been reset, all previously copied Recovery URLs are no longer valid.', 'duplicator-pro'); ?>
</p>
</div>

View File

@@ -0,0 +1,23 @@
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
?><div class="dup-pro-recovery-message" >
<p class="recovery-set-message-error">
<i class="fa fa-exclamation-triangle"></i>&nbsp;<b><?php _e('Recovery Package Issue Detected!', 'duplicator-pro'); ?></b>
<p>
<p class="recovery-error-message">
<!-- here is set the message received from the server -->
</p>
<p>
<?php
printf(
_x(
'For more information see %1$s[the documentation]%2$s',
'%1$s and %2$s represents the opening and closing HTML tags for an anchor or link',
'duplicator-pro'
),
'<a href="' . DUPLICATOR_PRO_DUPLICATOR_DOCS_URL . 'how-to-handle-recovery-install-setup-launch-issues" target="_blank">',
'</a>'
);
?>
</p>
</div>

View File

@@ -0,0 +1,6 @@
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
?><div class="dup-pro-recovery-message recovery-set-message-ok" >
<!-- message from js -->
</div>

View File

@@ -0,0 +1,112 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
use Duplicator\Controllers\RecoveryController;
use Duplicator\Libs\Snap\SnapIO;
/**
* passed values
*
* @var int $recoverPackageId
* @var array<int, array{id: int, created: string, nameHash: string, name: string}> $recoveablePackages
* @var bool $selector
* @var string $subtitle
* @var bool $displayCopyLink
* @var bool $displayCopyButton
* @var bool $displayLaunch
* @var bool $displayDownload
* @var bool $displayInfo
* @var string $viewMode
* @var string $importFailMessage
*/
/** @var \Duplicator\Package\Recovery\RecoveryPackage $recoverPackage */
switch ($viewMode) {
case RecoveryController::VIEW_WIDGET_NO_PACKAGE_SET:
?>
<div class="dup-pro-recovery-active-link-header">
<i class="fa-solid fa-house-fire main-icon"></i>
<div class="main-title">
<?php esc_html_e('Disaster Recovery Backup is Not Set', 'duplicator-pro'); ?>
</div>
<div class="main-subtitle margin-bottom-1">
<b><?php esc_html_e('Backup Age:', 'duplicator-pro'); ?></b>&nbsp;
<span class="dup-pro-recovery-status red"><?php _e('not set', 'duplicator-pro'); ?></span>
</div>
</div>
<div class="margin-bottom-1">
<?php
_e(
'A Disaster Recovery feathure allows one to quickly restore the site to a prior state.
To use this, mark a Backup as the Disaster Recovery Backup, then copy and save off the associated Disaster Recovery URL.
Then, if a problem occurs, browse to the URL to launch a streamlined installer to quickly restore the site.',
'duplicator-pro'
);
?>
</div>
<?php
break;
case RecoveryController::VIEW_WIDGET_NOT_VALID:
?>
<div class="orangered margin-bottom-1">
<?php echo esc_html($importFailMessage); ?>
</div>
<?php
break;
case RecoveryController::VIEW_WIDGET_VALID:
?>
<div class="dup-pro-recovery-active-link-wrapper" >
<div class="dup-pro-recovery-active-link-header" >
<i class="fas fa-house-fire main-icon"></i>
<div class="main-title" >
<?php _e('Disaster Recovery Backup is Set', 'duplicator-pro'); ?>
</div>
<div class="main-subtitle margin-bottom-1" >
<b><?php esc_html_e('Backup Age:', 'duplicator-pro'); ?></b>&nbsp;
<span class="dup-pro-recovery-status green">
<?php echo $recoverPackage->getPackageLife('human'); ?>
</span>
</div>
</div>
<?php if (strlen($subtitle)) { ?>
<p>
<?php echo $subtitle; ?>
</p>
<?php } ?>
<?php if ($displayInfo) { ?>
<div class="dup-pro-recovery-package-info margin-bottom-1" >
<table>
<tbody>
<tr>
<td><?php _e('Name', 'duplicator-pro'); ?>:</td>
<td><b><?php echo esc_html($recoverPackage->getPackageName()); ?></b></td>
</tr>
<tr>
<td><?php _e('Date', 'duplicator-pro'); ?>:</td>
<td><b><?php echo esc_html($recoverPackage->getCreated()); ?></b></td>
</tr>
</tbody>
</table>
</div>
<?php
}
?>
</div>
<?php
break;
default:
?>
<p class="orangered">
<?php echo __('Invalid view mode.', 'duplicator-pro'); ?>
</p>
<?php
}

View File

@@ -0,0 +1,99 @@
<?php
use Duplicator\Package\Recovery\RecoveryPackage;
use Duplicator\Views\ViewHelper;
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
/**
* passed values
*
* @var ?RecoveryPackage $recoverPackage
* @var int $recoverPackageId
* @var array<int, array{id: int, created: string, nameHash: string, name: string}> $recoveablePackages
* @var bool $selector
* @var string $subtitle
* @var bool $displayCopyLink
* @var bool $displayCopyButton
* @var bool $displayLaunch
* @var bool $displayDownload
* @var bool $displayInfo
* @var string $viewMode
* @var string $importFailMessage
*/
if (empty($recoveablePackages)) {
return;
}
$installerLink = ($recoverPackage instanceof RecoveryPackage) ? $recoverPackage->getInstallLink() : '';
$disabledClass = empty($installerLink) ? 'disabled' : '';
if ($displayCopyLink) {
$toolTipContent = __(
'The recovery point URL is the link to the recovery point package installer.
The link will run the installer wizard used to re-install and recover the site.
Copy this link and keep it in a safe location to easily restore this site.',
'duplicator-pro'
);
$toolTipContent .= '<br><br><b>';
$toolTipContent .= __('This URL is valid until another recovery point is set.', 'duplicator-pro');
$toolTipContent .= '</b>';
?>
<label>
<i class="fas fa-question-circle fa-sm"
data-tooltip-title="<?php esc_attr_e("Recovery Point URL", 'duplicator-pro'); ?>"
data-tooltip="<?php echo esc_attr($toolTipContent); ?>"
>
</i>
<b><?php _e('Step 2 ', 'duplicator-pro'); ?>:</b> <i><?php _e('Copy Recovery URL &amp; Store in Safe Place', 'duplicator-pro'); ?></i>
</label>
<div class="copy-link <?php echo $disabledClass; ?>"
data-dup-copy-value="<?php echo esc_url($installerLink); ?>"
data-dup-copy-title="<?php _e("Copy Recovery URL to clipboard", 'duplicator-pro'); ?>"
data-dup-copied-title="<?php _e("Recovery URL copied to clipboard", 'duplicator-pro'); ?>" >
<div class="content" >
<?php echo empty($installerLink) ? __('Please set the Recovery Point to generate the Recovery URL', 'duplicator-pro') : $installerLink; ?>
</div>
<i class="far fa-copy copy-icon"></i>
</div>
<?php } ?>
<div class="dup-pro-recovery-buttons" >
<?php
if ($displayLaunch) { ?>
<a href="<?php echo esc_url($installerLink); ?>"
class="button button-primary dup-pro-launch <?php echo $disabledClass; ?>" target="_blank"
title="<?php _e('Initiates system recovery using the Recovery Point URL.', 'duplicator-pro'); ?>"
>
<?php ViewHelper::restoreIcon(); ?>&nbsp;<?php _e('Restore Backup', 'duplicator-pro'); ?>
</a>
<?php
}
if ($displayDownload) {
$title = __(
'This button downloads a recovery launcher that allows you to perform the recovery with a simple click of the downloaded file.',
'duplicator-pro'
);
?>
<button
type="button"
class="button button-primary dup-pro-recovery-download-launcher <?php echo $disabledClass; ?>"
title="<?php echo esc_attr($title); ?>"
>
<i class="fa fa-rocket" ></i>&nbsp;<?php _e('Download Launcher', 'duplicator-pro'); ?>
</button>
<?php
}
if ($displayCopyButton) {
?>
<button type="button" class="button button-primary dup-pro-recovery-copy-url <?php echo $disabledClass; ?>"
data-dup-copy-value="<?php echo $installerLink; ?>"
data-dup-copy-title="<?php _e("Copy Recovery URL to clipboard", 'duplicator-pro'); ?>"
data-dup-copied-title="<?php _e("Recovery URL copied to clipboard", 'duplicator-pro'); ?>" >
<i class="far fa-copy copy-icon"></i>&nbsp;<?php _e('Copy LINK', 'duplicator-pro'); ?>
</button>
<?php
}
?>
</div>

View File

@@ -0,0 +1,245 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
use Duplicator\Libs\Snap\SnapIO;
?>
<script>
DupPro.Pack.SetRecoveryPoint = function (packageId, callbackOnSuccess, callbackOnError, topHeaderMessage) {
topHeaderMessage = (typeof topHeaderMessage !== 'undefined') ? topHeaderMessage : true;
let okMsgContent = <?php echo json_encode(SnapIO::getInclude(dirname(__FILE__) . '/recovery-message-set-ok.php')); ?>;
let errorMsgContent = <?php echo json_encode(SnapIO::getInclude(dirname(__FILE__) . '/recovery-message-set-error.php')); ?>;
DupPro.Pack.removeRecoveryMessages();
Duplicator.Util.ajaxWrapper(
{
action: 'duplicator_pro_set_recovery',
recovery_package: packageId,
fromPageTab: <?php echo json_encode(\Duplicator\Core\Controllers\ControllersManager::getUniqueIdOfCurrentPage()); ?>,
nonce: '<?php echo wp_create_nonce('duplicator_pro_set_recovery'); ?>'
},
function (result, data, funcData, textStatus, jqXHR) {
if (topHeaderMessage) {
DupPro.addAdminMessage(okMsgContent, 'notice', {
updateCallback: function (msgNode) {
msgNode.find('.recovery-set-message-ok').html(funcData.adminMessage);
DuplicatorTooltip.reload();
msgNode.find('.dup-pro-recovery-download-launcher').click(function () {
DupPro.Pack.downloadLauncher();
});
}
});
}
if (typeof callbackOnSuccess === "function") {
callbackOnSuccess(funcData, data, textStatus, jqXHR);
}
return '';
},
function (result, data, funcData, textStatus, jqXHR) {
DupPro.addAdminMessage(errorMsgContent, 'error', {
'updateCallback': function (msgNode) {
msgNode.find('.recovery-error-message').html(data.message);
}
});
if (typeof callbackOnError === "function") {
callbackOnError(funcData, data, textStatus, jqXHR);
}
return '';
}
);
};
DupPro.Pack.ResetRecoveryPoint = function (callbackOnSuccess) {
let okMsgContent = <?php echo json_encode(SnapIO::getInclude(dirname(__FILE__) . '/recovery-message-reset-ok.php')); ?>;
let errorMsgContent = <?php echo json_encode(SnapIO::getInclude(dirname(__FILE__) . '/recovery-message-reset-error.php')); ?>;
DupPro.Pack.removeRecoveryMessages();
Duplicator.Util.ajaxWrapper(
{
action: 'duplicator_pro_reset_recovery',
nonce: '<?php echo wp_create_nonce('duplicator_pro_reset_recovery'); ?>',
fromPageTab: <?php echo json_encode(\Duplicator\Core\Controllers\ControllersManager::getUniqueIdOfCurrentPage()); ?>,
},
function (result, data, funcData, textStatus, jqXHR) {
DupPro.addAdminMessage(okMsgContent, 'notice');
if (typeof callbackOnSuccess === "function") {
callbackOnSuccess(funcData, data, textStatus, jqXHR);
}
return '';
},
function (result, data, funcData, textStatus, jqXHR) {
DupPro.addAdminMessage(errorMsgContent, 'error', {
'updateCallback': function (msgNode) {
msgNode.find('.recovery-error-message').html(data.message);
}
});
return '';
}
);
};
DupPro.Pack.UpdatgeRecoveryWidget = function (callbackOnSuccess) {
let okMsgContent = <?php echo json_encode(SnapIO::getInclude(dirname(__FILE__) . '/recovery-message-reset-ok.php')); ?>;
let errorMsgContent = <?php echo json_encode(SnapIO::getInclude(dirname(__FILE__) . '/recovery-message-reset-error.php')); ?>;
DupPro.Pack.removeRecoveryMessages();
Duplicator.Util.ajaxWrapper(
{
action: 'duplicator_pro_get_recovery_widget',
nonce: '<?php echo wp_create_nonce('duplicator_pro_get_recovery_widget'); ?>',
fromPageTab: <?php echo json_encode(\Duplicator\Core\Controllers\ControllersManager::getUniqueIdOfCurrentPage()); ?>,
},
function (result, data, funcData, textStatus, jqXHR) {
if (typeof callbackOnSuccess === "function") {
callbackOnSuccess(funcData, data, textStatus, jqXHR);
}
return '';
},
function (result, data, funcData, textStatus, jqXHR) {
return <?php json_encode(__('Can\'t update recovery widget', 'duplicator-pro')); ?>;
}
);
};
DupPro.Pack.removeRecoveryMessages = function () {
jQuery('#wpcontent .dup-pro-recovery-message').closest('.notice').remove();
};
DupPro.Pack.SetRecoveryPackageDetails = function (wrapper, details, setColor) {
const setDelayAnimation = 1000;
const setDurationAnimationStart = 500;
const setDurationAnimationEnd = 1000;
let newDetails = jQuery(details);
wrapper.replaceWith(newDetails);
wrapper = newDetails;
wrapper.closest('.dup-pro-import-box').find('.box-title .badge').each(function () {
if (wrapper.find('.dup-pro-recovery-active-link-header .dup-pro-recovery-status').hasClass('green')) {
jQuery(this).removeClass('badge-warn').addClass('badge-pass').text('Good');
} else {
jQuery(this).removeClass('badge-pass').addClass('badge-warn').text('Notice');
}
});
wrapper.find('.dup-pro-recovery-point-selector-area select, .dup-pro-recovery-point-actions .copy-link')
.stop()
.animate({
backgroundColor: setColor
}, setDurationAnimationStart)
.delay(setDelayAnimation)
.animate({
backgroundColor: "transparent"
}, setDurationAnimationEnd);
wrapper.find('.dup-pro-recovery-point-details')
.stop()
.css({
'outline': '5px solid transparent',
'outline-offset': '5px'
})
.animate({
outlineColor: setColor
}, setDurationAnimationStart)
.delay(setDelayAnimation)
.animate({
outlineColor: "transparent",
'outline-width': '0',
'outline-offset': '0'
}, setDurationAnimationEnd);
DupPro.Pack.initRecoveryWidget(wrapper);
};
DupPro.Pack.downloadLauncher = function () {
Duplicator.Util.ajaxWrapper(
{
action: 'duplicator_pro_disaster_launcher_download',
nonce: '<?php echo wp_create_nonce('duplicator_pro_disaster_launcher_download'); ?>'
},
function (result, data, funcData, textStatus, jqXHR) {
if (funcData.success) {
DupPro.downloadContentAsfile(funcData.fileName, funcData.fileContent, 'text/html');
} else {
DupPro.addAdminMessage(funcData.message, 'error');
}
return '';
}
);
};
DupPro.Pack.initRecoveryWidget = function (widgetWrapper) {
widgetWrapper.find('.recovery-reset').off().click(function () {
DupPro.Pack.ResetRecoveryPoint(function (funcData, data, textStatus, jqXHR) {
widgetWrapper.find('.recovery-select').val('');
DupPro.Pack.SetRecoveryPackageDetails(widgetWrapper, funcData.packageDetails, '#e1f5c1');
});
});
widgetWrapper.find('.recovery-set').off().click(function () {
let packageId = widgetWrapper.find('.recovery-select').val();
if (!packageId) {
DupPro.Pack.ResetRecoveryPoint(function (funcData, data, textStatus, jqXHR) {
DupPro.Pack.SetRecoveryPackageDetails(widgetWrapper, funcData.packageDetails, '#e1f5c1');
});
} else {
DupPro.Pack.SetRecoveryPoint(packageId,
function (funcData, data, textStatus, jqXHR) {
DupPro.Pack.SetRecoveryPackageDetails(widgetWrapper, funcData.packageDetails, '#e1f5c1');
},
function (funcData, data, textStatus, jqXHR) {
widgetWrapper.find('.recovery-select').val('');
DupPro.Pack.SetRecoveryPackageDetails(widgetWrapper, '<p class="red" >' + data.message + '</span>', '#fcc3bd');
},
false);
}
});
DuplicatorTooltip.reload();
widgetWrapper.find('.dup-pro-recovery-windget-refresh').off().click(function () {
DupPro.Pack.UpdatgeRecoveryWidget(function (funcData, data, textStatus, jqXHR) {
DupPro.Pack.SetRecoveryPackageDetails(widgetWrapper, funcData.widget, '#e1f5c1');
});
});
widgetWrapper.find('.dup-pro-recovery-download-launcher').off().click(function () {
DupPro.Pack.downloadLauncher();
});
};
jQuery(document).ready(function ($)
{
$('.dup-pro-recovery-widget-wrapper').each(function () {
let widgetWrapper = jQuery(this);
DupPro.Pack.initRecoveryWidget(widgetWrapper);
});
$('.dup-pro-open-help-link').click(function (event) {
event.stopPropagation();
let helpLink = $('#contextual-help-link');
$("html, body").animate({scrollTop: 0}, "fast");
if (helpLink.hasClass('screen-meta-active')) {
return;
}
helpLink.trigger('click');
});
});
</script>

View File

@@ -0,0 +1,107 @@
<?php
use Duplicator\Controllers\PackagesPageController;
use Duplicator\Core\CapMng;
use Duplicator\Package\Recovery\RecoveryPackage;
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
/**
* Variables
*
* @var RecoveryPackage $recoverPackage
* @var int $recoverPackageId
* @var array<int, array{id: int, created: string, nameHash: string, name: string}> $recoveablePackages
* @var bool $selector
* @var string $subtitle
* @var bool $displayCopyLink
* @var bool $displayCopyButton
* @var bool $displayLaunch
* @var bool $displayDownload
* @var bool $displayInfo
* @var string $viewMode
* @var string $importFailMessage
*/
if (!$selector) {
return;
}
$packagesURL = PackagesPageController::getInstance()->getPageUrl();
?>
<div class="dup-pro-recovery-point-selector">
<?php if (empty($recoveablePackages)) { ?>
<div class="dup-pro-notice-details">
<div class="margin-bottom-1" >
<b><?php _e('Would you like to create a Recovery Point before running this import?', 'duplicator-pro'); ?></b>
</div>
<b><?php _e('How to create:', 'duplicator-pro'); ?></b>
<ol class="dup-pro-simple-style-list" >
<li>
<?php _e('Open the ', 'duplicator-pro'); ?>
<a href="<?php echo esc_url($packagesURL); ?>" target="_blank">
<?php _e('packages screen', 'duplicator-pro'); ?>
</a>
<i class="fas fa-external-link-alt fa-small" ></i>
<?php _e('and create a valid recovery package.', 'duplicator-pro'); ?>
</li>
<li>
<?php _e('On the packages screen click the package\'s Hamburger menu and select "Set Recovery Point".', 'duplicator-pro'); ?>
</li>
<li>
<span class="dup-pro-recovery-windget-refresh link-style"><?php _e('Refresh', 'duplicator-pro'); ?></span>
<?php _e('this page to show and choose the recovery point', 'duplicator-pro'); ?>.
</li>
</ol>
</div>
<?php } else {
$tooltipContent = __(
'A Recovery Point allows one to quickly restore the site to a prior state.
To use this, mark a package as the Recovery Point, then copy and save off the associated URL.
Then, if a problem occurs, browse to the URL to launch a streamlined installer to quickly restore the site.',
'duplicator-pro'
);
?>
<div class="dup-pro-recovery-point-selector-area-wrapper" >
<?php if (CapMng::can(CapMng::CAP_CREATE, false)) { ?>
<span class="dup-pro-opening-packages-windows" >
<a href="<?php echo esc_url($packagesURL); ?>" >[<?php _e('Create New', 'duplicator-pro'); ?>]</a>
</span>
<?php } ?>
<label>
<i class="fas fa-question-circle fa-sm"
data-tooltip-title="<?php esc_attr_e("Choose Recovery Point Archive", 'duplicator-pro'); ?>"
data-tooltip="<?php echo esc_attr($tooltipContent); ?>">
</i>
<b><?php _e('Step 1 ', 'duplicator-pro'); ?>:</b> <i><?php _e('Choose Recovery Point Archive', 'duplicator-pro'); ?></i>
</label>
<div class="dup-pro-recovery-point-selector-area">
<select class="recovery-select" name="recovery_package" >
<option value=""> -- <?php _e('Not selected', 'duplicator-pro'); ?> -- </option>
<?php
$currentDay = null;
foreach ($recoveablePackages as $package) {
$packageDay = date("Y/m/d", strtotime($package['created']));
if ($packageDay != $currentDay) {
if (!is_null($currentDay)) {
?>
</optgroup>
<?php } ?>
<optgroup label="<?php echo esc_attr($packageDay); ?>">
<?php
$currentDay = $packageDay;
}
?>
<option value="<?php echo $package['id']; ?>" <?php selected($recoverPackageId, $package['id']) ?>>
<?php echo '[' . $package['created'] . '] ' . $package['name']; ?>
</option>
<?php } ?>
</optgroup>
</select>
<button type="button" class="button recovery-reset" ><?php echo _e('Reset', 'duplicator-pro'); ?></button>
<button type="button" class="button button-primary recovery-set" ><?php echo _e('Set', 'duplicator-pro'); ?></button>
</div>
</div>
<?php } ?>
</div>

View File

@@ -0,0 +1,36 @@
<?php
use Duplicator\Package\Recovery\RecoveryPackage;
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
/**
* Variables
*
* @var RecoveryPackage $recoverPackage
* @var int $recoverPackageId
* @var array<int, array{id: int, created: string, nameHash: string, name: string}> $recoveablePackages
* @var bool $displayDetails
* @var bool $selector
* @var string $subtitle
* @var bool $displayCopyLink
* @var bool $displayCopyButton
* @var bool $displayLaunch
* @var bool $displayDownload
* @var bool $displayInfo
* @var string $viewMode
* @var string $importFailMessage
*/
?>
<div class="dup-pro-recovery-widget-wrapper" >
<?php if ($displayDetails) { ?>
<div class="dup-pro-recovery-point-details margin-bottom-1">
<?php require dirname(__FILE__) . '/recovery-widget-details.php'; ?>
</div>
<?php } ?>
<?php require dirname(__FILE__) . '/recovery-widget-selector.php'; ?>
<div class="dup-pro-recovery-point-actions">
<?php require dirname(__FILE__) . '/recovery-widget-link-actions.php'; ?>
</div>
</div>

View File

@@ -0,0 +1,3 @@
<?php
//silent

View File

@@ -0,0 +1,14 @@
<?php
defined("ABSPATH") or die("");
$inner_page = isset($_REQUEST['inner_page']) ? sanitize_text_field($_REQUEST['inner_page']) : 'templates';
switch ($inner_page) {
case 'templates':
include(DUPLICATOR____PATH . '/views/tools/templates/template.list.php');
break;
case 'edit':
include(DUPLICATOR____PATH . '/views/tools/templates/template.edit.php');
break;
}

View File

@@ -0,0 +1,604 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
use Duplicator\Addons\ProBase\License\License;
use Duplicator\Controllers\SettingsPageController;
use Duplicator\Controllers\ToolsPageController;
use Duplicator\Core\Controllers\ControllersManager;
use Duplicator\Core\Views\TplMng;
use Duplicator\Libs\Snap\SnapJson;
use Duplicator\Libs\Snap\SnapUtil;
use Duplicator\Models\BrandEntity;
$tplMng = TplMng::getInstance();
/** @var bool */
$blur = TplMng::getInstance()->getGlobalValue('blur');
$templates_tab_url = ControllersManager::getMenuLink(
ControllersManager::TOOLS_SUBMENU_SLUG,
ToolsPageController::L2_SLUG_TEMPLATE
);
$edit_template_url = ControllersManager::getMenuLink(
ControllersManager::TOOLS_SUBMENU_SLUG,
ToolsPageController::L2_SLUG_TEMPLATE,
null,
array('inner_page' => 'edit')
);
$bandListUrl = ControllersManager::getMenuLink(
ControllersManager::SETTINGS_SUBMENU_SLUG,
SettingsPageController::L2_SLUG_PACKAGE,
SettingsPageController::L3_SLUG_PACKAGE_BRAND
);
$brandDefaultEditUrl = ControllersManager::getMenuLink(
ControllersManager::SETTINGS_SUBMENU_SLUG,
SettingsPageController::L2_SLUG_PACKAGE,
SettingsPageController::L3_SLUG_PACKAGE_BRAND,
[
'view' => 'edit',
'action' => 'default',
]
);
$brandBaseEditUrl = ControllersManager::getMenuLink(
ControllersManager::SETTINGS_SUBMENU_SLUG,
SettingsPageController::L2_SLUG_PACKAGE,
SettingsPageController::L3_SLUG_PACKAGE_BRAND,
[
'view' => 'edit',
'action' => 'edit',
]
);
global $wp_version;
global $wpdb;
$global = DUP_PRO_Global_Entity::getInstance();
$nonce_action = 'duppro-template-edit';
$was_updated = false;
$package_template_id = SnapUtil::sanitizeIntInput(SnapUtil::INPUT_REQUEST, 'package_template_id', -1);
if (($package_templates = DUP_PRO_Package_Template_Entity::getAll()) === false) {
$package_templates = array();
}
$package_template_count = count($package_templates);
// For now not including in filters since don't want to encourage use
// with schedules since filtering creates incomplete multisite
$displayMultisiteTab = (is_multisite() && License::can(License::CAPABILITY_MULTISITE_PLUS));
$view_state = DUP_PRO_UI_ViewState::getArray();
$ui_css_archive = (DUP_PRO_UI_ViewState::getValue('dup-template-archive-panel') ? 'display:block' : 'display:none');
$ui_css_install = (DUP_PRO_UI_ViewState::getValue('dup-template-install-panel') ? 'display:block' : 'display:none');
if (
$package_template_id == -1 ||
($package_template = DUP_PRO_Package_Template_Entity::getById($package_template_id)) == false
) {
$package_template = new DUP_PRO_Package_Template_Entity();
}
DUP_PRO_Log::traceObject("getting template $package_template_id", $package_template);
if (!empty($_REQUEST['action'])) {
DUP_PRO_U::verifyNonce($_REQUEST['_wpnonce'], $nonce_action);
if ($_REQUEST['action'] == 'save') {
DUP_PRO_Log::traceObject('request', $_REQUEST);
// Checkboxes don't set post values when off so have to manually set these
$package_template->setFromInput(SnapUtil::INPUT_REQUEST);
$package_template->save();
$was_updated = true;
} elseif ($_REQUEST['action'] == 'copy-template') {
$source_template_id = SnapUtil::sanitizeIntInput(SnapUtil::INPUT_REQUEST, 'duppro-source-template-id', -1);
if ($source_template_id > 0) {
$package_template->copy_from_source_id($source_template_id);
$package_template->save();
}
}
}
$installer_cpnldbaction = $package_template->installer_opts_cpnl_db_action;
$upload_dir = DUP_PRO_Archive::getArchiveListPaths('uploads');
$content_path = DUP_PRO_Archive::getArchiveListPaths('wpcontent');
$archive_format = ($global->getBuildMode() == DUP_PRO_Archive_Build_Mode::DupArchive ? 'daf' : 'zip');
?>
<form
id="dpro-template-form"
class="dup-monitored-form <?php echo ($blur ? 'dup-mock-blur' : ''); ?>"
data-parsley-validate data-parsley-ui-enabled="true"
action="<?php echo esc_url($edit_template_url); ?>"
method="post"
>
<?php wp_nonce_field($nonce_action); ?>
<input type="hidden" id="dpro-template-form-action" name="action" value="save">
<input type="hidden" name="package_template_id" value="<?php echo intval($package_template->getId()); ?>">
<!-- ====================
SUB-TABS -->
<?php if ($was_updated) : ?>
<div class="notice notice-success is-dismissible dpro-wpnotice-box">
<p>
<?php esc_html_e('Template Updated', 'duplicator-pro'); ?>
</p>
</div>
<?php endif; ?>
<!-- ====================
TOOL-BAR -->
<table class="dpro-edit-toolbar">
<tr>
<td>
<?php
if ($package_template_count > 0) :
$general_templates = array();
$existing_templates = array();
foreach ($package_templates as $copy_package_template) {
if ($copy_package_template->getId() != $package_template->getId()) {
if ($copy_package_template->is_default || $copy_package_template->is_manual) {
$general_templates[$copy_package_template->getId()] = $copy_package_template->is_manual
? __("Active Build Settings", 'duplicator-pro')
: $copy_package_template->name;
} else {
$existing_templates[$copy_package_template->getId()] = $copy_package_template->name;
}
}
}
?>
<select name="duppro-source-template-id">
<option value="-1"><?php esc_html_e("Copy From", 'duplicator-pro'); ?></option>
<?php
if (!empty($general_templates)) {
asort($general_templates);
?>
<optgroup label="<?php esc_attr_e("General Templates", 'duplicator-pro'); ?>">
<?php
foreach ($general_templates as $id => $val) {
?>
<option value="<?php echo $id; ?>"><?php echo esc_html($val); ?></option>
<?php
}
?>
</optgroup>
<?php
}
?>
<?php
if (!empty($existing_templates)) {
asort($existing_templates);
?>
<optgroup label="<?php esc_attr_e("Existing Templates", 'duplicator-pro'); ?>">
<?php
foreach ($existing_templates as $id => $val) {
?>
<option value="<?php echo $id; ?>"><?php echo esc_html($val); ?></option>
<?php
}
?>
</optgroup>
<?php
}
?>
</select>
<input type="button" class="button action" value="<?php esc_attr_e("Apply", 'duplicator-pro') ?>" onclick="DupPro.Template.Copy()">
<?php else : ?>
<select disabled="disabled"><option value="-1" selected="selected"><?php _e('Copy From', 'duplicator-pro'); ?></option></select>
<input type="button" class="button action" value="<?php esc_attr_e("Apply", 'duplicator-pro') ?>" onclick="DupPro.Template.Copy()" disabled="disabled">
<?php endif; ?>
</td>
<td>
<div class="btnnav">
<a href="<?php echo esc_url($templates_tab_url); ?>" class="button dup-goto-templates-btn">
<i class="far fa-clone"></i> <?php esc_html_e('Templates', 'duplicator-pro'); ?>
</a>
<?php if ($package_template_id != -1) : ?>
<a href="<?php echo esc_url($edit_template_url); ?>" class="button">
<?php esc_html_e("Add New", 'duplicator-pro'); ?>
</a>
<?php endif; ?>
</div>
</td>
</tr>
</table>
<hr class="dpro-edit-toolbar-divider"/>
<div class="dpro-template-general">
<div class="margin-b-10px">
<label><?php _e("Recovery Status", 'duplicator-pro'); ?>:</label> &nbsp;
<?php $package_template->recoveableHtmlInfo(); ?> <br/><br/>
</div>
<label><?php _e("Template", 'duplicator-pro'); ?>:</label>
<input type="text" id="template-name" name="name" data-parsley-errors-container="#template_name_error_container"
data-parsley-required="true" value="<?php echo esc_attr($package_template->name); ?>" autocomplete="off" maxlength="125">
<div id="template_name_error_container" class="duplicator-error-container"></div>
<label><?php _e("Notes", 'duplicator-pro'); ?>:</label> <br/>
<textarea id="template-notes" name="notes" style="height:50px"><?php echo esc_textarea($package_template->notes); ?></textarea>
</div>
<!-- ===============================
ARCHIVE -->
<div class="dup-box dup-archive-filters-wrapper">
<div class="dup-box-title">
<i class="far fa-file-archive fa-sm"></i> <?php esc_html_e('Archive', 'duplicator-pro') ?>
<sup class="dup-box-title-badge">
<?php echo esc_html($archive_format); ?>
</sup> &nbsp; &nbsp;
<button class="dup-box-arrow">
<span class="screen-reader-text"><?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Archive', 'duplicator-pro') ?></span>
</button>
</div>
<div class="dup-box-panel" id="dup-template-archive-panel" style="<?php echo esc_attr($ui_css_archive); ?>">
<!-- ===================
NESTED TABS -->
<div data-dpro-tabs="true">
<ul>
<li class="filter-files-tab"><?php esc_html_e('Files', 'duplicator-pro') ?></li>
<li class="filter-db-tab"><?php esc_html_e('Database', 'duplicator-pro') ?></li>
<?php if ($displayMultisiteTab) { ?>
<li class="filter-mu-tab"><?php esc_html_e('Multisite', 'duplicator-pro') ?></li>
<?php } ?>
<li class="archive-setup-tab"><?php esc_html_e('Setup', 'duplicator-pro') ?></li>
</ul>
<!-- ===================
TAB1: FILES -->
<div class="filter-files-tab-content" >
<?php $tplMng->render(
'parts/filters/package_components',
array(
'archiveFilterOn' => $package_template->archive_filter_on,
'archiveFilterDirs' => $package_template->archive_filter_dirs,
'archiveFilterFiles' => $package_template->archive_filter_files,
'archiveFilterExtensions' => $package_template->archive_filter_exts,
'components' => $package_template->components,
)
); ?>
</div>
<!-- ===================
TAB2: DATABASE -->
<div>
<div class="dup-template-db-area">
<?php
$tableList = explode(',', $package_template->database_filter_tables);
$tplMng->render(
'parts/filters/tables_list_filter',
array(
'dbFilterOn' => $package_template->database_filter_on,
'dbPrefixFilter' => $package_template->databasePrefixFilter,
'dbPrefixSubFilter' => $package_template->databasePrefixSubFilter,
'tablesSlected' => $tableList,
)
);
?><br/>
<div class="dup-form-item">
<span class="title">
<?php esc_html_e("Compatibility Mode", 'duplicator-pro') ?>
<i class="fas fa-question-circle fa-sm"
data-tooltip-title="<?php esc_attr_e("Legacy Support", 'duplicator-pro'); ?>"
data-tooltip="<?php
esc_attr_e(
'This option is not available as a template setting.
It can only be used when creating a new package. Please see the FAQ for a full overview of using this feature.',
'duplicator-pro'
); ?>"
>
</i>
</span>
</div>
<i><?php
$url = "<a href='" . DUPLICATOR_PRO_DUPLICATOR_DOCS_URL . "how-to-fix-database-write-issues' target='_blank'>"
. esc_html__('FAQ details', 'duplicator-pro') . "</a>";
printf(esc_html__("Not enabled for template settings. Please see the full %s", 'duplicator-pro'), $url);
?>
</i>
</div>
</div>
<!-- ===================
MULTI-SITE TAB 3: -->
<?php if ($displayMultisiteTab) : ?>
<div>
<div class="dup-template-mu-area">
<?php esc_html_e("Support for multisite filters is only available when creating a new package.", 'duplicator-pro'); ?> <br/>
<?php esc_html_e("To create a new package goto the Packages screen and click the 'Create New' button.", 'duplicator-pro'); ?>
</div>
</div>
<?php endif; ?>
<!-- ===================
SETUP TAB 4: -->
<?php
$tplMng->render(
'admin_pages/packages/setup/archive-setup-tab',
[
'secureOn' => $package_template->installer_opts_secure_on,
'securePass' => $package_template->installerPassowrd,
]
);
?>
</div>
<!-- end tab control -->
</div>
</div>
<br />
<!-- ===============================
INSTALLER -->
<div class="dup-box">
<div class="dup-box-title">
<i class="fa fa-bolt fa-sm"></i> <?php esc_html_e('Installer', 'duplicator-pro') ?>
<button class="dup-box-arrow">
<span class="screen-reader-text"><?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Installer', 'duplicator-pro') ?></span>
</button>
</div>
<div class="dup-box-panel" id="dup-template-install-panel" style="<?php echo esc_attr($ui_css_install); ?>">
<div class="dpro-panel-optional-txt">
<b><?php esc_html_e('All values in this section are', 'duplicator-pro'); ?> <u><?php esc_html_e('optional', 'duplicator-pro'); ?></u></b>
<i class="fas fa-question-circle fa-sm"
data-tooltip-title="<?php esc_attr_e("Setup/Prefills", 'duplicator-pro'); ?>"
data-tooltip="<?php
esc_attr_e(
'All values in this section are OPTIONAL! If you know ahead of time the database input fields the installer will use,
then you can optionally enter them here and they will be prefilled at install time.
Otherwise you can just enter them in at install time and ignore all these options in the Installer section.',
'duplicator-pro'
);
?>"></i>
</div>
<table class="dpro-install-setup" style="margin-top:-10px">
<tr>
<td colspan="2"><div class="dup-package-hdr-1"><?php esc_html_e("Setup", 'duplicator-pro') ?></div></td>
</tr>
<tr>
<td style="width:130px"><b><?php esc_html_e("Branding", 'duplicator-pro') ?>:</b></td>
<td>
<?php
if (License::can(License::CAPABILITY_BRAND)) :
$brands = BrandEntity::getAllWithDefault();
?>
<select name="installer_opts_brand" id="installer_opts_brand" onchange="DupPro.Template.BrandChange();">
<?php
$active_brand_id = $package_template->installer_opts_brand;
foreach ($brands as $i => $brand) :
?>
<option value="<?php echo $brand->getId(); ?>" title="<?php echo esc_attr($brand->notes); ?>"<?php if (isset($_REQUEST['inner_page']) && $_REQUEST['inner_page'] == 'edit') {
selected($brand->getId(), $active_brand_id);
} ?>>
<?php echo esc_html($brand->name); ?>
</option>
<?php endforeach; ?>
</select>
<a href="javascript:void(0)" target="_blank" class="button" id="brand-preview">
<?php esc_html_e("Preview", 'duplicator-pro'); ?>
</a> &nbsp;
<i class="fas fa-question-circle fa-sm"
data-tooltip-title="<?php esc_attr_e("Choose Brand", 'duplicator-pro'); ?>"
data-tooltip="<?php esc_attr_e('This option changes the branding of the installer file. Click the preview button to see the selected style.', 'duplicator-pro'); ?>"></i>
<?php else : ?>
<a href="<?php echo esc_url($bandListUrl); ?>" class="upgrade-link" target="_blank">
<?php esc_html_e("Enable Branding", 'duplicator-pro'); ?>
</a>
<?php endif; ?>
<br/><br/>
</td>
</tr>
</table>
<br/>
<table style="width:100%">
<tr>
<td colspan="2"><div class="dup-package-hdr-1"><?php esc_html_e("Prefills", 'duplicator-pro') ?></div></td>
</tr>
</table>
<!-- ===================
STEP1 TABS -->
<div data-dpro-tabs="true">
<ul>
<li><?php esc_html_e('Basic', 'duplicator-pro') ?></li>
<li id="dpro-cpnl-tab-lbl"><?php esc_html_e('cPanel', 'duplicator-pro') ?></li>
</ul>
<!-- ===================
TAB1: Basic -->
<div class="dup-template-basic-tab">
<table class="form-table" role="presentation">
<tr>
<td colspan="2">
<b class="dpro-hdr"><?php esc_html_e('MySQL Server', 'duplicator-pro'); ?></b>
</td>
</tr>
<tr>
<th scope="row"><?php _e("Host", 'duplicator-pro'); ?>:</th>
<td><input type="text" placeholder="localhost" name="installer_opts_db_host" value="<?php echo esc_attr($package_template->installer_opts_db_host); ?>"></td>
</tr>
<tr>
<th><label><?php _e("Database", 'duplicator-pro'); ?>:</label></th>
<td><input type="text" placeholder="<?php esc_attr_e('valid database name', 'duplicator-pro'); ?>" name="installer_opts_db_name" value="<?php echo esc_attr($package_template->installer_opts_db_name); ?>"></td>
</tr>
<tr>
<th><label><?php _e("User", 'duplicator-pro'); ?>:</label></th>
<td><input type="text" placeholder="<?php esc_attr_e('valid database user', 'duplicator-pro'); ?>" name="installer_opts_db_user" value="<?php echo esc_attr($package_template->installer_opts_db_user); ?>"></td>
</tr>
</table>
<br/><br/>
</div>
<!-- ===================
TAB2: cPanel -->
<div class="dup-template-cpanel-tab">
<table class="form-table" role="presentation">
<tr>
<td colspan="2"><b class="dpro-hdr"><?php esc_html_e('cPanel Login', 'duplicator-pro'); ?></b></td>
</tr>
<tr>
<th scope="row"><label><?php esc_html_e("Automation", 'duplicator-pro'); ?>:</label></th>
<td>
<input type="checkbox" name="installer_opts_cpnl_enable" id="installer_opts_cpnl_enable" <?php checked($package_template->installer_opts_cpnl_enable); ?> >
<label for="installer_opts_cpnl_enable">Auto Select cPanel</label>
<i
class="fas fa-question-circle fa-sm"
data-tooltip-title="Auto Select cPanel:"
data-tooltip="<?php esc_attr_e('Enabling this options will automatically select the cPanel tab when step one of the installer is shown.', 'duplicator-pro'); ?>" >
</i>
&nbsp; &nbsp;
</td>
</tr>
<tr>
<th scope="row"><label><?php esc_html_e("Host", 'duplicator-pro'); ?>:</label></th>
<td><input type="text" name="installer_opts_cpnl_host" value="<?php echo esc_attr($package_template->installer_opts_cpnl_host); ?>" placeholder="<?php esc_attr_e('valid cpanel host address', 'duplicator-pro'); ?>"></td>
</tr>
<tr>
<th scope="row"><label><?php esc_html_e("User", 'duplicator-pro'); ?>:</label></th>
<td><input type="text" name="installer_opts_cpnl_user" value="<?php echo esc_attr($package_template->installer_opts_cpnl_user); ?>" placeholder="<?php esc_attr_e('valid cpanel user login', 'duplicator-pro'); ?>"></td>
</tr>
<tr>
<td colspan="2">
<b class="dpro-hdr"><?php esc_html_e('MySQL Server', 'duplicator-pro'); ?></b>
</td>
</tr>
<tr>
<th scope="row"><label><?php _e("Action", 'duplicator-pro'); ?>:</label></th>
<td>
<select name="installer_opts_cpnl_db_action" id="cpnl-dbaction">
<option value="create" <?php echo ($installer_cpnldbaction == 'create') ? 'selected' : ''; ?>>Create A New Database</option>
<option value="empty" <?php echo ($installer_cpnldbaction == 'empty') ? 'selected' : ''; ?>>Connect to Existing Database and Remove All Data</option>
<!--option value="rename">Connect to Existing Database and Rename Existing Tables</option-->
</select>
</td>
</tr>
<tr>
<th scope="row"><label><?php _e("Host", 'duplicator-pro'); ?>:</label></th>
<td><input type="text" name="installer_opts_cpnl_db_host" value="<?php echo esc_attr($package_template->installer_opts_cpnl_db_host); ?>" placeholder="<?php esc_attr_e('localhost', 'duplicator-pro'); ?>" /></td>
</tr>
<tr>
<th scope="row"><label><?php _e("Database", 'duplicator-pro'); ?>:</label></th>
<td><input type="text" name="installer_opts_cpnl_db_name" value="<?php echo esc_attr($package_template->installer_opts_cpnl_db_name); ?>" placeholder="<?php esc_attr_e('valid database name', 'duplicator-pro'); ?>" /></td>
</tr>
<tr>
<th scope="row"><label><?php _e("User", 'duplicator-pro'); ?>::</label></th>
<td><input type="text" name="installer_opts_cpnl_db_user" value="<?php echo esc_attr($package_template->installer_opts_cpnl_db_user); ?>" placeholder="<?php esc_attr_e('valid database user', 'duplicator-pro'); ?>" /></td>
</tr>
</table>
</div>
</div><br/>
<small><?php esc_html_e("All other inputs can be entered at install time.", 'duplicator-pro') ?></small>
<br/><br/>
</div>
</div>
<br/>
<button
class="button button-primary dup-save-template-btn"
type="submit"
>
<?php esc_html_e('Save Template', 'duplicator-pro'); ?>
</button>
</form>
<?php
$alert1 = new DUP_PRO_UI_Dialog();
$alert1->title = __('Transfer Error', 'duplicator-pro');
$alert1->message = __('You can\'t exclude all sites!', 'duplicator-pro');
$alert1->initAlert();
?>
<script>
jQuery(document).ready(function ($) {
/* When installer brand changes preview button is updated */
DupPro.Template.BrandChange = function ()
{
var $brand = $("#installer_opts_brand");
var $id = $brand.val();
var $url = new Array();
$url = [
<?php echo SnapJson::jsonEncode($brandDefaultEditUrl); ?>,
<?php echo SnapJson::jsonEncode($brandBaseEditUrl); ?> + '&id=' + $id
];
$("#brand-preview").attr('href', $url[ $id > 0 ? 1 : 0 ]);
};
/* Enables strike through on excluded DB table */
DupPro.Template.ExcludeTable = function (check)
{
var $cb = $(check);
if ($cb.is(":checked")) {
$cb.closest("label").css('textDecoration', 'line-through');
} else {
$cb.closest("label").css('textDecoration', 'none');
}
}
/* Used to duplicate a template */
DupPro.Template.Copy = function ()
{
$("#dpro-template-form-action").val('copy-template');
$("#dpro-template-form").parsley().destroy();
$("#dpro-template-form").submit();
};
//INIT
$('#template-name').focus().select();
// $('#_archive_filter_files').val($('#_archive_filter_files').val().trim());
//Default to cPanel tab if used
$('#cpnl-enable').is(":checked") ? $('#dpro-cpnl-tab-lbl').trigger("click") : null;
DupPro.EnableInstallerPassword();
DupPro.Template.BrandChange();
//MU-Transfer buttons
$('#mu-include-btn').click(function () {
return !$('#mu-exclude option:selected').remove().appendTo('#mu-include');
});
$('#mu-exclude-btn').click(function () {
var include_all_count = $('#mu-include option').length;
var include_selected_count = $('#mu-include option:selected').length;
if (include_all_count > include_selected_count) {
return !$('#mu-include option:selected').remove().appendTo('#mu-exclude');
} else {
<?php $alert1->showAlert(); ?>
}
});
$('#dpro-template-form').submit(function () {
DupPro.Pack.FillExcludeTablesList();
});
//Defaults to Installer cPanel tab if 'Auto Select cPanel' is checked
$('#installer_opts_cpnl_enable').is(":checked") ? $('#dpro-cpnl-tab-lbl').trigger("click") : null;
});
</script>

View File

@@ -0,0 +1,315 @@
<?php
use Duplicator\Controllers\ToolsPageController;
use Duplicator\Core\Controllers\ControllersManager;
use Duplicator\Core\Views\TplMng;
defined("ABSPATH") or die("");
/**
* @var DUP_PRO_Package_Template_Entity $package_template
*/
$nonce_action = 'duppro-template-list';
$display_edit = false;
/** @var bool */
$blur = TplMng::getInstance()->getGlobalValue('blur');
$templates_tab_url = ControllersManager::getMenuLink(
ControllersManager::TOOLS_SUBMENU_SLUG,
ToolsPageController::L2_SLUG_TEMPLATE
);
$edit_template_url = ControllersManager::getMenuLink(
ControllersManager::TOOLS_SUBMENU_SLUG,
ToolsPageController::L2_SLUG_TEMPLATE,
null,
array('inner_page' => 'edit')
);
if (!empty($_REQUEST['action'])) {
$nonce_val = isset($_POST['_wpnonce']) ? $_POST['_wpnonce'] : $_GET['_wpnonce'];
DUP_PRO_U::verifyNonce($nonce_val, $nonce_action);
$action = sanitize_text_field($_REQUEST['action']);
switch ($action) {
case 'add':
case 'edit':
$display_edit = true;
break;
case 'bulk-delete':
if (is_array($_REQUEST['selected_id'])) {
$package_template_ids = array_map("intval", $_REQUEST['selected_id']);
} else {
$package_template_ids = [ ((int) $_REQUEST['selected_id']) ];
}
foreach ($package_template_ids as $package_template_id) {
DUP_PRO_Log::trace("attempting to delete $package_template_id");
DUP_PRO_Package_Template_Entity::deleteById($package_template_id);
}
break;
case 'delete':
$package_template_id = (int) $_REQUEST['package_template_id'];
DUP_PRO_Log::trace("attempting to delete $package_template_id");
DUP_PRO_Package_Template_Entity::deleteById($package_template_id);
break;
default:
break;
}
}
if (($package_templates = DUP_PRO_Package_Template_Entity::getAllWithoutManualMode()) === false) {
$package_templates = array();
}
$package_template_count = count($package_templates);
?>
<form
id="dup-package-form"
class="<?php echo ($blur ? 'dup-mock-blur' : ''); ?>"
action="<?php echo esc_url($templates_tab_url); ?>"
method="post"
>
<?php wp_nonce_field($nonce_action); ?>
<input type="hidden" id="dup-package-form-action" name="action" value=""/>
<input type="hidden" id="dup-package-selected-package-template" name="package_template_id" value="-1"/>
<!-- ====================
TOOL-BAR -->
<table class="dpro-edit-toolbar">
<tr>
<td>
<select id="bulk_action">
<option value="-1" selected="selected"><?php esc_html_e("Bulk Actions", 'duplicator-pro'); ?></option>
<option value="delete" title="Delete selected package(s)"><?php esc_html_e("Delete", 'duplicator-pro'); ?></option>
</select>
<input type="button" class="button action" value="<?php esc_attr_e("Apply", 'duplicator-pro') ?>" onclick="DupPro.Template.BulkAction()">
</td>
<td>
<div class="btnnav">
<a href="<?php echo esc_url($edit_template_url); ?>" class="button dup-add-template-btn"><?php esc_html_e('Add New', 'duplicator-pro'); ?></a>
</div>
</td>
</tr>
</table>
<!-- ====================
LIST ALL SCHEDULES -->
<table class="widefat dup-template-list-tbl striped">
<thead>
<tr>
<th class="col-check"><input type="checkbox" id="dpro-chk-all" title="Select all packages" onclick="DupPro.Template.SetDeleteAll(this)"></th>
<th class="col-name"><?php _e('Name', 'duplicator-pro'); ?></th>
<th class="col-recover"><?php _e('Recovery', 'duplicator-pro'); ?></th>
<th class="col-empty"></th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($package_templates as $package_template) :
$i++;
$schedules = DUP_PRO_Schedule_Entity::get_by_template_id($package_template->getId());
$schedule_count = count($schedules);
?>
<tr class="package-row <?php echo ($i % 2) ? 'alternate' : ''; ?>">
<td class="col-check">
<?php if ($package_template->is_default == false) : ?>
<input name="selected_id[]" type="checkbox" value="<?php echo intval($package_template->getId()); ?>" class="item-chk" />
<?php else : ?>
<input type="checkbox" disabled />
<?php endif; ?>
</td>
<td class="col-name" >
<a
href="javascript:void(0);"
onclick="DupPro.Template.Edit(<?php echo intval($package_template->getId()); ?>);"
class="name"
data-template-id="<?php echo intval($package_template->getId()); ?>"
>
<?php echo esc_html($package_template->name); ?>
</a>
<div class="sub-menu">
<a class="dup-edit-template-btn" href="javascript:void(0);"onclick="DupPro.Template.Edit(<?php echo $package_template->getId(); ?>);" ><?php esc_html_e('Edit', 'duplicator-pro'); ?></a> |
<a class="dup-copy-template-btn" href="javascript:void(0);"onclick="DupPro.Template.Copy(<?php echo $package_template->getId(); ?>);" ><?php esc_html_e('Copy', 'duplicator-pro'); ?></a>
<?php if ($package_template->is_default == false) : ?>
| <a
class="dup-delete-template-btn"
href="javascript:void(0);"
onclick="DupPro.Template.Delete(<?php echo $package_template->getId() ?>, <?php echo intval($schedule_count); ?>);"
>
<?php esc_html_e('Delete', 'duplicator-pro'); ?>
</a>
<?php endif; ?>
</div>
</td>
<td class="col-recover" >
<?php $package_template->recoveableHtmlInfo(true); ?>
</td>
<td>&nbsp;</td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<th colspan="8" style="text-align:right; font-size:12px">
<?php echo esc_html__('Total', 'duplicator-pro') . ': ' . $package_template_count; ?>
</th>
</tr>
</tfoot>
</table>
</form>
<?php
$alert1 = new DUP_PRO_UI_Dialog();
$alert1->title = __('Bulk Action Required', 'duplicator-pro');
$alert1->message = __('Please select an action from the "Bulk Actions" drop down menu!', 'duplicator-pro');
$alert1->initAlert();
$alert2 = new DUP_PRO_UI_Dialog();
$alert2->title = __('Selection Required', 'duplicator-pro');
$alert2->message = __('Please select at least one template to delete!', 'duplicator-pro');
$alert2->initAlert();
$confirm1 = new DUP_PRO_UI_Dialog();
$confirm1->wrapperClassButtons = 'dup-delete-template-dialog-bulk';
$confirm1->title = __('Delete the selected templates?', 'duplicator-pro');
$confirm1->message = __('All schedules using this template will be reassigned to the "Default" Template.', 'duplicator-pro');
$confirm1->message .= '<br/><br/>';
$confirm1->message .= '<small><i>' . __('Note: This action removes all selected custom templates.', 'duplicator-pro') . '</i></small>';
$confirm1->progressText = __('Removing Templates, Please Wait...', 'duplicator-pro');
$confirm1->jsCallback = 'DupPro.Storage.BulkDelete()';
$confirm1->initConfirm();
$confirm2 = new DUP_PRO_UI_Dialog();
$confirm2->wrapperClassButtons = 'dup-delete-template-dialog-single';
$confirm2->title = __('Are you sure you want to delete this template?', 'duplicator-pro');
$confirm2->message = __('All schedules using this template will be reassigned to the "Default" Template.', 'duplicator-pro');
$confirm2->progressText = $confirm1->progressText;
$confirm2->jsCallback = 'DupPro.Template.DeleteThis(this)';
$confirm2->initConfirm();
?>
<script>
jQuery(document).ready(function ($) {
//Shows detail view
DupPro.Template.View = function (id) {
$('#' + id).toggle();
}
// Edit template
DupPro.Template.Edit = function (id) {
document.location.href = '<?php echo "$edit_template_url&package_template_id="; ?>' + id;
};
// Copy template
DupPro.Template.Copy = function (id) {
<?php
$params = array(
'action=copy-template',
'_wpnonce=' . wp_create_nonce('duppro-template-edit'),
'package_template_id=-1',
'duppro-source-template-id=', // last params get id from js param function
);
$edit_template_url .= '&' . implode('&', $params);
?>
document.location.href = '<?php echo "$edit_template_url"; ?>' + id;
};
//Delets a single record
DupPro.Template.Delete = function (id, schedule_count) {
var message = "";
<?php $confirm2->showConfirm(); ?>
if (schedule_count > 0)
{
message += "<?php esc_html_e('There currently are', 'duplicator-pro') ?>" + " ";
message += schedule_count + " " + "<?php esc_html_e('schedule(s) using this template.', 'duplicator-pro'); ?>" + " ";
message += "<?php esc_html_e('All schedules using this template will be reassigned to the \"Default\" template.', 'duplicator-pro') ?>" + " ";
$("#<?php echo esc_js($confirm2->getID()); ?>_message").html(message);
}
$("#<?php echo esc_js($confirm2->getID()); ?>-confirm").attr('data-id', id);
}
DupPro.Template.DeleteThis = function (e) {
var id = $(e).attr('data-id');
jQuery("#dup-package-form-action").val('delete');
jQuery("#dup-package-selected-package-template").val(id);
jQuery("#dup-package-form").submit();
}
// Creats a comma seperate list of all selected package ids
DupPro.Template.DeleteList = function ()
{
var arr = [];
$("input[name^='selected_id[]']").each(function (i, index) {
var $this = $(index);
if ($this.is(':checked') == true) {
arr[i] = $this.val();
}
});
return arr.join(',');
}
// Bulk Action
DupPro.Template.BulkAction = function () {
var list = DupPro.Template.DeleteList();
if (list.length == 0) {
<?php $alert2->showAlert(); ?>
return;
}
var action = $('#bulk_action').val(),
checked = ($('.item-chk:checked').length > 0);
if (action != "delete") {
<?php $alert1->showAlert(); ?>
return;
}
if (checked)
{
switch (action) {
default:
<?php $alert2->showAlert(); ?>
break;
case 'delete':
<?php $confirm1->showConfirm(); ?>
break;
}
}
}
DupPro.Storage.BulkDelete = function ()
{
jQuery("#dup-package-form-action").val('bulk-delete');
jQuery("#dup-package-form").submit();
}
//Sets all for deletion
DupPro.Template.SetDeleteAll = function (chkbox) {
$('.item-chk').each(function () {
this.checked = chkbox.checked;
});
}
//Name hover show menu
$("tr.package-row").hover(
function () {
$(this).find(".sub-menu").show();
},
function () {
$(this).find(".sub-menu").hide();
}
);
});
</script>

View File

@@ -0,0 +1,95 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
use Duplicator\Libs\Snap\SnapIO;
use Duplicator\Package\Recovery\RecoveryStatus;
use Duplicator\Views\ViewHelper;
/**
* @var DUP_PRO_Package_Template_Entity $template
* @var DUP_PRO_Schedule_Entity|null $schedule
* @var bool $isList
*/
if (isset($schedule)) {
$recoveryStatus = new RecoveryStatus($schedule);
} else {
$recoveryStatus = new RecoveryStatus($template);
}
$isRecoveable = $recoveryStatus->isRecoveable();
$templareRecoveryAlter = new DUP_PRO_UI_Dialog();
if (!$isRecoveable) {
$templareRecoveryAlter->title = (
isset($schedule) ?
__('Schedule: Recovery Point', 'duplicator-pro') :
__('Template: Recovery Point', 'duplicator-pro')
);
$templareRecoveryAlter->width = 600;
$templareRecoveryAlter->height = 600;
$templareRecoveryAlter->showButtons = false;
$templareRecoveryAlter->message = SnapIO::getInclude(
__DIR__ . '/template-filters-info.php',
array('recoveryStatus' => $recoveryStatus)
);
$templareRecoveryAlter->initAlert();
?>
<script>
jQuery(document).ready(function ($) {
$('#dup-template-recoveable-info-<?php echo $templareRecoveryAlter->getUniqueIdCounter(); ?>').click(function () {
<?php $templareRecoveryAlter->showAlert(); ?>
});
});
</script>
<?php
}
?>
<span class="dup-template-recoveable-info-wrapper" >
<?php
if ($isRecoveable) {
?>
<?php _e('Available', 'duplicator-pro'); ?>
<sup><?php ViewHelper::disasterIcon(); ?></sup>
<?php
} else {
?>
<a href="javascript:void(0)"
id="dup-template-recoveable-info-<?php echo $templareRecoveryAlter->getUniqueIdCounter(); ?>"
class="dup-template-recoveable-info"><u><?php _e('Disabled', 'duplicator-pro'); ?></u></a>
<?php
}
if (!$isList) {
?>
<sup>
<i class="fas fa-question-circle fa-sm"
data-tooltip-title="<?php esc_attr_e("Recovery Status", 'duplicator-pro'); ?>"
data-tooltip="<?php
if (!isset($schedule)) {
_e(
"The Recovery Status can be either 'Available' or 'Disabled'.
An 'Available' status allows the templates archive to be restored through the recovery point wizard.
A 'Disabled' status means the archive can still be used but just not ran as a rapid recovery point.",
'duplicator-pro'
);
} else {
_e(
"The Recovery Status can be either 'Available' or 'Disabled'.
An 'Available' status allows the schedules archive to be restored through the recovery point wizard.
A 'Disabled' status means the archive can still be used but just not ran as a rapid recovery point.",
'duplicator-pro'
);
}
?>"
></i>
</sup>
<?php } ?>
</span>

View File

@@ -0,0 +1,79 @@
<?php
use Duplicator\Controllers\ToolsPageController;
use Duplicator\Core\Views\TplMng;
use Duplicator\Package\Recovery\RecoveryStatus;
use Duplicator\Views\ViewHelper;
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
/**
* @var RecoveryStatus $recoveryStatus
*/
if ($recoveryStatus->getType() == RecoveryStatus::TYPE_SCHEDULE) {
/** @var DUP_PRO_Schedule_Entity */
$schedule = $recoveryStatus->getObject();
if (($template = $schedule->getTemplate()) === false) {
$template = new DUP_PRO_Package_Template_Entity();
$template->name = __('Template not found', 'duplicator-pro');
}
$tooltipContent = esc_attr__(
'A Schedule is not required to have a recovery point. For example if a schedule is backing up
only a database then the recovery will always be disabled and may be desirable.',
'duplicator-pro'
);
} else {
$schedule = null;
/** @var DUP_PRO_Package_Template_Entity */
$template = $recoveryStatus->getObject();
$tooltipContent = esc_attr__(
'A Template is not required to have a recovery point. For example if backing up only a database
then the recovery will always be disabled and may be desirable.',
'duplicator-pro'
);
}
?>
<div class="dup-recover-dlg-title">
<b><?php ViewHelper::disasterIcon(); ?>&nbsp;<?php _e('Status', 'duplicator-pro'); ?>:</b>
<?php _e('Disabled', 'duplicator-pro'); ?>
<sup>
<i class="fas fa-question-circle fa-xs"
data-tooltip-title="<?php _e('Recovery Status', 'duplicator-pro'); ?>"
data-tooltip="<?php echo $tooltipContent; ?>">
</i>
</sup>
</div>
<div class="dup-recover-dlg-subinfo">
<table>
<?php if ($recoveryStatus->getType() == RecoveryStatus::TYPE_SCHEDULE) { ?>
<tr>
<td><b><?php _e("Schedule", 'duplicator-pro'); ?>:</b></td>
<td> <?php echo esc_html($schedule->name); ?></td>
</tr>
<tr>
<td> <b><?php _e("Template", 'duplicator-pro'); ?>:</b></td>
<td>
<a href="<?php echo esc_url(ToolsPageController::getTemplateEditURL($template->getId())); ?>" >
<?php echo esc_html($template->name); ?>
</a>
</td>
</tr>
<?php } else { ?>
<tr>
<td> <b><?php _e("Template", 'duplicator-pro'); ?>:</b> </td>
<td><?php echo esc_html($template->name); ?></td>
</tr>
<tr>
<td><b><?php esc_html_e('Notes', 'duplicator-pro'); ?>:</b>&nbsp; </td>
<td><?php echo (strlen($template->notes)) ? $template->notes : __("- no notes -", 'duplicator-pro'); ?></td>
</tr>
<?php } ?>
</table>
</div>
<?php
TplMng::getInstance()->render(
'parts/recovery/exclude_data_box',
array('recoverStatus' => $recoveryStatus)
);