first commit

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

View File

@@ -0,0 +1,317 @@
<?php
/**
* Duplicator Backup row in table Backups list
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
use Duplicator\Controllers\RecoveryController;
use Duplicator\Controllers\StoragePageController;
use Duplicator\Core\Controllers\ControllersManager;
use Duplicator\Core\Views\TplMng;
use Duplicator\Package\Create\BuildComponents;
use Duplicator\Package\Recovery\RecoveryStatus;
use Duplicator\Views\ViewHelper;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var ControllersManager $ctrlMng
* @var TplMng $tplMng
* @var array<string, mixed> $tplData
* @var RecoveryStatus $recoverStatus
*/
$recoverStatus = $tplData['recoverStatus'];
$filteredData = $recoverStatus->getFilteredData();
$activeType = $recoverStatus->getType();
$activeLabel = strtolower($recoverStatus->getTypeLabel());
$isLocalStorageSafe = $recoverStatus->isLocalStorageEnabled();
$isWordPressCoreSafe = $recoverStatus->isWordPressCoreComplete();
$isDatabaseSafe = $recoverStatus->isDatabaseComplete();
$isMultisiteComplete = $recoverStatus->isMultisiteComplete();
$editDefaultStorageURL = StoragePageController::getEditDefaultUrl();
//echo '<pre>';var_export($isWordPressCoreSafe); echo '</pre>';
//echo '<pre>';var_export($recoverStatus->activeTemplate); echo '</pre>';
/**
* @var wpdb $wpdb
*/
global $wpdb;
?>
<div class="dup-recover-dlg-notice-box">
<div class="title-area">
<div class="title">
<?php esc_html_e("REQUIREMENTS", 'duplicator-pro'); ?>:
</div>
</div>
<!-- ===============
LOCAL SERVER STORAGE -->
<div class="req-data">
<?php
if ($activeType == $recoverStatus::TYPE_TEMPLATE) {
echo '<i class="far fa-question-circle fa-fw pass"></i>';
} else {
echo $isLocalStorageSafe
? '<i class="far fa-check-circle fa-fw pass"></i>'
: '<i class="far fa-times-circle fa-fw fail"></i>';
}
?>
<a class="req-title" href="javascript:void(0)" onclick="jQuery(this).parent().children('div.req-info').toggle();">
<?php esc_html_e("Local Server Storage", 'duplicator-pro'); ?>
</a>
<div class="req-info">
<i class="fas fa-server fa-fw fa-lg"></i>
<?php esc_html_e("Recovery points require one of the following 'Local Server' storage types:", 'duplicator-pro'); ?>
<ul class="req-info-list">
<li>
<?php
echo sprintf(
"<i class='far fa-hdd fa-fw'></i><sup>"
. wp_kses(ViewHelper::disasterIcon(false), ['i' => ['class' => []]])
. "</sup>&nbsp; "
. "<b><a href='" . esc_url($editDefaultStorageURL) . "' target='_blank'>%s</a></b> %s",
esc_html__('[Local Default]', 'duplicator-pro'),
esc_html__('This is the default built-in local storage type.', 'duplicator-pro')
);
?>
</li>
<li>
<?php
echo sprintf(
"<i class='fas fa-hdd'></i><sup>"
. wp_kses(ViewHelper::disasterIcon(false), ['i' => ['class' => []]])
. "</sup>&nbsp; <b>%s</b> %s",
esc_html__('[Local Non-Default]', 'duplicator-pro'),
esc_html__('This is a custom directory on this server.', 'duplicator-pro')
);
?>
</li>
</ul>
<div class="req-status">
<b><?php esc_html_e("STATUS", 'duplicator-pro'); ?>:</b><br/>
<?php
if ($activeType == $recoverStatus::TYPE_TEMPLATE) {
esc_html_e(
"Templates do not control storage locations, only schedules and new backup creation control this process.",
'duplicator-pro'
);
echo ' ';
esc_html_e('No changes can be made to affect this test.', 'duplicator-pro');
} elseif ($isLocalStorageSafe) {
echo '<span class="darkgreen">';
echo esc_html__("At least one local server storage is associated with this ", 'duplicator-pro') . esc_html($activeLabel) . '.';
echo '</span>';
} else {
echo '<span class="maroon">';
echo esc_html__("No local server storage found for this ", 'duplicator-pro') . esc_html($activeLabel) . '.';
echo '</span>';
}
?>
</div>
</div>
</div>
<!-- ===============
WordPress CORE -->
<div class="req-data">
<?php
echo $isWordPressCoreSafe
? '<i class="far fa-check-circle fa-fw pass"></i>'
: '<i class="far fa-times-circle fa-fw fail"></i>';
?>
<a class="req-title" href="javascript:void(0)" onclick="jQuery(this).parent().children('div.req-info').toggle();">
<?php esc_html_e("WordPress Core Folders", 'duplicator-pro'); ?>
</a>
<div class="req-info">
<i class="fab fa-wordpress-simple fa-fw fa-lg"></i>
<?php esc_html_e(
"A recovery point needs all WordPress core folders included in the backup (wp-admin, wp-content &amp; wp-includes).",
'duplicator-pro'
); ?>
<div class="req-status">
<b><?php esc_html_e("STATUS", 'duplicator-pro'); ?>:</b><br/>
<?php if (($filteredData['dbonly'])) : ?>
<span class="maroon">
<?php esc_html_e(
"Backup is setup as a database only configuration, the core WordPress folders have been excluded automatically.",
'duplicator-pro'
); ?>
</span>
<?php elseif (count($filteredData['filterDirs']) > 0) : ?>
<span class="maroon">
<?php esc_html_e("Filtered out WordPress core folders.", 'duplicator-pro'); ?>
<?php foreach ($filteredData['filterDirs'] as $path) { ?>
<small class="req-paths-data"><?php echo esc_html($path); ?></small>
<?php } ?>
</span>
<?php else : ?>
<span class="darkgreen">
<?php esc_html_e("No WordPress core folder filters set", 'duplicator-pro'); ?>.
</span>
<?php endif; ?>
</div>
</div>
</div>
<?php if (is_multisite()) { ?>
<!-- ===============
Multisite complete-->
<div class="req-data">
<?php
echo $isMultisiteComplete
? '<i class="far fa-check-circle fa-fw pass"></i>'
: '<i class="far fa-times-circle fa-fw fail"></i>';
?>
<a class="req-title" href="javascript:void(0)" onclick="jQuery(this).parent().children('div.req-info').toggle();">
<?php esc_html_e("Multisite", 'duplicator-pro'); ?>
</a>
<div class="req-info">
<?php esc_html_e(
'Some subsites are filterd.',
'duplicator-pro'
); ?>
</div>
</div>
<?php } ?>
<!-- ===============
DATABASE TABLES -->
<div class="req-data">
<?php
echo $isDatabaseSafe
? '<i class="far fa-check-circle fa-fw pass"></i>'
: '<i class="far fa-times-circle fa-fw fail"></i>';
?>
<a class="req-title" href="javascript:void(0)" onclick="jQuery(this).parent().children('div.req-info').toggle();">
<?php esc_html_e("Primary Database Tables", 'duplicator-pro'); ?>
</a>
<div class="req-info">
<i class="fas fa-database fa-fw fa-lg"></i>
<?php
printf(
esc_html_x(
'All database tables with the prefix %1$s must be included in the %2$s for this to be an eligible recovery point.',
'%1$s representes the database prefix and %2$s is one of the following: backup, schedule or template',
'duplicator-pro'
),
'<i>' . esc_html($wpdb->prefix) . '</i>',
esc_html($activeLabel)
);
?>
<div class="req-status">
<b><?php esc_html_e("STATUS", 'duplicator-pro'); ?>:</b><br/>
<?php if (count($filteredData['filterTables']) > 0) : ?>
<?php esc_html_e("Filtered table list", 'duplicator-pro'); ?>:
<?php
foreach ($filteredData['filterTables'] as $table) {
if (strpos($table, $wpdb->prefix) !== false) {
echo '<small class="req-paths-data maroon">' . esc_html($table) . '</small>';
} else {
echo '<small class="req-paths-data darkgreen">' . esc_html($table) . '</small>';
}
}
?>
<?php else : ?>
<span class="darkgreen">
<?php esc_html_e("No table filters set on this backup.", 'duplicator-pro'); ?>
</span>
<?php endif; ?>
</div>
</div>
</div>
<!-- ===============
PACKAGE COMPONENTS-->
<div class="req-data">
<?php if ($recoverStatus->hasRequiredComponents()) { ?>
<i class="far fa-check-circle fa-fw pass"></i>
<?php } else { ?>
<i class="far fa-times-circle fa-fw fail"></i>
<?php } ?>
<a class="req-title" href="javascript:void(0)" onclick="jQuery(this).parent().children('div.req-info').toggle();">
<?php esc_html_e("Backup Components", 'duplicator-pro'); ?>
</a>
<div class="req-info">
<b><?php esc_html_e('Required components:', 'duplicator-pro'); ?>:</b>
<ul class="dup-recovery-package-components-required">
<?php foreach (RecoveryStatus::COMPONENTS_REQUIRED as $component) { ?>
<li>
<span class="label"><?php echo esc_html(BuildComponents::getLabel($component)); ?></span>
<span class="value">
<?php if ($recoverStatus->hasComponent($component)) { ?>
<i class="fas fa-check-circle green"></i> <?php esc_html_e('included', 'duplicator-pro'); ?>
<?php } else { ?>
<i class="fas fa-times-circle maroon"></i> <?php esc_html_e('excluded', 'duplicator-pro'); ?>
<?php } ?>
</span>
</li>
<?php } ?>
</ul>
</div>
</div><br/>
<div class="title-area">
<div class="title">
<?php esc_html_e("NOTES", 'duplicator-pro'); ?>:
</div>
</div>
<div class="req-notes">
<?php
switch ($recoverStatus->getType()) {
case $recoverStatus::TYPE_PACKAGE:
esc_html_e(
'To create a recovery-point enabled backup change the conditions of the backup build or template to meet the requirements listed above.',
'duplicator-pro'
);
echo ' ';
printf(
esc_html_x(
'Then use either the %1$sRecovery Point%2$s tool or the Recovery Point button to set which backup you would like as the active recovery-point.', // phpcs:ignore Generic.Files.LineLength
'%1$s and %2$s represents the opening and closing HTML tags for an anchor or link',
'duplicator-pro'
),
'<a href="' . esc_url(RecoveryController::getRecoverPageLink()) . '" target="_blank" >',
'</a>'
);
break;
case $recoverStatus::TYPE_SCHEDULE:
esc_html_e(
'To change the recovery status visit the template link above and make sure that it passes the recovery status test.',
'duplicator-pro'
);
esc_html_e(
'If the local storage test does not pass check the schedule storage types and make sure the local server storage type is selected.',
'duplicator-pro'
);
esc_html_e(
'These steps are optional and only required if you want to enable this schedule as an active recovery point.',
'duplicator-pro'
);
break;
case $recoverStatus::TYPE_TEMPLATE:
esc_html_e(
'To change a template recovery point status to enabled, edit the template and make sure that it passes the recovery status test.',
'duplicator-pro'
);
break;
}
?>
</div>
</div>

View File

@@ -0,0 +1,48 @@
<?php
/**
* Duplicator Backup row in table Backups list
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
use Duplicator\Package\Recovery\RecoveryPackage;
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
* @var RecoveryPackage $recoverPackage
*/
$recoverPackage = $tplData['recoverPackage'];
?><!DOCTYPE html>
<html lang="en-US" >
<head>
<title><?php esc_html_e('Recovery Backup Launcher', 'duplicator-pro'); ?></title>
</head>
<body>
<h2><?php printf(esc_html__('Recovery Backup Launcher created on %s', 'duplicator-pro'), esc_html($recoverPackage->getCreated())); ?></h2>
<p>
<?php
printf(
esc_html_x(
'If the installer does not start automatically, you can click on this %1$slink and start it manually%2$s.',
'%1$s and %2$s represent the opening and closing link tags (<a> and </a>)',
'duplicator-pro'
),
'<a href="' . esc_url($recoverPackage->getInstallLink()) . '">',
'</a>'
);
?>
</p>
<script>
window.location.href = <?php echo json_encode($recoverPackage->getInstallLink()); ?>;
</script>
</body>
</html>

View File

@@ -0,0 +1,39 @@
<?php
/**
* Duplicator Backup row in table Backups list
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined("ABSPATH") or die("");
/**
* Variables
*
* @var \Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var \Duplicator\Core\Views\TplMng $tplMng
* @var array<string, mixed> $tplData
* @var \Duplicator\Package\DupPackage $package
*/
$package = $tplData['package'];
$timeDiff = sprintf(
_x('%s ago', '%s represents the time diff, eg. 2 days', 'duplicator-pro'),
$package->getPackageLife('human')
);
?>
<table>
<tr>
<td><b><?php esc_html_e('Backup', 'duplicator-pro'); ?>:</b></td>
<td><?php echo esc_html($package->getName()); ?></td>
</tr>
<tr>
<td><b><?php esc_html_e('Created', 'duplicator-pro'); ?>:</b>&nbsp; </td>
<td>
<?php echo esc_html($package->getCreated()); ?>&nbsp;-&nbsp;<i><?php echo esc_html($timeDiff); ?></i>
</td>
</tr>
</table>

View File

@@ -0,0 +1,98 @@
<?php
/**
*
* @package Duplicator
* @copyright (c) 2022, Snap Creek LLC
*/
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
use Duplicator\Models\ScheduleEntity;
use Duplicator\Models\TemplateEntity;
use Duplicator\Package\Recovery\RecoveryStatus;
use Duplicator\Views\UI\UiDialog;
use Duplicator\Views\ViewHelper;
/**
* Variables
*
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
* @var Duplicator\Core\Views\TplMng $tplMng
*/
$isList = $tplMng->getDataValueBool('isList');
$template = $tplMng->getDataValueObj('template', TemplateEntity::class);
$schedule = $tplMng->getDataValueObj('schedule', ScheduleEntity::class);
if (isset($schedule)) {
$recoveryStatus = new RecoveryStatus($schedule);
} else {
$recoveryStatus = new RecoveryStatus($template);
}
$isRecoverable = $recoveryStatus->isRecoverable();
$templareRecoveryAlter = new UiDialog();
if (!$isRecoverable) {
$templareRecoveryAlter->title = (
isset($schedule) ?
__('Schedule: Recovery Point', 'duplicator-pro') :
__('Template: Recovery Point', 'duplicator-pro')
);
$templareRecoveryAlter->width = 600;
$templareRecoveryAlter->height = 600;
$templareRecoveryAlter->showButtons = false;
$templareRecoveryAlter->templatePath = 'parts/recovery/widget/template-filters-info';
$templareRecoveryAlter->templateArgs = ['recoveryStatus' => $recoveryStatus];
$templareRecoveryAlter->initAlert();
?>
<script>
jQuery(document).ready(function($) {
$('#dup-template-recoveable-info-<?php echo (int) $templareRecoveryAlter->getUniqueIdCounter(); ?>').click(function() {
<?php $templareRecoveryAlter->showAlert(); ?>
});
});
</script>
<?php
}
?>
<span class="dup-template-recoveable-info-wrapper">
<?php
if ($isRecoverable) {
?>
<?php esc_html_e('Available', 'duplicator-pro'); ?>
<sup><?php ViewHelper::disasterIcon(); ?></sup>
<?php
} else {
?>
<a href="javascript:void(0)"
id="dup-template-recoveable-info-<?php echo (int) $templareRecoveryAlter->getUniqueIdCounter(); ?>"
class="dup-template-recoveable-info"><u><?php esc_html_e('Disabled', 'duplicator-pro'); ?></u></a>
<?php
}
if (!$isList) {
?>
&nbsp;
<i class="fa-solid fa-question-circle fa-sm dark-gray-color"
data-tooltip-title="<?php esc_attr_e("Recovery Status", 'duplicator-pro'); ?>"
data-tooltip="<?php
if (!isset($schedule)) {
esc_html_e(
"The Recovery Status can be either 'Available' or 'Disabled'.
An 'Available' status allows the templates archive to be restored through the recovery point wizard.
A 'Disabled' status means the archive can still be used but just not ran as a rapid recovery point.",
'duplicator-pro'
);
} else {
esc_html_e(
"The Recovery Status can be either 'Available' or 'Disabled'.
An 'Available' status allows the schedules archive to be restored through the recovery point wizard.
A 'Disabled' status means the archive can still be used but just not ran as a rapid recovery point.",
'duplicator-pro'
);
}
?>"></i>
<?php } ?>
</span>

View File

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