first commit

This commit is contained in:
Roman Pyrih
2026-04-03 10:22:35 +02:00
commit 5de35e358d
8424 changed files with 2907254 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>