first commit

This commit is contained in:
2026-03-05 13:07:40 +01:00
commit 64ba0721ee
25709 changed files with 4691006 additions and 0 deletions

View File

@@ -0,0 +1,137 @@
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
$sql = "SELECT * FROM `{$wpdb->prefix}options` WHERE `option_name` LIKE '%duplicator_%' AND `option_name` NOT LIKE '%duplicator_pro%' ORDER BY option_name";
?>
<!-- ==============================
OPTIONS DATA -->
<div class="dup-box">
<div class="dup-box-title">
<i class="fa fa-th-list"></i>
<?php esc_html_e("Stored Data", 'duplicator'); ?>
<div class="dup-box-arrow"></div>
</div>
<div class="dup-box-panel" id="dup-settings-diag-opts-panel" style="<?php echo esc_html($ui_css_opts_panel); ?>">
<div style="padding-left:10px">
<h3 class="title"><?php esc_html_e('Data Cleanup', 'duplicator') ?></h3>
<table class="dup-reset-opts">
<tr style="vertical-align:text-top">
<td>
<button id="dup-remove-installer-files-btn" type="button" class="button button-small dup-fixed-btn" onclick="Duplicator.Tools.deleteInstallerFiles();">
<?php esc_html_e("Remove Installation Files", 'duplicator'); ?>
</button>
</td>
<td>
<?php esc_html_e("Removes all reserved installer files.", 'duplicator'); ?>
<a href="javascript:void(0)" onclick="jQuery('#dup-tools-delete-moreinfo').toggle()">[<?php esc_html_e("more info", 'duplicator'); ?>]</a><br/>
<div id="dup-tools-delete-moreinfo">
<?php
esc_html_e("Clicking on the 'Remove Installation Files' button will attempt to remove the installer files used by Duplicator. These files should not "
. "be left on production systems for security reasons. Below are the files that should be removed.", 'duplicator');
echo "<br/><br/>";
$installer_files = array_keys($installer_files);
array_push($installer_files, '[HASH]_archive.zip/daf');
echo '<i>' . implode('<br/>', $installer_files) . '</i>';
echo "<br/><br/>";
?>
</div>
</td>
</tr>
<tr>
<td>
<button type="button" class="button button-small dup-fixed-btn" onclick="Duplicator.Tools.ConfirmClearBuildCache()">
<?php esc_html_e("Clear Build Cache", 'duplicator'); ?>
</button>
</td>
<td><?php esc_html_e("Removes all build data from:", 'duplicator'); ?> [<?php echo DUP_Settings::getSsdirTmpPath() ?>].</td>
</tr>
</table>
</div>
<div style="padding:0px 20px 0px 25px">
<h3 class="title" style="margin-left:-15px"><?php esc_html_e("Options Values", 'duplicator') ?> </h3>
<table class="widefat" cellspacing="0">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php
foreach ($wpdb->get_results("{$sql}") as $key => $row) { ?>
<tr>
<td>
<?php
echo (in_array($row->option_name, $GLOBALS['DUPLICATOR_OPTS_DELETE']))
? "<a href='javascript:void(0)' onclick='Duplicator.Settings.ConfirmDeleteOption(this)'>" . esc_html($row->option_name) . "</a>"
: $row->option_name;
?>
</td>
<td><textarea class="dup-opts-read" readonly="readonly"><?php echo esc_textarea($row->option_value); ?></textarea></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<br/>
<!-- ==========================================
THICK-BOX DIALOGS: -->
<?php
$confirm1 = new DUP_UI_Dialog();
$confirm1->title = __('Delete Option?', 'duplicator');
$confirm1->message = __('Delete the option value just selected?', 'duplicator');
$confirm1->progressText = __('Removing Option, Please Wait...', 'duplicator');
$confirm1->jscallback = 'Duplicator.Settings.DeleteOption()';
$confirm1->initConfirm();
$confirm2 = new DUP_UI_Dialog();
$confirm2->title = __('Clear Build Cache?', 'duplicator');
$confirm2->message = __('This process will remove all build cache files. Be sure no packages are currently building or else they will be cancelled.', 'duplicator');
$confirm2->jscallback = 'Duplicator.Tools.ClearBuildCache()';
$confirm2->initConfirm();
?>
<script>
jQuery(document).ready(function($)
{
Duplicator.Settings.ConfirmDeleteOption = function (anchor)
{
var key = $(anchor).text();
var msg_id = '<?php echo esc_js($confirm1->getMessageID()); ?>';
var msg = '<?php esc_html_e('Delete the option value', 'duplicator');?>' + ' [' + key + '] ?';
jQuery('#dup-remove-options-value').val(key);
jQuery('#' + msg_id).html(msg)
<?php $confirm1->showConfirm(); ?>
}
Duplicator.Settings.DeleteOption = function ()
{
jQuery('#dup-settings-form').submit();
}
Duplicator.Tools.ConfirmClearBuildCache = function ()
{
<?php $confirm2->showConfirm(); ?>
}
Duplicator.Tools.ClearBuildCache = function ()
{
window.location = '?page=duplicator-tools&tab=diagnostics&action=tmp-cache&_wpnonce=<?php echo esc_js($nonce); ?>';
}
});
Duplicator.Tools.deleteInstallerFiles = function()
{
<?php
$url = DUP_CTRL_Tools::getCleanFilesAcrtionUrl();
echo "window.location = '{$url}';";
?>
}
</script>

View File

@@ -0,0 +1,38 @@
<?php
use Duplicator\Libs\Snap\SnapUtil;
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
ob_start();
SnapUtil::phpinfo();
$serverinfo = ob_get_contents();
ob_end_clean();
if (strlen($serverinfo) < 100) {
$serverinfo = 'The <a href="https://www.php.net/manual/en/function.phpinfo.php" target="_blank">phpinfo function</a> is not supported on this server, '
. 'for more details contact your hosting provider.';
} else {
$serverinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $serverinfo);
$serverinfo = preg_replace('%^.*<title>(.*)</title>.*$%ms', '$1', $serverinfo);
}
?>
<!-- ==============================
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'); ?>
<div class="dup-box-arrow"></div>
</div>
<div class="dup-box-panel" style="display:none">
<div id="dup-phpinfo" style="width:95%">
<?php
echo "<div id='dup-server-info-area'>{$serverinfo}</div>";
$serverinfo = null;
?>
</div><br/>
</div>
</div>
<br/>

View File

@@ -0,0 +1,241 @@
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
$dbvar_maxtime = DUP_DB::getVariable('wait_timeout');
$dbvar_maxpacks = DUP_DB::getVariable('max_allowed_packet');
$dbvar_maxtime = is_null($dbvar_maxtime) ? __("unknow", 'duplicator') : $dbvar_maxtime;
$dbvar_maxpacks = is_null($dbvar_maxpacks) ? __("unknow", 'duplicator') : $dbvar_maxpacks;
$abs_path = duplicator_get_abs_path();
$space = null;
$space_free = null;
$perc = 0;
if (function_exists('disk_total_space') && function_exists('disk_free_space')) {
$space = @disk_total_space($abs_path);
$space_free = @disk_free_space($abs_path);
$perc = @round((100 / $space) * $space_free, 2);
}
$mysqldumpPath = DUP_DB::getMySqlDumpPath();
$mysqlDumpSupport = ($mysqldumpPath) ? $mysqldumpPath : 'Path Not Found';
$client_ip_address = DUP_Server::getClientIP();
$error_log_path = ini_get('error_log');
?>
<!-- ==============================
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') ?>
<div class="dup-box-arrow"></div>
</div>
<div class="dup-box-panel" id="dup-settings-diag-srv-panel" style="<?php echo esc_html($ui_css_srv_panel); ?>">
<table class="widefat" cellspacing="0">
<tr>
<td class='dup-settings-diag-header' colspan="2"><?php esc_html_e("General", 'duplicator'); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Duplicator Version", 'duplicator'); ?></td>
<td>
<?php echo esc_html(DUPLICATOR_VERSION); ?>
</td>
</tr>
<tr>
<td><?php esc_html_e("Operating System", 'duplicator'); ?></td>
<td><?php echo esc_html(PHP_OS) ?></td>
</tr>
<?php if (function_exists('wp_timezone_string')) { ?>
<tr>
<td><?php esc_html_e("Timezone", 'duplicator'); ?></td>
<td><?php echo esc_html(wp_timezone_string()); ?> &nbsp; <small><i>This is a <a href='options-general.php'>WordPress setting</a></i></small></td>
</tr>
<?php } ?>
<tr>
<td><?php esc_html_e("Server Time", 'duplicator'); ?></td>
<td><?php echo current_time("Y-m-d H:i:s"); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Web Server", 'duplicator'); ?></td>
<td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td>
</tr>
<?php
$abs_path = duplicator_get_abs_path();
?>
<tr>
<td><?php esc_html_e("Root Path", 'duplicator'); ?></td>
<td><?php echo esc_html($abs_path); ?></td>
</tr>
<tr>
<td><?php esc_html_e("ABSPATH", 'duplicator'); ?></td>
<td><?php echo esc_html($abs_path); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Plugins Path", 'duplicator'); ?></td>
<td><?php echo esc_html(DUP_Util::safePath(WP_PLUGIN_DIR)); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Loaded PHP INI", 'duplicator'); ?></td>
<td><?php echo esc_html(php_ini_loaded_file()); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Server IP", 'duplicator'); ?></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');
}
?>
<td><?php echo esc_html($server_address); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Client IP", 'duplicator'); ?></td>
<td><?php echo esc_html($client_ip_address);?></td>
</tr>
<tr>
<td class='dup-settings-diag-header' colspan="2">WordPress</td>
</tr>
<tr>
<td><?php esc_html_e("Version", 'duplicator'); ?></td>
<td><?php echo esc_html($wp_version); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Language", 'duplicator'); ?></td>
<td><?php bloginfo('language'); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Charset", 'duplicator'); ?></td>
<td><?php bloginfo('charset'); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Memory Limit ", 'duplicator'); ?></td>
<td><?php echo esc_html(WP_MEMORY_LIMIT); ?> (<?php esc_html_e("Max", 'duplicator');
echo '&nbsp;' . esc_html(WP_MAX_MEMORY_LIMIT); ?>)</td>
</tr>
<tr>
<td class='dup-settings-diag-header' colspan="2">PHP</td>
</tr>
<tr>
<td><?php esc_html_e("Version", 'duplicator'); ?></td>
<td><?php echo esc_html(phpversion()); ?></td>
</tr>
<tr>
<td>SAPI</td>
<td><?php echo esc_html(PHP_SAPI); ?></td>
</tr>
<tr>
<td><?php esc_html_e("User", 'duplicator'); ?></td>
<td><?php echo DUP_Util::getCurrentUser(); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Process", 'duplicator'); ?></td>
<td><?php echo esc_html(DUP_Util::getProcessOwner()); ?></td>
</tr>
<tr>
<td><a href="http://php.net/manual/en/features.safe-mode.php" target="_blank"><?php esc_html_e("Safe Mode", 'duplicator'); ?></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 )))
? esc_html__('On', 'duplicator') : esc_html__('Off', 'duplicator');
?>
</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'); ?></a></td>
<td><?php echo @ini_get('memory_limit') ?></td>
</tr>
<tr>
<td><?php esc_html_e("Memory In Use", 'duplicator'); ?></td>
<td><?php echo 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'); ?></a></td>
<td>
<?php
echo @ini_get('max_execution_time');
$try_update = set_time_limit(0);
$try_update = $try_update ? 'is dynamic' : 'value is fixed';
echo " (default) - {$try_update}";
?>
<i class="fa fa-question-circle data-size-help"
data-tooltip-title="<?php esc_attr_e("Max Execution Time", 'duplicator'); ?>"
data-tooltip="<?php esc_attr_e('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'); ?>"></i>
</td>
</tr>
<tr>
<td><a href="http://us3.php.net/shell_exec" target="_blank"><?php esc_html_e("Shell Exec", 'duplicator'); ?></a></td>
<td><?php echo (DUP_Util::hasShellExec()) ? esc_html__("Is Supported", 'duplicator') : esc_html__("Not Supported", 'duplicator'); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Shell Exec Zip", 'duplicator'); ?></td>
<td><?php echo (DUP_Util::getZipPath() != null) ? esc_html__("Is Supported", 'duplicator') : esc_html__("Not Supported", 'duplicator'); ?></td>
</tr>
<tr>
<td><a href="https://suhosin.org/stories/index.html" target="_blank"><?php esc_html_e("Suhosin Extension", 'duplicator'); ?></a></td>
<td><?php echo extension_loaded('suhosin') ? esc_html__("Enabled", 'duplicator') : esc_html__("Disabled", 'duplicator'); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Architecture ", 'duplicator'); ?></td>
<td>
<?php echo DUP_Util::getArchitectureString(); ?>
</td>
</tr>
<tr>
<td><?php esc_html_e("Error Log File ", 'duplicator'); ?></td>
<td><?php echo esc_html($error_log_path); ?></td>
</tr>
<tr>
<td class='dup-settings-diag-header' colspan="2">MySQL</td>
</tr>
<tr>
<td><?php esc_html_e("Version", 'duplicator'); ?></td>
<td><?php echo esc_html(DUP_DB::getVersion()); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Comments", 'duplicator'); ?></td>
<td><?php echo esc_html(DUP_DB::getVariable('version_comment')); ?></td>
</tr>
<tr>
<td><?php esc_html_e("Charset", 'duplicator'); ?></td>
<td><?php echo defined('DB_CHARSET') ? DB_CHARSET : 'DB_CHARSET not set' ; ?></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'); ?></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'); ?></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'); ?></a></td>
<td><?php echo esc_html($mysqlDumpSupport); ?></td>
</tr>
<tr>
<td class='dup-settings-diag-header' colspan="2"><?php esc_html_e("Server Disk", 'duplicator'); ?></td>
</tr>
<tr valign="top">
<td><?php esc_html_e('Free space', 'duplicator'); ?></td>
<td>
<?php if ($space == null || $space_free == null) : ?>
<?php esc_html_e("Unable to calculate space on this server.", 'duplicator'); ?>
<br/><br/>
<?php else : ?>
<?php echo esc_html($perc);?>% -- <?php echo esc_html(DUP_Util::byteSize($space_free));?>
from <?php echo esc_html(DUP_Util::byteSize($space));?><br/>
<small>
<?php esc_html_e("Note: This value is the physical servers hard-drive allocation.", 'duplicator'); ?> <br/>
<?php esc_html_e("On shared hosts check your control panel for the 'TRUE' disk space quota value.", 'duplicator'); ?>
</small>
<?php endif; ?>
</td>
</tr>
</table><br/>
</div> <!-- end .dup-box-panel -->
</div> <!-- end .dup-box -->
<br/>

View File

@@ -0,0 +1,161 @@
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
$action = isset($_POST['action']) ? sanitize_text_field($_POST['action']) : '';
$scan_run = ($action == 'duplicator_recursion') ? true : false;
$ajax_nonce = wp_create_nonce('DUP_CTRL_Tools_runScanValidator');
?>
<style>
div#hb-result {padding: 10px 5px 0 5px; line-height:20px; font-size: 12px}
</style>
<!-- ==========================================
THICK-BOX DIALOGS: -->
<?php
$confirm1 = new DUP_UI_Dialog();
$confirm1->title = __('Run Validator', 'duplicator');
$confirm1->message = __('This will run the scan validation check. This may take several minutes. Do you want to Continue?', 'duplicator');
$confirm1->progressOn = false;
$confirm1->jscallback = 'Duplicator.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'); ?>
<div class="dup-box-arrow"></div>
</div>
<div class="dup-box-panel" style="display: <?php echo $scan_run ? 'block' : '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");
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");
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");
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");
?>
<br/><br/>
<button id="scan-run-btn" type="button" class="button button-large button-primary" onclick="Duplicator.Tools.ConfirmScanValidator()">
<?php esc_html_e("Run Scan Integrity Validation", "duplicator"); ?>
</button>
<script id="hb-template" type="text/x-handlebars-template">
<b>Scan Path:</b> <?php echo esc_html(duplicator_get_abs_path()); ?> <br/>
<b>Scan Results</b><br/>
<table>
<tr>
<td><b>Files:</b></td>
<td>{{payload.fileCount}} </td>
<td> &nbsp; </td>
<td><b>Dirs:</b></td>
<td>{{payload.dirCount}} </td>
</tr>
</table>
<br/>
<b>Unreadable Dirs/Files:</b> <br/>
{{#if payload.unreadable}}
{{#each payload.unreadable}}
&nbsp; &nbsp; {{@index}} : {{this}}<br/>
{{/each}}
{{else}}
<i>No Unreadable items found</i> <br/>
{{/if}}
<br/>
<b>Symbolic Links:</b> <br/>
{{#if payload.symLinks}}
{{#each payload.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"); ?></small> <br/>
{{/if}}
<br/>
<b>Directory Name Checks:</b> <br/>
{{#if payload.nameTestDirs}}
{{#each payload.nameTestDirs}}
&nbsp; &nbsp; {{@index}} : {{this}}<br/>
{{/each}}
{{else}}
<i>No name check warnings located for directory paths</i> <br/>
{{/if}}
<br/>
<b>File Name Checks:</b> <br/>
{{#if payload.nameTestFiles}}
{{#each payload.nameTestFiles}}
&nbsp; &nbsp; {{@index}} : {{this}}<br/>
{{/each}}
{{else}}
<i>No name check warnings located for directory paths</i> <br/>
{{/if}}
<br/>
</script>
<div id="hb-result"></div>
</div>
</div>
<br/>
<script>
jQuery(document).ready(function($)
{
Duplicator.Tools.ConfirmScanValidator = function()
{
<?php $confirm1->showConfirm(); ?>
}
//Run request to: admin-ajax.php?action=DUP_CTRL_Tools_runScanValidator
Duplicator.Tools.runScanValidator = function()
{
tb_remove();
var data = {
action : 'DUP_CTRL_Tools_runScanValidator',
nonce: '<?php echo esc_js($ajax_nonce); ?>',
recursive_scan: 1
};
$('#hb-result').html('<?php esc_html_e("Scanning Environment... This may take a few minutes.", "duplicator"); ?>');
$('#scan-run-btn').html('<i class="fas fa-circle-notch fa-spin fa-fw"></i> Running Please Wait...');
$.ajax({
type: "POST",
dataType: "text",
url: ajaxurl,
data: data,
success: function(respData) {
try {
var data = Duplicator.parseJSON(respData);
} catch(err) {
console.error(err);
console.error('JSON parse failed for response data: ' + respData);
console.log(respData);
return false;
}
Duplicator.Tools.IntScanValidator(data);
},
error: function(data) {console.log(data)},
done: function(data) {console.log(data)}
});
}
//Process Ajax Template
Duplicator.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"); ?>');
}
});
</script>

View File

@@ -0,0 +1,87 @@
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
wp_enqueue_script('dup-handlebars');
require_once(DUPLICATOR_PLUGIN_PATH . '/classes/utilities/class.u.scancheck.php');
require_once(DUPLICATOR_PLUGIN_PATH . '/classes/class.io.php');
$installer_files = DUP_Server::getInstallerFiles();
$package_name = (isset($_GET['package'])) ? esc_html($_GET['package']) : '';
$abs_path = duplicator_get_abs_path();
// For auto detect archive file name logic
if (empty($package_name)) {
$installer_file_path = $abs_path . '/' . 'installer.php';
if (file_exists($installer_file_path)) {
$installer_file_data = file_get_contents($installer_file_path);
if (preg_match("/const ARCHIVE_FILENAME = '(.*?)';/", $installer_file_data, $match)) {
$temp_archive_file = esc_html($match[1]);
$temp_archive_file_path = $abs_path . '/' . $temp_archive_file;
if (file_exists($temp_archive_file_path)) {
$package_name = $temp_archive_file;
}
}
}
}
$package_path = empty($package_name) ? '' : $abs_path . '/' . $package_name;
$txt_found = __('File Found: Unable to remove', 'duplicator');
$txt_removed = __('Removed', 'duplicator');
$nonce = wp_create_nonce('duplicator_cleanup_page');
$section = (isset($_GET['section'])) ? $_GET['section'] : '';
if ($section == "info" || $section == '') {
$_GET['action'] = isset($_GET['action']) ? $_GET['action'] : '';
switch ($_GET['action']) {
case 'tmp-cache':
if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'duplicator_cleanup_page')) {
exit; // Get out of here bad nounce!
}
DUP_Package::tempFileCleanup(true);
?>
<div id="message" class="notice notice-success is-dismissible dup-wpnotice-box">
<p><b><?php _e('Build cache removed.', 'duplicator'); ?></b></p>
</div>
<?php
break;
}
}
$remove_response = '';
if (isset($_POST['remove-options'])) {
if (!isset($_POST['_wpnonce']) || !wp_verify_nonce($_POST['_wpnonce'], 'duplicator_settings_page')) {
wp_die(__('Security check failed.', 'duplicator'));
}
$remove_options = sanitize_text_field($_POST['remove-options']);
$action_result = DUP_Settings::DeleteWPOption($remove_options);
switch ($remove_options) {
case 'duplicator_settings':
$remove_response = __('Plugin settings reset.', 'duplicator');
break;
case 'duplicator_ui_view_state':
$remove_response = __('View state settings reset.', 'duplicator');
break;
case 'duplicator_package_active':
$remove_response = __('Active package settings reset.', 'duplicator');
break;
}
}
?>
<form id="dup-settings-form" action="<?php echo admin_url('admin.php?page=duplicator-tools&tab=diagnostics&section=info'); ?>" method="post">
<?php wp_nonce_field('duplicator_settings_page', '_wpnonce', false); ?>
<input type="hidden" id="dup-remove-options-value" name="remove-options" value="">
<?php
if (! empty($remove_response)) {
echo "<div id='message' class='notice notice-success is-dismissible dup-wpnotice-box'><p>" . esc_html($remove_response) . "</p></div>";
}
include_once 'inc.data.php';
include_once 'inc.settings.php';
include_once 'inc.validator.php';
include_once 'inc.phpinfo.php';
?>
</form>

View File

@@ -0,0 +1,241 @@
<?php
use Duplicator\Installer\Utils\LinkManager;
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
require_once(DUPLICATOR_PLUGIN_PATH . '/assets/js/javascript.php');
require_once(DUPLICATOR_PLUGIN_PATH . '/views/inc.header.php');
function _duplicatorSortFiles($a, $b)
{
return filemtime($b) - filemtime($a);
}
$logs = glob(DUP_Settings::getSsdirPath() . '/*.log') ;
if ($logs != false && count($logs)) {
usort($logs, '_duplicatorSortFiles');
@chmod(DUP_Util::safePath($logs[0]), 0644);
}
$logname = (isset($_GET['logname'])) ? trim(sanitize_text_field($_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 (!empty($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]) : "";
}
$logurl = DUP_Settings::getSsdirUrl() . '/' . $logname;
$logfound = (strlen($logname) > 0) ? true : false;
?>
<style>
div#dup-refresh-count {display: inline-block}
table#dup-log-panels {width:100%; }
td#dup-log-panel-left {width:75%;}
td#dup-log-panel-left div.name {float:left; margin: 0px 0px 5px 5px;}
td#dup-log-panel-left div.opts {float:right;}
td#dup-log-panel-right {vertical-align: top; padding-left:15px; max-width: 375px}
#dup-log-content {
padding:5px;
background: #fff;
min-height:500px;
width: calc(100vw - 630px);;
border:1px solid silver;
overflow:scroll;
word-wrap: break-word;
margin:0;
line-height: 2;
}
/* OPTIONS */
div.dup-log-hdr {font-weight: bold; font-size:16px; padding:2px; }
div.dup-log-hdr small{font-weight:normal; font-style: italic}
div.dup-log-file-list {font-family:monospace;}
div.dup-log-file-list a, span.dup-log{display: inline-block; white-space: nowrap; text-overflow: ellipsis; max-width: 375px; overflow:hidden}
div.dup-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;}
</style>
<script>
jQuery(document).ready(function($)
{
Duplicator.Tools.FullLog = function() {
var $panelL = $('#dup-log-panel-left');
var $panelR = $('#dup-log-panel-right');
if ($panelR.is(":visible") ) {
$panelR.hide(400);
$panelL.css({width: '100%'});
} else {
$panelR.show(200);
$panelL.css({width: '75%'});
}
}
Duplicator.Tools.Refresh = function() {
$('#refresh').val(1);
$('#dup-form-logs').submit();
}
Duplicator.Tools.RefreshAuto = function() {
if ( $("#dup-auto-refresh").is(":checked")) {
$('#auto').val(1);
startTimer();
} else {
$('#auto').val(0);
}
}
Duplicator.Tools.GetLog = function(log) {
window.location = log;
}
Duplicator.Tools.WinResize = function() {
var height = $(window).height() - 225;
$("#dup-log-content").css({height: height + 'px'});
}
Duplicator.Tools.readLogfile = function() {
$.get(<?php echo str_replace('\\/', '/', json_encode($logurl)); ?>, function(data) {
$('#dup-log-content').text(data);
}, 'text');
};
var duration = 10;
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;
Duplicator.Tools.Refresh();
}
}
function startTimer() {
timerInterval = setInterval(timer, 1000);
}
//INIT Events
$(window).resize(Duplicator.Tools.WinResize);
$('#dup-options').click(Duplicator.Tools.FullLog);
$("#dup-refresh").click(Duplicator.Tools.Refresh);
$("#dup-auto-refresh").click(Duplicator.Tools.RefreshAuto);
$("#dup-refresh-count").html(duration.toString());
// READ LOG FILE
Duplicator.Tools.readLogfile();
//INIT
Duplicator.Tools.WinResize();
<?php if ($refresh) : ?>
//Scroll to Bottom
$("#dup-log-content").load(function () {
var $contents = $('#dup-log-content').contents();
$contents.scrollTop($contents.height());
});
<?php if ($auto) : ?>
$("#dup-auto-refresh").prop('checked', true);
Duplicator.Tools.RefreshAuto();
<?php endif; ?>
<?php endif; ?>
});
</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') ?>.</h2>
<?php esc_html_e("Try to create a package, since no log files were found in the snapshots directory with the extension *.log", 'duplicator') ?>.<br/><br/>
<?php esc_html_e("Reasons for log file not showing", 'duplicator') ?>: <br/>
- <?php esc_html_e("The web server does not support returning .log file extentions", 'duplicator') ?>. <br/>
- <?php esc_html_e("The snapshots directory does not have the correct permissions to write files. Try setting the permissions to 755", 'duplicator') ?>. <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') ?>. <br/>
</div>
<?php else : ?>
<table id="dup-log-panels">
<tr>
<td id="dup-log-panel-left">
<div class="name">
<i class='fas fa-file-contract fa-fw'></i> <b><?php echo basename($logurl); ?></b> &nbsp; | &nbsp;
<i style="cursor: pointer"
data-tooltip-title="<?php esc_attr_e("Host Recommendation:", 'duplicator'); ?>"
data-tooltip="<?php esc_attr_e('Duplicator recommends going with the high performance pro plan or better from our recommended list', 'duplicator'); ?>">
<i class="far fa-lightbulb" aria-hidden="true"></i>
<?php
$faqUrl = esc_url(LinkManager::getDocUrl('what-host-providers-are-recommended-for-duplicator', 'tools-logging'));
printf(
_x(
'Consider our recommended %1$shost list%2$s if youre unhappy with your current provider',
'%1$s and %2$s are <a> tags',
'duplicator'
),
'<a target="_blank" href="' . $faqUrl . '">',
'</a>'
);
?>
</i>
</div>
<div class="opts"><a href="javascript:void(0)" id="dup-options"><?php esc_html_e("Options", 'duplicator') ?> <i class="fa fa-angle-double-right"></i></a> &nbsp;</div>
<br style="clear:both" />
<pre id="dup-log-content"></pre>
</td>
<td id="dup-log-panel-right">
<h2><?php esc_html_e("Options", 'duplicator') ?> </h2>
<div class="dup-opts-items">
<input type="button" class="button button-small" id="dup-refresh" value="<?php esc_attr_e("Refresh", 'duplicator') ?>" /> &nbsp;
<input type='checkbox' id="dup-auto-refresh" style="margin-top:1px" />
<label id="dup-auto-refresh-lbl" for="dup-auto-refresh">
<?php esc_attr_e("Auto Refresh", 'duplicator') ?>
[<div id="dup-refresh-count"></div>]
</label>
</div>
<div class="dup-log-hdr">
<?php esc_html_e("Package Logs", 'duplicator') ?>
<small><?php esc_html_e("Top 20", 'duplicator') ?></small>
</div>
<div class="dup-log-file-list">
<?php
$count = 0;
$active = basename($logurl);
foreach ($logs as $log) {
$time = date('m/d/y h:i:s', filemtime($log));
$name = basename($log);
$url = '?page=duplicator-tools&tab=diagnostics&section=log&logname=' . esc_html($name);
echo ($active == $name)
? "<span class='dup-log' title='" . esc_attr($name) . "'>" . esc_html($time) . "-" . esc_html($name) . "</span>"
: "<a href='javascript:void(0)' title='" . esc_attr($name) . "' onclick='Duplicator.Tools.GetLog(\"" . esc_js($url) . "\")'>" . esc_html($time) . "-" . esc_html($name) . "</a>";
if ($count > 20) {
break;
}
}
?>
</div>
</td>
</tr>
</table>
<?php endif; ?>
</form>

View File

@@ -0,0 +1,80 @@
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
?>
<style>
div.success {color:#4A8254}
div.failed {color:red}
table.dup-reset-opts td:first-child {font-weight: bold}
table.dup-reset-opts td {padding:10px}
button.dup-fixed-btn {min-width: 150px; text-align: center}
div#dup-tools-delete-moreinfo {display: none; padding: 5px 0 0 20px; border:1px solid silver; background-color: #fff; border-radius:3px; padding:10px; margin:5px; width:750px }
div.dup-alert-no-files-msg {padding:10px 0 10px 0}
div.dup-alert-secure-note {font-style: italic; max-width:800px; padding:15px 0 20px 0}
div#message {margin:0px 0px 10px 0px}
div#dup-server-info-area { padding:10px 5px; }
div#dup-server-info-area 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#dup-server-info-area td, th {padding:3px; background:#fff; -webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;}
div#dup-server-info-area tr.h img { display:none; }
div#dup-server-info-area tr.h td{ background:none; }
div#dup-server-info-area tr.h th{ text-align:center; background-color:#efefef; }
div#dup-server-info-area td.e{ font-weight:bold }
td.dup-settings-diag-header {background-color:#D8D8D8; font-weight: bold; border-style: none; color:black}
.widefat th {font-weight:bold; }
.widefat td {padding:2px 2px 2px 8px}
.widefat td:nth-child(1) {width:10px;}
.widefat td:nth-child(2) {padding-left: 20px; width:100% !important}
textarea.dup-opts-read {width:100%; height:40px; font-size:12px}
div.lite-sub-tabs {padding: 10px 0 10px 0; font-size: 14px}
</style>
<?php
$action_response = null;
$ctrl_ui = new DUP_CTRL_UI();
$ctrl_ui->setResponseType('PHP');
$data = $ctrl_ui->GetViewStateList();
$ui_css_srv_panel = (isset($data->payload['dup-settings-diag-srv-panel']) && $data->payload['dup-settings-diag-srv-panel']) ? 'display:block' : 'display:none';
$ui_css_opts_panel = (isset($data->payload['dup-settings-diag-opts-panel']) && $data->payload['dup-settings-diag-opts-panel']) ? 'display:block' : 'display:none';
$section = isset($_GET['section']) ? $_GET['section'] : 'info';
$txt_diagnostic = __('Information', 'duplicator');
$txt_log = __('Logs', 'duplicator');
$txt_support = __('Support', 'duplicator');
;
$tools_url = 'admin.php?page=duplicator-tools&tab=diagnostics';
switch ($section) {
case 'info':
echo "<div class='lite-sub-tabs'><b>" .
esc_html($txt_diagnostic) .
"</b> &nbsp;|&nbsp; <a href='" . esc_url($tools_url . "&section=log") . "'>" .
esc_html($txt_log) . "</a> &nbsp;|&nbsp; <a href='" .
esc_url($tools_url . "&section=support") . "'>" .
esc_html($txt_support) . "</a></div>";
include(dirname(__FILE__) . '/information.php');
break;
case 'log':
echo "<div class='lite-sub-tabs'><a href='" .
esc_url($tools_url . "&section=info") . "'>" .
esc_html($txt_diagnostic) . "</a> &nbsp;|&nbsp;<b>" .
esc_html($txt_log) . "</b> &nbsp;|&nbsp; <a href='" .
esc_url($tools_url . "&section=support") . "'>" .
esc_html($txt_support) . "</a></div>";
include(dirname(__FILE__) . '/logging.php');
break;
case 'support':
echo "<div class='lite-sub-tabs'><a href='" .
esc_url($tools_url . "&section=info") . "'>" .
esc_html($txt_diagnostic) . "</a> &nbsp;|&nbsp; <a href='" .
esc_url($tools_url . "&section=log") . "'>" .
esc_html($txt_log) . "</a> &nbsp;|&nbsp; <b>" .
esc_html($txt_support) . "</b> </div>";
include(dirname(__FILE__) . '/support.php');
break;
}
?>

View File

@@ -0,0 +1,108 @@
<?php
use Duplicator\Installer\Utils\LinkManager;
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
?>
<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:180px; 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; text-align:center}
</style>
<div class="wrap dup-wrap dup-support-all">
<div style="width:800px; margin:auto; margin-top: 20px">
<table>
<tr>
<td style="width:70px"><i class="fa fa-question-circle fa-5x"></i></td>
<td valign="top" style="padding-top:10px; font-size:13px">
<?php
esc_html_e(
"Migrating WordPress is a complex process and the logic to make all the magic happen smoothly may not work quickly with every site. " .
" With over 30,000 plugins and a very complex server eco-system some migrations may run into issues. This is why the Duplicator includes a detailed knowledgebase that can help with many common issues. " .
" Resources to additional support, approved hosting, and alternatives to fit your needs can be found below.",
'duplicator'
);
?>
</td>
</tr>
</table>
<br/><br/>
<!-- 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') ?></div>
</div>
<div class="dup-support-hlp-txt">
<?php esc_html_e('Complete Online Documentation', 'duplicator'); ?>
<br/>
<select id="dup-support-kb-lnks" style="margin-top:18px; font-size:16px; min-width: 170px">
<option disabled selected>
<?php esc_html_e('Choose A Section', 'duplicator') ?>
</option>
<option
value="<?php echo esc_url(LinkManager::getCategoryUrl(LinkManager::QUICK_START_CAT, 'tools_support', 'Quick Start')); ?>
">
<?php esc_html_e('Quick Start', 'duplicator') ?>
</option>
<option value="<?php echo esc_url(LinkManager::getDocUrl('', 'tools_support', 'User Guide')); ?>">
<?php esc_html_e('User Guide', 'duplicator'); ?>
</option>
<option
value="<?php echo esc_url(LinkManager::getCategoryUrl(LinkManager::TROUBLESHOOTING_CAT, 'tools_support', 'FAQs')); ?>
">
<?php esc_html_e('FAQs', 'duplicator'); ?>
</option>
<option value="<?php echo esc_url(LinkManager::getDocUrl('changelog', 'tools_support', 'Change Log')); ?>">
<?php esc_html_e('Change Log', 'duplicator') ?>
</option>
</select>
</div>
</div>
<!-- ONLINE SUPPORT -->
<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('Premium Support', 'duplicator') ?></div>
</div>
<div class="dup-support-hlp-txt">
<?php esc_html_e("Having a problem with your back up or migrations? Upgrade to get our Premium Support.", 'duplicator'); ?>
<br/>
<div class="dup-support-txts-links" style="margin:10px 0 10px 0">
<a href="<?php echo esc_url(\Duplicator\Utils\Upsell::getCampaignUrl('duplicator_tools-support_tab', 'Upgrade Now')); ?>" target="_blank" class="dup-btn dup-btn-md dup-btn-green" >
<?php esc_html_e('Upgrade Now', 'duplicator') ?>
</a> <br/>
</div>
<small>Free Users <a href="https://wordpress.org/support/plugin/duplicator/" target="_blank">Support Forum</a></small>
</div>
</div>
</div>
</div>
<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>