first commit
This commit is contained in:
@@ -0,0 +1,975 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
use Duplicator\Addons\ProBase\License\License;
|
||||
use Duplicator\Controllers\StoragePageController;
|
||||
use Duplicator\Core\CapMng;
|
||||
use Duplicator\Installer\Package\ArchiveDescriptor;
|
||||
use Duplicator\Libs\Snap\SnapJson;
|
||||
use Duplicator\Models\Storages\AbstractStorageEntity;
|
||||
use Duplicator\Package\Create\BuildComponents;
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
* @var DUP_PRO_Package $package
|
||||
*/
|
||||
|
||||
$package = $tplData['package'];
|
||||
$global = DUP_PRO_Global_Entity::getInstance();
|
||||
|
||||
$ui_css_general = (DUP_PRO_UI_ViewState::getValue('dup-package-dtl-general-panel') ? 'display:block' : 'display:none');
|
||||
$ui_css_storage = (DUP_PRO_UI_ViewState::getValue('dup-package-dtl-storage-panel') ? 'display:block' : 'display:none');
|
||||
$ui_css_archive = (DUP_PRO_UI_ViewState::getValue('dup-package-dtl-archive-panel') ? 'display:block' : 'display:none');
|
||||
$ui_css_install = (DUP_PRO_UI_ViewState::getValue('dup-package-dtl-install-panel') ? 'display:block' : 'display:none');
|
||||
|
||||
$archiveDownloadURL = $package->getLocalPackageFileURL(DUP_PRO_Package_File_Type::Archive);
|
||||
$logDownloadURL = $package->getLocalPackageFileURL(DUP_PRO_Package_File_Type::Log);
|
||||
$installerDownloadURL = $package->getLocalPackageFileURL(DUP_PRO_Package_File_Type::Installer);
|
||||
$showLinksDialogJson = SnapJson::jsonEncodeEscAttr(array(
|
||||
"archive" => $archiveDownloadURL,
|
||||
"log" => $logDownloadURL,
|
||||
"installer" => $installerDownloadURL,
|
||||
));
|
||||
|
||||
$lang_notset = __("- not set -", 'duplicator-pro');
|
||||
|
||||
$tplMng->render('admin_pages/packages/details/details_header');
|
||||
?>
|
||||
<div class="dup-package-details-wrapper">
|
||||
<div class="toggle-box">
|
||||
<a href="javascript:void(0)" onclick="DupPro.Pack.OpenAll()">
|
||||
[<?php esc_html_e('open all', 'duplicator-pro'); ?>]
|
||||
</a>
|
||||
<a href="javascript:void(0)" onclick="DupPro.Pack.CloseAll()">
|
||||
[<?php esc_html_e('close all', 'duplicator-pro'); ?>]
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- ===============================
|
||||
GENERAL -->
|
||||
<div class="dup-box dup-box-general">
|
||||
<div class="dup-box-title">
|
||||
<i class="fa fa-archive fa-sm"></i> <?php esc_html_e('General', 'duplicator-pro') ?>
|
||||
<button class="dup-box-arrow">
|
||||
<span class="screen-reader-text"><?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('General', 'duplicator-pro') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dup-box-panel" id="dup-package-dtl-general-panel" style="<?php echo esc_attr($ui_css_general) ?>">
|
||||
<table class='dup-dtl-data'>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Name", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php if (CapMng::can(CapMng::CAP_CREATE, false)) { ?>
|
||||
<a href="javascript:void(0);" onclick="jQuery(this).parent().find('.dup-link-data').toggle()" class="dup-toggle-name">
|
||||
<?php echo esc_html($package->Name) ?>
|
||||
</a>
|
||||
<div class="dup-link-data">
|
||||
<b><?php esc_html_e("ID", 'duplicator-pro') ?>:</b> <?php echo absint($package->ID); ?><br/>
|
||||
<b><?php esc_html_e("Hash", 'duplicator-pro') ?>:</b> <?php echo esc_html($package->Hash); ?><br/>
|
||||
<b><?php esc_html_e("Full Name", 'duplicator-pro') ?>:</b> <?php echo esc_html($package->NameHash); ?><br/>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<?php echo esc_html($package->Name) ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Notes", 'duplicator-pro') ?>:</td>
|
||||
<td><?php echo strlen($package->notes) ? esc_html($package->notes) : esc_html__("- no notes -", 'duplicator-pro') ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Created", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php if (strlen($package->getCreated())) : ?>
|
||||
<a href="javascript:void(0);" onclick="jQuery(this).parent().find('.dup-link-data').toggle()" class="dup-toggle-created">
|
||||
<?php echo esc_html(get_date_from_gmt($package->getCreated())) ?>
|
||||
</a>
|
||||
|
||||
<div class="dup-link-data dup-link-data-created">
|
||||
<?php
|
||||
$datetime1 = new DateTime($package->getCreated());
|
||||
$datetime2 = new DateTime(date("Y-m-d H:i:s"));
|
||||
$diff = $datetime1->diff($datetime2);
|
||||
|
||||
$fulldate = $diff->y . __(' years, ', 'duplicator-pro') .
|
||||
$diff->m . __(' months, ', 'duplicator-pro') . $diff->d . __(' days', 'duplicator-pro');
|
||||
$fulldays = $diff->format('%a') . __(' days', 'duplicator-pro');
|
||||
?>
|
||||
<b><?php esc_html_e("Full Age", 'duplicator-pro'); ?>: </b> <?php echo esc_html($fulldate); ?> <br/>
|
||||
<b><?php esc_html_e("Days Old", 'duplicator-pro'); ?>: </b> <?php echo esc_html($fulldays); ?> <br/>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<?php esc_html_e("- not set in this version -", 'duplicator-pro'); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Versions", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" onclick="jQuery(this).parent().find('.dup-link-data').toggle()" class="dup-toggle-versions">
|
||||
<?php echo esc_html($package->getVersion()) ?>
|
||||
</a>
|
||||
<div class="dup-link-data dup-link-data-versions">
|
||||
<b><?php esc_html_e("WordPress", 'duplicator-pro') ?>:</b>
|
||||
<?php echo strlen($package->VersionWP) ? esc_html($package->VersionWP) : esc_html__("- unknown -", 'duplicator-pro') ?><br/>
|
||||
<b><?php esc_html_e("PHP", 'duplicator-pro') ?>:</b>
|
||||
<?php echo strlen($package->VersionPHP) ? esc_html($package->VersionPHP) : esc_html__("- unknown -", 'duplicator-pro') ?><br/>
|
||||
<b><?php esc_html_e("OS", 'duplicator-pro') ?>:</b>
|
||||
<?php echo strlen($package->VersionOS) ? esc_html($package->VersionOS) : esc_html__("- unknown -", 'duplicator-pro') ?><br/>
|
||||
<b><?php esc_html_e("Mysql", 'duplicator-pro') ?>:</b>
|
||||
<?php echo strlen($package->VersionDB) ? esc_html($package->VersionDB) : esc_html__("- unknown -", 'duplicator-pro') ?> |
|
||||
<?php
|
||||
echo strlen($package->Database->Comments) ?
|
||||
esc_html($package->Database->Comments) :
|
||||
esc_html__('- unknown -', 'duplicator-pro');
|
||||
?>
|
||||
<br/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Runtime", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
$search_types = array(
|
||||
'sec.',
|
||||
',',
|
||||
);
|
||||
$minute_view = trim(str_replace($search_types, '', $package->Runtime));
|
||||
if (is_numeric($minute_view)) {
|
||||
$minute_view = gmdate("H:i:s", (int) $minute_view);
|
||||
}
|
||||
echo strlen($package->Runtime) ?
|
||||
esc_html($package->Runtime) . ' <i>(' . esc_html($minute_view) . ')</i>' :
|
||||
esc_html__('error running', 'duplicator-pro');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Type", 'duplicator-pro') ?>:</td>
|
||||
<td><?php echo esc_html($package->get_type_string()); ?></td>
|
||||
</tr>
|
||||
<?php if (CapMng::can(CapMng::CAP_EXPORT, false)) { ?>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Files", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<div id="dpro-downloads-area">
|
||||
<?php if ($package->Status != DUP_PRO_PackageStatus::ERROR) : ?>
|
||||
<?php if ($package->haveLocalStorage()) : ?>
|
||||
<button
|
||||
class="button dup-downloads-installer"
|
||||
onclick="DupPro.Pack.DownloadFile('<?php echo esc_attr($installerDownloadURL); ?>');return false;"
|
||||
>
|
||||
<i class="fa fa-bolt fa-sm"></i> Installer
|
||||
</button>
|
||||
<button
|
||||
class="button dup-downloads-archive"
|
||||
onclick="DupPro.Pack.DownloadFile('<?php echo esc_attr($archiveDownloadURL); ?>');return false;"
|
||||
>
|
||||
<i class="far fa-file-archive fa-sm"></i> Archive - <?php echo esc_html($package->ZipSize) ?>
|
||||
</button>
|
||||
<button
|
||||
class="button thickbox dup-downloads-share-links"
|
||||
onclick="DupPro.Pack.ShowLinksDialog(<?php echo esc_js($showLinksDialogJson); ?>);"
|
||||
>
|
||||
<i class="fas fa-share-alt fa-sm"></i>
|
||||
<?php esc_html_e("Share File Links", 'duplicator-pro') ?>
|
||||
</button>
|
||||
<table class="dup-pack-dtls-sublist">
|
||||
<tr>
|
||||
<td><?php esc_html_e("Archive", 'duplicator-pro') ?>: </td>
|
||||
<td>
|
||||
<a
|
||||
href="<?php echo esc_attr($archiveDownloadURL); ?>"
|
||||
target="file_results" class="dup-link-archive"
|
||||
download="<?php echo esc_attr($package->Archive->File) ?>"
|
||||
>
|
||||
<?php echo esc_html($package->Archive->File) ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Installer", 'duplicator-pro') ?>: </td>
|
||||
<td>
|
||||
<a class="dup-link-installer" href="<?php echo esc_url($installerDownloadURL); ?>">
|
||||
<?php echo esc_html($package->Installer->getInstallerName()); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Build Log", 'duplicator-pro') ?>: </td>
|
||||
<td>
|
||||
<a class="dup-link-build-log" href="<?php echo esc_attr($logDownloadURL); ?>" target="file_results">
|
||||
<?php echo esc_html($package->get_log_filename()); ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="sub-notes">
|
||||
<i class="fas fa-download"></i> <?php esc_html_e("Click links to download", 'duplicator-pro') ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php else : ?>
|
||||
<!-- CLOUD ONLY FILES -->
|
||||
<div id="dpro-downloads-msg">
|
||||
<i class="fas fa-server"></i>
|
||||
<?php
|
||||
esc_html_e(
|
||||
"The package files are in remote storage location(s). Please visit the storage provider to download.",
|
||||
'duplicator-pro'
|
||||
);
|
||||
?>
|
||||
</div> <br/>
|
||||
<button class="button" disabled="true">
|
||||
<i class="fa fa-exclamation-triangle fa-sm"></i> Installer - <?php echo esc_html(DUP_PRO_U::byteSize($package->Installer->Size)) ?>
|
||||
</button>
|
||||
<button class="button" disabled="true">
|
||||
<i class="fa fa-exclamation-triangle fa-sm"></i> Archive - <?php echo esc_html($package->ZipSize) ?>
|
||||
</button>
|
||||
<div class="margin-top-1">
|
||||
<b><?php esc_html_e("Build Log", 'duplicator-pro') ?>:</b>
|
||||
<a href="<?php echo esc_url($logDownloadURL); ?>" target="file_results"><?php echo esc_html($package->get_log_filename()); ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<div class="maroon">
|
||||
<i class="fas fa-exclamation-circle"></i>
|
||||
<?php esc_html_e("Package files were not created successfully. Please see the build log for more details.", 'duplicator-pro') ?>
|
||||
</div><br/>
|
||||
<b><?php esc_html_e("Build Log", 'duplicator-pro') ?>:</b>
|
||||
<a href="<?php echo esc_attr($logDownloadURL); ?>" target="file_results"><?php echo esc_html($package->get_log_filename()); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ==========================================
|
||||
DIALOG: SHARE LINKS -->
|
||||
<?php add_thickbox(); ?>
|
||||
<div id="dup-dlg-quick-path" title="<?php esc_attr_e('Download Links', 'duplicator-pro'); ?>" style="display:none">
|
||||
<p class="maroon">
|
||||
<i class="fa fa-lock fa-sm"></i>
|
||||
<?php esc_html_e("The following links contain sensitive data. Please share with caution!", 'duplicator-pro'); ?>
|
||||
</p>
|
||||
|
||||
<div style="padding: 0px 15px 15px 15px;">
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
style="display:inline-block; text-align:right"
|
||||
onclick="DupPro.Pack.GetLinksText()"
|
||||
>
|
||||
[<?php esc_html_e('Select & Copy', 'duplicator-pro'); ?>]
|
||||
</a><br/>
|
||||
<textarea id="dpro-dlg-quick-path-data" style='border:1px solid silver; border-radius:3px; width:99%; height:230px; font-size:11px'></textarea><br/>
|
||||
<i style='font-size:11px'>
|
||||
<?php
|
||||
printf(
|
||||
"%s <a href='" . esc_url(DUPLICATOR_PRO_DUPLICATOR_DOCS_URL . "how-to-work-with-daf-files-and-the-duparchive-extraction-tool") .
|
||||
"' target='_blank'>%s</a>",
|
||||
esc_html__(
|
||||
"An exact copy of the database SQL and installer file can both be found inside of the archive.zip/daf file.
|
||||
Download and extract the archive file to get a copy of the installer which will be named 'installer-backup.php'.
|
||||
For details on how to extract a archive.daf file please see: ",
|
||||
"duplicator-pro"
|
||||
),
|
||||
esc_html__("How do I work with DAF files and the DupArchive extraction tool?", "duplicator-pro")
|
||||
);
|
||||
?>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===============================
|
||||
STORAGE -->
|
||||
<div class="dup-box dup-box-storage">
|
||||
<div class="dup-box-title">
|
||||
<i class="fas fa-server fa-sm"></i> <?php esc_html_e('Storage', 'duplicator-pro') ?>
|
||||
<button class="dup-box-arrow">
|
||||
<span class="screen-reader-text">
|
||||
<?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Storage Options', 'duplicator-pro') ?>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dup-box-panel" id="dup-package-dtl-storage-panel" style="<?php echo esc_attr($ui_css_storage) ?>">
|
||||
<table class="widefat package-tbl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style='width:175px'><?php esc_html_e('Type', 'duplicator-pro') ?></th>
|
||||
<th style='width:275px'><?php esc_html_e('Name', 'duplicator-pro') ?></th>
|
||||
<th style="white-space: nowrap"><?php esc_html_e('Location', 'duplicator-pro') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
$i = 0;
|
||||
$latest_upload_infos = $package->get_latest_upload_infos();
|
||||
foreach ($latest_upload_infos as $upload_info) :
|
||||
if ($upload_info->has_completed(true) == false) {
|
||||
// For now not displaying any cancelled or failed storages
|
||||
continue;
|
||||
}
|
||||
if (($store = AbstractStorageEntity::getById($upload_info->getStorageId())) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$i++;
|
||||
$store_type = $store->getStypeName();
|
||||
$store_id = $store->getStypeName();
|
||||
$store_location = $store->getLocationString();
|
||||
$row_style = ($i % 2) ? 'alternate' : '';
|
||||
?>
|
||||
<tr class="package-row <?php echo esc_attr($row_style) ?>">
|
||||
<td>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
$store->getSTypeIcon(),
|
||||
[
|
||||
'i' => [
|
||||
'class' => [],
|
||||
],
|
||||
'img' => [
|
||||
'src' => [],
|
||||
'class' => [],
|
||||
'alt' => [],
|
||||
],
|
||||
]
|
||||
),
|
||||
' ',
|
||||
esc_html($store->getName());
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if (CapMng::can(CapMng::CAP_STORAGE, false)) {
|
||||
$editUrl = StoragePageController::getEditUrl($store)
|
||||
?>
|
||||
<a href="<?php echo esc_url($editUrl); ?>" target="_blank">
|
||||
<?php echo esc_html($store->getName()); ?>
|
||||
</a>
|
||||
<?php } else {
|
||||
echo esc_html($store->getName());
|
||||
} ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
$store->getHtmlLocationLink(),
|
||||
[
|
||||
'a' => [
|
||||
'href' => [],
|
||||
'target' => [],
|
||||
],
|
||||
'span' => [],
|
||||
]
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($i == 0) : ?>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align: center">
|
||||
<?php esc_html_e('- No storage locations associated with this package -', 'duplicator-pro'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ===============================
|
||||
ARCHIVE -->
|
||||
<div class="dup-box dup-box-archive">
|
||||
<div class="dup-box-title">
|
||||
<i class="far fa-file-archive fa-sm"></i> <?php esc_html_e('Archive', 'duplicator-pro') ?>
|
||||
<button class="dup-box-arrow">
|
||||
<span class="screen-reader-text"><?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Archive', 'duplicator-pro') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dup-box-panel" id="dup-package-dtl-archive-panel" style="<?php echo esc_attr($ui_css_archive) ?>">
|
||||
|
||||
<!-- FILES -->
|
||||
<div class="section-hdr">
|
||||
<i class="fas fa-folder-open fa-sm"></i>
|
||||
<?php esc_html_e('FILES', 'duplicator-pro'); ?>
|
||||
</div>
|
||||
<table class='dup-dtl-data'>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Engine", 'duplicator-pro') ?>: </td>
|
||||
<td>
|
||||
<?php
|
||||
$zip_mode_string = __('Unknown', 'duplicator-pro');
|
||||
|
||||
if ($package->build_progress->current_build_mode == DUP_PRO_Archive_Build_Mode::ZipArchive) {
|
||||
$zip_mode_string = __("ZipArchive", 'duplicator-pro');
|
||||
|
||||
if ($package->ziparchive_mode === DUP_PRO_ZipArchive_Mode::SingleThread) {
|
||||
$zip_mode_string = __("ZipArchive ST", 'duplicator-pro');
|
||||
}
|
||||
} elseif ($package->build_progress->current_build_mode == DUP_PRO_Archive_Build_Mode::Shell_Exec) {
|
||||
$zip_mode_string = __("Shell Exec", 'duplicator-pro');
|
||||
} else {
|
||||
$zip_mode_string = __("DupArchive", 'duplicator-pro');
|
||||
}
|
||||
|
||||
echo esc_html($zip_mode_string);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Filters", 'duplicator-pro') ?>: </td>
|
||||
<td><?php echo $package->Archive->FilterOn == 1 ? 'On' : 'Off'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="sub-filter-hdr">
|
||||
<i class="far fa-folder-open"></i>
|
||||
<?php esc_html_e("Directories", 'duplicator-pro') ?>
|
||||
</div>
|
||||
|
||||
<div class="sub-filter-data sub-filter-data-directories">
|
||||
<?php
|
||||
//CUSTOM
|
||||
$title = __("User defined filtered directories", 'duplicator-pro');
|
||||
$count = count($package->Archive->FilterInfo->Dirs->Instance);
|
||||
?>
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
onclick="jQuery(this).parent().children('.filter-info').eq(0).toggle(200)"
|
||||
title="<?php echo esc_attr($title) ?>"
|
||||
>
|
||||
<i class="fa fa-filter fa-fw fa-xs"></i><?php esc_html_e('User Defined', 'duplicator-pro') ?>
|
||||
</a>
|
||||
<sup>(<?php echo (int) $count ?>)</sup>
|
||||
<br/>
|
||||
<div class="filter-info">
|
||||
<?php
|
||||
if ($count == 0) {
|
||||
esc_html_e('- filter type not found -', 'duplicator-pro');
|
||||
} else {
|
||||
foreach ($package->Archive->FilterInfo->Dirs->Instance as $dir) {
|
||||
echo esc_html($dir) . ";<br/>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
//UNREADABLE
|
||||
$title = __("These paths are filtered because they are unreadable by the system", 'duplicator-pro');
|
||||
$count = count($package->Archive->FilterInfo->Dirs->Unreadable);
|
||||
?>
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
onclick="jQuery(this).parent().children('.filter-info').eq(1).toggle(200)"
|
||||
title="<?php esc_attr($title) ?>"
|
||||
>
|
||||
<i class="fa fa-filter fa-fw fa-xs"></i><?php esc_html_e('Unreadable', 'duplicator-pro') ?>
|
||||
</a>
|
||||
<sup>(<?php echo (int) $count ?>)</sup>
|
||||
<br/>
|
||||
<div class='filter-info'>
|
||||
<?php
|
||||
if ($count == 0) {
|
||||
esc_html_e('- filter type not found -', 'duplicator-pro');
|
||||
} else {
|
||||
foreach ($package->Archive->FilterInfo->Dirs->Unreadable as $dir) {
|
||||
echo esc_html($dir) . ";<br/>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="sub-filter-hdr">
|
||||
<i class="far fa-file"></i>
|
||||
<?php esc_html_e("Files", 'duplicator-pro') ?>
|
||||
</div>
|
||||
|
||||
<div class="sub-filter-data sub-filter-data-files">
|
||||
<?php
|
||||
//CUSTOM
|
||||
$title = __("User defined filtered files", 'duplicator-pro');
|
||||
$count = count($package->Archive->FilterInfo->Files->Instance);
|
||||
?>
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
onclick="jQuery(this).parent().children('.filter-info').eq(0).toggle(200)"
|
||||
title="<?php echo esc_attr($title) ?>"
|
||||
>
|
||||
<i class="fa fa-filter fa-fw fa-xs"></i><?php esc_html_e('User Defined', 'duplicator-pro') ?>
|
||||
</a>
|
||||
<sup>(<?php echo (int) $count ?>)</sup>
|
||||
<br/>
|
||||
|
||||
<div class="filter-info">
|
||||
<?php
|
||||
if ($count == 0) {
|
||||
esc_html_e('- filter type not found -', 'duplicator-pro');
|
||||
} else {
|
||||
foreach ($package->Archive->FilterInfo->Files->Instance as $file) {
|
||||
echo esc_html($file) . ";<br/>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
//UNREADABLE
|
||||
$title = __("These paths are filtered because they are unreadable by the system", 'duplicator-pro');
|
||||
$count = count($package->Archive->FilterInfo->Files->Unreadable);
|
||||
?>
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
onclick="jQuery(this).parent().children('.filter-info').eq(1).toggle(200)"
|
||||
title="<?php echo esc_attr($title) ?>"
|
||||
>
|
||||
<i class='fa fa-filter fa-fw fa-xs'></i><?php esc_html_e('Unreadable', 'duplicator-pro') ?>
|
||||
</a>
|
||||
<sup>(<?php echo (int) $count ?>)</sup>
|
||||
<br/>
|
||||
<div class="filter-info">
|
||||
<?php
|
||||
if ($count == 0) {
|
||||
esc_html_e('- filter type not found -', 'duplicator-pro');
|
||||
} else {
|
||||
foreach ($package->Archive->FilterInfo->Files->Unreadable as $file) {
|
||||
echo esc_html($file) . ";<br/>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<div class="sub-filter-hdr">
|
||||
<i class="far fa-sticky-note"></i>
|
||||
<?php esc_html_e("Extensions", 'duplicator-pro') ?>
|
||||
</div>
|
||||
|
||||
<div class="sub-filter-data sub-filter-data-extensions">
|
||||
<?php
|
||||
if (count($package->Archive->FilterExtsAll) > 0) {
|
||||
$filter_ext = implode(',', $package->Archive->FilterExtsAll);
|
||||
echo esc_html($filter_ext);
|
||||
} else {
|
||||
esc_html_e('- no filters -', 'duplicator-pro');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e('Components: ', 'duplicator-pro'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
BuildComponents::displayComponentsList($package->components, "</br>"),
|
||||
[
|
||||
'br' => [],
|
||||
]
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table><br/>
|
||||
|
||||
<!-- DATABASE -->
|
||||
<div class="section-hdr">
|
||||
<i class="fas fa-database"></i>
|
||||
<?php esc_html_e('DATABASE', 'duplicator-pro'); ?>
|
||||
</div>
|
||||
<?php if (!BuildComponents::isDBExcluded($package->components)) : ?>
|
||||
<table class='dup-dtl-data'>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Name", 'duplicator-pro') ?>: </td>
|
||||
<td><?php echo esc_html($package->Database->info->name) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Type", 'duplicator-pro') ?>: </td>
|
||||
<td><?php echo esc_html($package->Database->Type) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Engine", 'duplicator-pro') ?>: </td>
|
||||
<td><?php echo esc_html($package->Database->info->dbEngine) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("SQL Mode", 'duplicator-pro') ?>: </td>
|
||||
<td><?php echo esc_html($package->Database->DBMode) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Filters", 'duplicator-pro') ?>: </td>
|
||||
<td><?php echo $package->Database->FilterOn == 1 ? 'On' : 'Off'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td>
|
||||
<?php
|
||||
$title = __('User defined table filters.', 'duplicator-pro');
|
||||
$count = (strlen($package->Database->FilterTables))
|
||||
? count(explode(',', $package->Database->FilterTables))
|
||||
: 0;
|
||||
?>
|
||||
|
||||
<div class="sub-filter-hdr">
|
||||
<i class="fas fa-table"></i>
|
||||
<?php esc_html_e('Tables', 'duplicator-pro'); ?>
|
||||
</div>
|
||||
|
||||
<div class="sub-filter-data sub-filter-data-tables">
|
||||
<a
|
||||
href='javascript:void(0)'
|
||||
onclick="jQuery(this).parent().children('.filter-info').eq(0).toggle(200)" title="<?php echo esc_attr($title); ?>"
|
||||
>
|
||||
<i class='fa fa-filter fa-fw fa-xs'></i><?php esc_html_e('User Defined', 'duplicator-pro'); ?></a>
|
||||
<sup>(<?php echo (int) $count; ?>)</sup>
|
||||
|
||||
<div id="dup-filter-tables" class="filter-info">
|
||||
<?php
|
||||
if (strlen($package->Database->FilterTables)) {
|
||||
$filterTables = trim(str_replace(',', "<br/>", $package->Database->FilterTables));
|
||||
echo wp_kses($filterTables, ['br' => []]);
|
||||
} else {
|
||||
esc_html_e('- no filters -', 'duplicator-pro');
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e('Size', 'duplicator-pro') ?>: </td>
|
||||
<td><?php echo esc_html(DUP_PRO_U::byteSize($package->Database->info->tablesSizeOnDisk));?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e('Collations', 'duplicator-pro') ?>: </td>
|
||||
<td>
|
||||
<?php
|
||||
foreach ($package->Database->info->collationList as $collation) {
|
||||
echo esc_html($collation) . "<br/>";
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php else : ?>
|
||||
<p>
|
||||
<?php esc_html_e("The Database was excluded from the package.", "duplicator-pro"); ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<br/>
|
||||
|
||||
<!-- SETUP -->
|
||||
<div class="section-hdr">
|
||||
<i class="fas fa-sliders-h"></i>
|
||||
<?php esc_html_e('SETUP', 'duplicator-pro'); ?>
|
||||
</div>
|
||||
<table class='dup-dtl-data'>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Security", 'duplicator-pro'); ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
switch ($package->Installer->OptsSecureOn) {
|
||||
case ArchiveDescriptor::SECURE_MODE_NONE:
|
||||
esc_html_e('None', 'duplicator-pro');
|
||||
break;
|
||||
case ArchiveDescriptor::SECURE_MODE_INST_PWD:
|
||||
esc_html_e('Installer password', 'duplicator-pro');
|
||||
break;
|
||||
case ArchiveDescriptor::SECURE_MODE_ARC_ENCRYPT:
|
||||
esc_html_e('Archive encryption', 'duplicator-pro');
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Invalid secure mode');
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="sub-notes">
|
||||
<?php
|
||||
esc_html_e('Lost passwords cannot be recovered. A new archive will need to be created.', 'duplicator-pro');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ===============================
|
||||
INSTALLER -->
|
||||
<div class="dup-box dup-box-installer" style="margin-bottom: 50px">
|
||||
<div class="dup-box-title">
|
||||
<i class="fa fa-bolt fa-sm"></i> <?php esc_html_e('Installer', 'duplicator-pro') ?>
|
||||
<?php if ($package->Installer->isSecure()) { ?>
|
||||
<span id="dpro-install-secure-lock" title="<?php esc_attr_e('Installer password protection is on for this package.', 'duplicator-pro') ?>">
|
||||
<i class="fa fa-lock fa-sm"></i>
|
||||
</span>
|
||||
<?php } else { ?>
|
||||
<span id="dpro-install-secure-unlock" title="<?php esc_attr_e('Installer password protection is off for this package.', 'duplicator-pro') ?>">
|
||||
<i class="fa fa-unlock-alt"></i>
|
||||
</span>
|
||||
<?php } ?>
|
||||
<button class="dup-box-arrow">
|
||||
<span class="screen-reader-text">
|
||||
<?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Installer', 'duplicator-pro') ?>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dup-box-panel" id="dup-package-dtl-install-panel" style="<?php echo esc_attr($ui_css_install) ?>">
|
||||
<br/>
|
||||
|
||||
<table class='dup-dtl-data'>
|
||||
<tr>
|
||||
<td colspan="2"><div class="dup-package-hdr-1"><?php esc_html_e("SETUP", 'duplicator-pro') ?></div></td>
|
||||
</tr>
|
||||
<?php if (License::can(License::CAPABILITY_BRAND)) : ?>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Brand", 'duplicator-pro'); ?>:</td>
|
||||
<td>
|
||||
<span style="color:#AF5E52; font-weight: bold">
|
||||
<?php echo esc_html($package->Brand) ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Security", 'duplicator-pro'); ?>:</td>
|
||||
<td>
|
||||
<?php echo $package->Installer->isSecure() ? esc_html__("On", 'duplicator-pro') : esc_html__("Off", 'duplicator-pro'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table><br/><br/>
|
||||
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td colspan="2"><div class="dup-package-hdr-1"><?php esc_html_e("PREFILLS", 'duplicator-pro') ?></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- ===================
|
||||
STEP1 TABS -->
|
||||
<div data-dpro-tabs="true">
|
||||
<ul>
|
||||
<li> <?php esc_html_e('Basic', 'duplicator-pro') ?> </li>
|
||||
<li id="dpro-cpnl-tab-lbl"><?php esc_html_e('cPanel', 'duplicator-pro') ?></li>
|
||||
</ul>
|
||||
|
||||
<!-- ===================
|
||||
TAB1: Basic -->
|
||||
<div>
|
||||
<table class='dup-dtl-data dup-dtl-basic'>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Host", 'duplicator-pro') ?>:</td>
|
||||
<td><?php echo strlen($package->Installer->OptsDBHost) ? esc_html($package->Installer->OptsDBHost) : esc_html($lang_notset) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("Database", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
echo strlen($package->Installer->OptsDBName) ?
|
||||
esc_html($package->Installer->OptsDBName) :
|
||||
esc_html($lang_notset);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php esc_html_e("User", 'duplicator-pro') ?>:</td>
|
||||
<td><?php echo strlen($package->Installer->OptsDBUser) ? esc_html($package->Installer->OptsDBUser) : esc_html($lang_notset) ?></td>
|
||||
</tr>
|
||||
</table><br/>
|
||||
</div>
|
||||
|
||||
<!-- ===================
|
||||
TAB2: cPanel -->
|
||||
<div style="max-height: 250px" class="dup-dtl-cpanel">
|
||||
<table class='dup-dtl-data'>
|
||||
<tr>
|
||||
<td colspan="2" class="sub-section"> <b><?php esc_html_e("cPanel Login", 'duplicator-pro') ?></b> </td>
|
||||
</tr>
|
||||
<tr class="sub-item">
|
||||
<td><?php esc_html_e("Automation", 'duplicator-pro') ?>:</td>
|
||||
<td><?php echo ($package->Installer->OptsCPNLEnable) ? 'On' : 'Off' ?></td>
|
||||
</tr>
|
||||
<tr class="sub-item">
|
||||
<td><?php esc_html_e("Host", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
echo strlen($package->Installer->OptsCPNLHost) ?
|
||||
esc_html($package->Installer->OptsCPNLHost) :
|
||||
esc_html($lang_notset);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="sub-item">
|
||||
<td><?php esc_html_e("User", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
echo strlen($package->Installer->OptsCPNLUser) ?
|
||||
esc_html($package->Installer->OptsCPNLUser) :
|
||||
esc_html($lang_notset);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="sub-section"><b><?php esc_html_e("MySQL Server", 'duplicator-pro') ?></b></td>
|
||||
</tr>
|
||||
<tr class="sub-item">
|
||||
<td><?php esc_html_e("Action", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
echo ($package->Installer->OptsCPNLDBAction == 'create') ?
|
||||
esc_html__("Create A New Database", 'duplicator-pro') :
|
||||
esc_html__("Connect to Existing Database and Remove All Data", 'duplicator-pro');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="sub-item">
|
||||
<td><?php esc_html_e("Host", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
echo strlen($package->Installer->OptsCPNLDBHost) ?
|
||||
esc_html($package->Installer->OptsCPNLDBHost) :
|
||||
esc_html($lang_notset);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="sub-item">
|
||||
<td><?php esc_html_e("Database", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
echo strlen($package->Installer->OptsCPNLDBName) ?
|
||||
esc_html($package->Installer->OptsCPNLDBName) :
|
||||
esc_html($lang_notset);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="sub-item">
|
||||
<td><?php esc_html_e("User", 'duplicator-pro') ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
echo strlen($package->Installer->OptsCPNLDBUser) ?
|
||||
esc_html($package->Installer->OptsCPNLDBUser) :
|
||||
esc_html($lang_notset);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table><br/>
|
||||
|
||||
</div>
|
||||
</div><br/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
jQuery(document).ready(function ($)
|
||||
{
|
||||
/* Shows the Share 'Download Links' dialog
|
||||
* @param json JSON containing all links
|
||||
*/
|
||||
DupPro.Pack.ShowLinksDialog = function(json)
|
||||
{
|
||||
var url = '#TB_inline?width=650&height=400&inlineId=dup-dlg-quick-path';
|
||||
tb_show("<?php esc_html_e('Package File Links', 'duplicator-pro') ?>", url);
|
||||
|
||||
var msg = <?php printf(
|
||||
'"%s" + "\n\n%s:\n" + json.archive + "\n\n%s:\n" + json.installer + "\n\n%s:\n" + json.log + "\n\n%s";',
|
||||
'=========== SENSITIVE INFORMATION START ===========',
|
||||
esc_html__("ARCHIVE", 'duplicator-pro'),
|
||||
esc_html__("INSTALLER", 'duplicator-pro'),
|
||||
esc_html__("LOG", 'duplicator-pro'),
|
||||
'=========== SENSITIVE INFORMATION END ==========='
|
||||
);
|
||||
?>
|
||||
$("#dpro-dlg-quick-path-data").val(msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Open all Panels */
|
||||
DupPro.Pack.OpenAll = function () {
|
||||
DupPro.UI.IsSaveViewState = false;
|
||||
var states = [];
|
||||
$("div.dup-box").each(function () {
|
||||
var pan = $(this).find('div.dup-box-panel');
|
||||
var panel_open = pan.is(':visible');
|
||||
if (!panel_open)
|
||||
$(this).find('div.dup-box-title').trigger("click");
|
||||
states.push({
|
||||
key: pan.attr('id'),
|
||||
value: 1
|
||||
});
|
||||
});
|
||||
DupPro.UI.SaveMulViewStatesByPost(states);
|
||||
DupPro.UI.IsSaveViewState = true;
|
||||
};
|
||||
|
||||
/* Close all Panels */
|
||||
DupPro.Pack.CloseAll = function () {
|
||||
DupPro.UI.IsSaveViewState = false;
|
||||
var states = [];
|
||||
$("div.dup-box").each(function () {
|
||||
var pan = $(this).find('div.dup-box-panel');
|
||||
var panel_open = pan.is(':visible');
|
||||
if (panel_open)
|
||||
$(this).find('div.dup-box-title').trigger("click");
|
||||
states.push({
|
||||
key: pan.attr('id'),
|
||||
value: 0
|
||||
});
|
||||
});
|
||||
DupPro.UI.SaveMulViewStatesByPost(states);
|
||||
DupPro.UI.IsSaveViewState = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Submits the password for validation
|
||||
*/
|
||||
DupPro.togglePassword = function ()
|
||||
{
|
||||
var $input = $('#secure-pass');
|
||||
var $button = $('#secure-btn');
|
||||
if (($input).attr('type') == 'text') {
|
||||
$input.attr('type', 'password');
|
||||
$button.html('<i class="fas fa-eye fa-sm"></i>');
|
||||
} else {
|
||||
$input.attr('type', 'text');
|
||||
$button.html('<i class="fas fa-eye-slash fa-sm"></i>');
|
||||
}
|
||||
}
|
||||
|
||||
/* Selects all text in share dialog */
|
||||
DupPro.Pack.GetLinksText = function () {
|
||||
$('#dpro-dlg-quick-path-data').select();
|
||||
document.execCommand('copy');
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\PackagesPageController;
|
||||
use Duplicator\Core\CapMng;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
* @var DUP_PRO_Package $package
|
||||
*/
|
||||
|
||||
$package = $tplData['package'];
|
||||
/** @var string */
|
||||
$innerPage = $tplData['currentInnerPage'];
|
||||
$enable_transfer_tab = (
|
||||
$package->getLocalPackageFilePath(DUP_PRO_Package_File_Type::Installer) !== false &&
|
||||
$package->getLocalPackageFilePath(DUP_PRO_Package_File_Type::Archive) !== false
|
||||
);
|
||||
|
||||
$packagesListUrl = PackagesPageController::getInstance()->getMenuLink();
|
||||
$packgeDefailsUrl = PackagesPageController::getInstance()->getPackageDetailsUrl($package->ID);
|
||||
$packgeTransferUrl = PackagesPageController::getInstance()->getPackageTransferUrl($package->ID);
|
||||
?>
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<a
|
||||
href="<?php echo esc_url($packgeDefailsUrl); ?>"
|
||||
class="nav-tab <?php echo ($innerPage == PackagesPageController::LIST_INNER_PAGE_DETAILS) ? 'nav-tab-active' : '' ?>"
|
||||
>
|
||||
<?php esc_html_e('Details', 'duplicator-pro'); ?>
|
||||
</a>
|
||||
<?php if (CapMng::can(CapMng::CAP_CREATE, false)) { ?>
|
||||
<a
|
||||
href="<?php echo esc_url($packgeTransferUrl); ?>"
|
||||
class="nav-tab <?php echo ($innerPage == PackagesPageController::LIST_INNER_PAGE_TRANSFER) ? 'nav-tab-active' : '' ?>"
|
||||
<?php if ($enable_transfer_tab === false) { ?>
|
||||
onclick="DupPro.Pack.TransferDisabled(); return false;"
|
||||
<?php } ?>
|
||||
>
|
||||
<?php esc_html_e('Transfer', 'duplicator-pro'); ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
</h2>
|
||||
<div class="dup-details-packages-list">
|
||||
<a href="<?php echo esc_url($packagesListUrl); ?>">[<?php esc_html_e('Packages', 'duplicator-pro'); ?>]</a>
|
||||
</div>
|
||||
|
||||
<?php if ($package->Status == DUP_PRO_PackageStatus::ERROR) { ?>
|
||||
<div id='dpro-error' class="error">
|
||||
<p>
|
||||
<b>
|
||||
<?php
|
||||
echo esc_html__('Error encountered building package, please review ', 'duplicator-pro') .
|
||||
'<a target="_blank" href="' . esc_url($package->get_log_url()) . '">' . esc_html__('package log', 'duplicator-pro') . '</a>' .
|
||||
esc_html__(' for details.', 'duplicator-pro');
|
||||
?>
|
||||
</b>
|
||||
<br/>
|
||||
<?php
|
||||
echo esc_html__('For more help read the ', 'duplicator-pro') .
|
||||
'<a target="_blank" href="' . esc_url(DUPLICATOR_PRO_TECH_FAQ_URL) . '">' . esc_html__('FAQ pages', 'duplicator-pro') . '</a>' .
|
||||
esc_html__(' or submit a ', 'duplicator-pro') .
|
||||
'<a target="_blank" href="' . esc_url(DUPLICATOR_PRO_BLOG_URL . 'my-account/support/') . '">' .
|
||||
esc_html__('help ticket', 'duplicator-pro') . '</a>';
|
||||
?>.
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
$alertTransferDisabled = new DUP_PRO_UI_Dialog();
|
||||
$alertTransferDisabled->title = __('Transfer Error', 'duplicator-pro');
|
||||
$alertTransferDisabled->message = __('No package in default location so transfer is disabled.', 'duplicator-pro');
|
||||
$alertTransferDisabled->initAlert();
|
||||
?>
|
||||
<script>
|
||||
DupPro.Pack.TransferDisabled = function() {
|
||||
<?php $alertTransferDisabled->showAlert(); ?>
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
*/
|
||||
?>
|
||||
<br/><br/>
|
||||
<div id='dpro-error' class="error">
|
||||
<p>
|
||||
<?php echo sprintf(
|
||||
esc_html__(
|
||||
"Unable to find package id %d. The package does not exist or was deleted.",
|
||||
'duplicator-pro'
|
||||
),
|
||||
esc_html($tplData['packageId'])
|
||||
); ?>
|
||||
<br/>
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,590 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Duplicator
|
||||
*/
|
||||
|
||||
use Duplicator\Controllers\StoragePageController;
|
||||
use Duplicator\Core\CapMng;
|
||||
use Duplicator\Libs\Snap\SnapJson;
|
||||
use Duplicator\Libs\Snap\SnapWP;
|
||||
use Duplicator\Models\Storages\AbstractStorageEntity;
|
||||
use Duplicator\Models\Storages\StoragesUtil;
|
||||
|
||||
defined("ABSPATH") or die("");
|
||||
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var Duplicator\Core\Controllers\ControllersManager $ctrlMng
|
||||
* @var Duplicator\Core\Views\TplMng $tplMng
|
||||
* @var array<string, mixed> $tplData
|
||||
* @var bool $blur
|
||||
*/
|
||||
|
||||
$blur = $tplData['blur'];
|
||||
/** @var DUP_PRO_Package */
|
||||
$package = $tplData['package'];
|
||||
$storage_list = AbstractStorageEntity::getAll(0, 0, [StoragesUtil::class, 'sortByPriority']);
|
||||
|
||||
$newStorageEditUrl = StoragePageController::getEditUrl();
|
||||
|
||||
$transfer_occurring = (($package->Status >= DUP_PRO_PackageStatus::STORAGE_PROCESSING) && ($package->Status < DUP_PRO_PackageStatus::COMPLETE));
|
||||
|
||||
$view_state = DUP_PRO_UI_ViewState::getArray();
|
||||
$ui_css_transfer_log = (isset($view_state['dup-transfer-transfer-log']) && $view_state['dup-transfer-transfer-log']) ? 'display:block' : 'display:none';
|
||||
|
||||
$installer_name = $package->Installer->getInstallerName();
|
||||
$archive_name = (isset($package->Archive->File)) ? $package->Archive->File : __('Unable to locate file', 'duplicator-pro');
|
||||
|
||||
$tplMng->render('admin_pages/packages/details/details_header');
|
||||
?>
|
||||
<div class="transfer-panel <?php echo ($blur ? 'dup-mock-blur' : ''); ?>">
|
||||
<div class="transfer-hdr">
|
||||
<h2 class="title">
|
||||
<i class="fas fa-exchange-alt"></i> <?php esc_html_e('Manual Transfer', 'duplicator-pro'); ?>
|
||||
<button id="dup-trans-ovr" type="button" class="dup-btn-borderless"
|
||||
title="<?php esc_html_e('Show file details', 'duplicator-pro'); ?>"
|
||||
onclick="DupPro.Pack.Transfer.toggleOverview()">
|
||||
<i class="fas fa-chevron-left fa-fw fa-sm"></i> Details
|
||||
</button>
|
||||
</h2>
|
||||
<hr/>
|
||||
</div>
|
||||
|
||||
<!-- ===================
|
||||
OVERVIEW -->
|
||||
<div id="step1-ovr">
|
||||
<h3><?php esc_html_e('File Overview', 'duplicator-pro'); ?></h3>
|
||||
<small>
|
||||
<?php esc_html_e('These files will be transferred to the selected storage locations. Links are sensitive. Keep them safe!', 'duplicator-pro'); ?>
|
||||
</small>
|
||||
<label>
|
||||
<i class="far fa-file-archive fa-fw"></i>
|
||||
<b><?php esc_html_e('Archive File', 'duplicator-pro'); ?></b>
|
||||
<?php echo ' (' . esc_html(DUP_PRO_U::byteSize($package->Archive->Size)) . ')'; ?><br/>
|
||||
<input type="text" value="<?php echo esc_attr($archive_name) ?>" readonly="readonly" />
|
||||
<span onclick="jQuery(this).parent().find('input').select();">
|
||||
<span class="copy-button" data-dup-copy-value="<?php echo esc_attr($archive_name); ?>">
|
||||
<i class='far fa-copy dup-cursor-pointer'></i> <?php esc_html_e('Copy Name', 'duplicator-pro'); ?>
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<i class="fa fa-bolt fa-fw"></i>
|
||||
<b><?php esc_html_e('Archive Installer', 'duplicator-pro'); ?></b>
|
||||
<?php echo ' (' . esc_html(DUP_PRO_U::byteSize($package->Installer->Size)) . ')'; ?><br/>
|
||||
<input type="text" value="<?php echo esc_attr($installer_name) ?>" readonly="readonly" />
|
||||
<span onclick="jQuery(this).parent().find('input').select();">
|
||||
<span class="copy-button" data-dup-copy-value="<?php echo esc_attr($installer_name); ?>">
|
||||
<i class='far fa-copy dup-cursor-pointer'></i> <?php esc_html_e('Copy Name', 'duplicator-pro'); ?>
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- ===================
|
||||
STEP 1 -->
|
||||
<div id="step2-section">
|
||||
<div style="margin:0px 0 0px 0">
|
||||
<h3><?php esc_html_e('Step 1: Choose Location', 'duplicator-pro') ?></h3>
|
||||
<input style="display:none" type="radio" name="location" id="location-storage" checked="checked" onclick="DupPro.Pack.Transfer.ToggleLocation()" />
|
||||
<label style="display:none" for="location-storage"><?php esc_html_e('Storage', 'duplicator-pro'); ?></label>
|
||||
<input style="display:none" type="radio" name="location" id="location-quick" onclick="DupPro.Pack.Transfer.ToggleLocation()" />
|
||||
<label style="display:none" for="location-quick"><?php esc_html_e('Quick FTP Connect', 'duplicator-pro'); ?></label>
|
||||
</div>
|
||||
|
||||
<!-- STEP 1: STORAGE -->
|
||||
<table id="location-storage-opts" class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style='white-space: nowrap; width:10px;'></th>
|
||||
<th style='width:175px'><?php esc_html_e('Type', 'duplicator-pro') ?></th>
|
||||
<th style='width:275px'><?php esc_html_e('Name', 'duplicator-pro') ?></th>
|
||||
<th style="white-space: nowrap"><?php esc_html_e('Location', 'duplicator-pro') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$i = 0;
|
||||
$localStorageIds = array_map(function ($storage) {
|
||||
return $storage->getId();
|
||||
}, $package->getLocalStorages());
|
||||
foreach ($storage_list as $storage) :
|
||||
if ($storage->isDefault() || in_array($storage->getId(), $localStorageIds)) {
|
||||
// Skip for default storage
|
||||
continue;
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
||||
$is_valid = $storage->isValid();
|
||||
$mincheck = ($i == 1) ? 'data-parsley-mincheck="1" data-parsley-required="true"' : '';
|
||||
$row_style = ($i % 2) ? 'alternate' : '';
|
||||
$row_style .= ($is_valid) ? '' : ' storage-missing';
|
||||
$row_chkid = "dup-chkbox-{$storage->getId()}";
|
||||
$storageEditUrl = StoragePageController::getEditUrl($storage);
|
||||
|
||||
?>
|
||||
<tr class="package-row <?php echo esc_attr($row_style) ?>">
|
||||
<td>
|
||||
<input name="edit_id" type="hidden" value="<?php echo (int) $i ?>" />
|
||||
<input class="duppro-storage-input"
|
||||
<?php disabled($is_valid == false); ?>
|
||||
id="<?php echo esc_attr($row_chkid); ?>"
|
||||
name="_storage_ids[]"
|
||||
data-parsley-errors-container="#storage_error_container" <?php echo esc_attr($mincheck); ?>
|
||||
type="checkbox"
|
||||
value="<?php echo (int) $storage->getId(); ?>"
|
||||
<?php disabled($is_valid, false); ?>
|
||||
>
|
||||
</td>
|
||||
<td>
|
||||
<label for="<?php echo esc_attr($row_chkid); ?>" class="dup-store-lbl">
|
||||
<?php
|
||||
echo wp_kses(
|
||||
$storage::getStypeIcon(),
|
||||
[
|
||||
'i' => [
|
||||
'class' => [],
|
||||
],
|
||||
'img' => [
|
||||
'src' => [],
|
||||
'class' => [],
|
||||
'alt' => [],
|
||||
],
|
||||
]
|
||||
),
|
||||
' ',
|
||||
esc_html($storage->getStypeName());
|
||||
?>
|
||||
</label>
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?php echo esc_url($storageEditUrl); ?>" target="_blank">
|
||||
<?php
|
||||
echo ($is_valid == false) ? '<i class="fa fa-exclamation-triangle fa-sm"></i>' : '';
|
||||
echo " " . esc_html($storage->getName());
|
||||
?>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
echo wp_kses(
|
||||
$storage->getHtmlLocationLink(),
|
||||
[
|
||||
'a' => [
|
||||
'href' => [],
|
||||
'target' => [],
|
||||
],
|
||||
]
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach; ?>
|
||||
|
||||
<?php if ($i == 0) : ?>
|
||||
<tr class="package-row">
|
||||
<td colspan="4" style="text-align: center">- <?php esc_html_e('No Storage Items Found', 'duplicator-pro') ?> -</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
<tr class="dup-choose-loc-new-pack">
|
||||
<td colspan="4">
|
||||
<?php if (CapMng::can(CapMng::CAP_STORAGE, false)) { ?>
|
||||
<a href="<?php echo esc_url($newStorageEditUrl); ?>" target="_blank">
|
||||
[<?php esc_html_e('Create New Storage', 'duplicator-pro') ?>]
|
||||
</a>
|
||||
<?php } else { ?>
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ===================
|
||||
STEP 2 -->
|
||||
<div id="step3-section">
|
||||
<h3>
|
||||
<?php esc_html_e('Step 2: Transfer Files', 'duplicator-pro') ?>
|
||||
<button style="<?php echo ($transfer_occurring ? 'none' : 'default'); ?>"
|
||||
id="dup-pro-transfer-btn" type="button"
|
||||
class="button button-large button-primary"
|
||||
onclick="DupPro.Pack.Transfer.StartTransfer();">
|
||||
<?php esc_attr_e('Start Transfer', 'duplicator-pro') ?> <i class="fas fa-upload"></i>
|
||||
|
||||
</button>
|
||||
</h3>
|
||||
|
||||
<div style="width:700px; text-align: center; margin-left: auto; margin-right: auto" class="dpro-active-status-area">
|
||||
<div style="display:none; font-size:20px; font-weight:bold" id="dpro-progress-bar-percent"></div>
|
||||
<div style="font-size:14px" id="dpro-progress-bar-text"><?php esc_html_e('Processing', 'duplicator-pro') ?></div>
|
||||
<div id="dpro-progress-bar-percent-help">
|
||||
<small><?php esc_html_e('Full package percentage shown on packages screen', 'duplicator-pro'); ?></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dpro-progress-bar-container">
|
||||
<div id="dpro-progress-bar-area" class="dpro-active-status-area">
|
||||
<div class="dup-pro-meter-wrapper">
|
||||
<div class="dup-pro-meter blue dup-pro-fullsize">
|
||||
<span></span>
|
||||
</div>
|
||||
<span class="text"></span>
|
||||
</div>
|
||||
<button disabled id="dup-pro-stop-transfer-btn" type="button" class="button button-large button-primarybutton dpro-btn-stop" value=""
|
||||
onclick="DupPro.Pack.Transfer.StopBuild();">
|
||||
<i class="fa fa-times fa-sm"></i> <?php esc_html_e('Stop Transfer', 'duplicator-pro'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===============================
|
||||
TRANSFER LOG -->
|
||||
<div class="dup-box">
|
||||
<div class="dup-box-title">
|
||||
<i class="fas fa-file-contract fa-fw fa-sm"></i>
|
||||
<?php esc_html_e('Transfer Log', 'duplicator-pro') ?>
|
||||
<button class="dup-box-arrow">
|
||||
<span class="screen-reader-text">
|
||||
<?php esc_html_e('Toggle panel:', 'duplicator-pro') ?> <?php esc_html_e('Transfer Log', 'duplicator-pro') ?>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dup-box-panel" id="dup-transfer-transfer-log" style="<?php echo esc_attr($ui_css_transfer_log) ?>">
|
||||
<table class="widefat package-tbl">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style='width:150px'><?php esc_html_e('Started', 'duplicator-pro') ?></th>
|
||||
<th style='width:150px'><?php esc_html_e('Stopped', 'duplicator-pro') ?></th>
|
||||
<th style="white-space: nowrap"><?php esc_html_e('Status', 'duplicator-pro') ?></th>
|
||||
<th style="white-space: nowrap"><?php esc_html_e('Type', 'duplicator-pro') ?></th>
|
||||
<th style="width: 60%; white-space: nowrap"><?php esc_html_e('Description', 'duplicator-pro') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" id="dup-pack-details-trans-log-count"></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$alert1 = new DUP_PRO_UI_Dialog();
|
||||
$alert1->title = __('Storage Warning!', 'duplicator-pro');
|
||||
$alert1->message = __('At least one storage location must be checked.', 'duplicator-pro');
|
||||
$alert1->initAlert();
|
||||
|
||||
$alert2 = new DUP_PRO_UI_Dialog();
|
||||
$alert2->title = __('Transfer Failure!', 'duplicator-pro');
|
||||
$alert2->message = __('Transfer failure when calling duplicator_pro_manual_transfer_storage.', 'duplicator-pro');
|
||||
$alert2->initAlert();
|
||||
|
||||
$alert3 = new DUP_PRO_UI_Dialog();
|
||||
$alert3->title = __('Build Error', 'duplicator-pro');
|
||||
$alert3->message = __('Failed to stop build', 'duplicator-pro');
|
||||
$alert3->initAlert();
|
||||
|
||||
$alert4 = new DUP_PRO_UI_Dialog();
|
||||
$alert4->title = $alert3->title;
|
||||
$alert4->message = __('Failed to stop build due to ajax error.', 'duplicator-pro');
|
||||
$alert4->initAlert();
|
||||
|
||||
$alert5 = new DUP_PRO_UI_Dialog();
|
||||
$alert5->title = 'INFO!';
|
||||
$alert5->message = ''; // javascript inserted message
|
||||
$alert5->initAlert();
|
||||
|
||||
$alert6 = new DUP_PRO_UI_Dialog();
|
||||
$alert6->title = 'INFO!';
|
||||
$alert6->message = ''; // javascript inserted message
|
||||
$alert6->initAlert();
|
||||
?>
|
||||
<script>
|
||||
DupPro.Pack.Transfer = {};
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
var transferRequestedTimestamp = 0;
|
||||
var activePackageId = -1;
|
||||
|
||||
DupPro.Pack.Transfer.toggleOverview = function () {
|
||||
$('div#step1-ovr').toggle();
|
||||
var $i = $('#dup-trans-ovr i');
|
||||
|
||||
if ($($i).hasClass('fa-chevron-left')) {
|
||||
$($i).removeClass('fa-chevron-left').addClass('fa-chevron-down');
|
||||
} else {
|
||||
$($i).removeClass('fa-chevron-down').addClass('fa-chevron-left');
|
||||
}
|
||||
}
|
||||
|
||||
DupPro.Pack.Transfer.GetTimeStamp = function () {
|
||||
return Math.floor(Date.now() / 1000);
|
||||
}
|
||||
|
||||
/* METHOD: Starts the data transfer */
|
||||
DupPro.Pack.Transfer.StartTransfer = function () {
|
||||
|
||||
if (jQuery('#location-storage-opts input[type=checkbox]:checked').length == 0) {
|
||||
<?php $alert1->showAlert(); ?>
|
||||
} else {
|
||||
$(".dpro-active-status-area").show(500);
|
||||
var selected_storage_ids = $.map($(':checkbox[name=_storage_ids\\[\\]]:checked'), function (n, i) {
|
||||
return n.value;
|
||||
});
|
||||
var data = {
|
||||
action: 'duplicator_pro_manual_transfer_storage',
|
||||
package_id: <?php echo (int) $package->ID; ?>,
|
||||
storage_ids: selected_storage_ids,
|
||||
nonce: '<?php echo esc_js(wp_create_nonce('duplicator_pro_manual_transfer_storage')); ?>'
|
||||
}
|
||||
|
||||
console.log("sending to selected storages " + selected_storage_ids);
|
||||
|
||||
transferRequestedTimestamp = DupPro.Pack.Transfer.GetTimeStamp();
|
||||
|
||||
$("#dpro-progress-bar-text").text("<?php echo esc_html__('Initiating transfer. Please wait.', 'duplicator-pro') ?>");
|
||||
$("#dpro-progress-bar-percent").text('');
|
||||
DupPro.Pack.Transfer.SetUIState(true);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
cache: false,
|
||||
timeout: 10000000,
|
||||
data: data,
|
||||
success: function (respData) {
|
||||
try {
|
||||
var parsedData = DupPro.parseJSON(respData);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
console.error('JSON parse failed for response data: ' + respData);
|
||||
<?php $alert2->showAlert(); ?>
|
||||
transferRequestedTimestamp = 0;
|
||||
DupPro.Pack.Transfer.SetUIState(false);
|
||||
console.log(respData);
|
||||
return false;
|
||||
}
|
||||
if (!parsedData.success)
|
||||
{
|
||||
if (parsedData.message != '') {
|
||||
<?php $alert5->showAlert(); ?>
|
||||
$("#<?php echo esc_js($alert5->getID()); ?>_message").html(parsedData.message);
|
||||
}
|
||||
transferRequestedTimestamp = 0;
|
||||
DupPro.Pack.Transfer.SetUIState(false);
|
||||
DupPro.Pack.Transfer.GetPackageState();
|
||||
}
|
||||
},
|
||||
error: function (respData) {
|
||||
<?php $alert2->showAlert(); ?>
|
||||
transferRequestedTimestamp = 0;
|
||||
DupPro.Pack.Transfer.SetUIState(false);
|
||||
console.log(respData);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/* METHOD: Starts the data transfer */
|
||||
DupPro.Pack.Transfer.StopBuild = function () {
|
||||
|
||||
var data = {
|
||||
action: 'duplicator_pro_package_stop_build',
|
||||
package_id: activePackageId,
|
||||
nonce: '<?php echo esc_js(wp_create_nonce('duplicator_pro_package_stop_build')); ?>'
|
||||
}
|
||||
$("#dup-pro-stop-transfer-btn").prop("disabled", true);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
timeout: 10000000,
|
||||
data: data,
|
||||
success: function (respData) {
|
||||
try {
|
||||
var parsedData = DupPro.parseJSON(respData);
|
||||
} catch(err) {
|
||||
console.error(err);
|
||||
console.error('JSON parse failed for response data: ' + respData);
|
||||
<?php $alert4->showAlert(); ?>
|
||||
$("#dup-pro-stop-transfer-btn").prop("disabled", false);
|
||||
return false;
|
||||
}
|
||||
if (!parsedData.success) {
|
||||
<?php $alert3->showAlert(); ?>
|
||||
$("#dup-pro-stop-transfer-btn").prop("disabled", false);
|
||||
}
|
||||
console.log(parsedData.message);
|
||||
},
|
||||
error: function (respData) {
|
||||
<?php $alert4->showAlert(); ?>
|
||||
$("#dup-pro-stop-transfer-btn").prop("disabled", false);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* METHOD: Progress bar display state*/
|
||||
DupPro.Pack.Transfer.SetUIState = function (activeProcessing) {
|
||||
if (activeProcessing)
|
||||
{
|
||||
$(".dpro-active-status-area").show(500);
|
||||
$("#dup-pro-transfer-btn").hide();
|
||||
$("#location-storage input").prop("disabled", true);
|
||||
$("#location-storage-opts input").prop("disabled", true);
|
||||
} else {
|
||||
$("#dup-pro-stop-transfer-btn").prop("disabled", true);
|
||||
// Only allow to revert after enough time has past since the last transfer request
|
||||
currentTimestamp = DupPro.Pack.Transfer.GetTimeStamp();
|
||||
if ((currentTimestamp - transferRequestedTimestamp) > 10)
|
||||
{
|
||||
$("#location-storage input").prop("disabled", false);
|
||||
$("#location-storage-opts input").prop("disabled", false);
|
||||
$("#dup-pro-transfer-btn").show();
|
||||
$(".dpro-active-status-area").hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* METHOD: Retreive package state */
|
||||
DupPro.Pack.Transfer.GetPackageState = function () {
|
||||
|
||||
var package_id = <?php echo (int) $package->ID; ?>;
|
||||
var data = {
|
||||
action: 'duplicator_pro_packages_details_transfer_get_package_vm',
|
||||
package_id: package_id,
|
||||
nonce: '<?php echo esc_js(wp_create_nonce('duplicator_pro_packages_details_transfer_get_package_vm')); ?>'
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
timeout: 10000000,
|
||||
data: data,
|
||||
success: function (respData) {
|
||||
try {
|
||||
var parsedData = DupPro.parseJSON(respData);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
console.error('JSON parse failed for response data: ' + respData);
|
||||
console.log("Transfer failure.");
|
||||
DupPro.Pack.Transfer.SetUIState(false);
|
||||
console.log(respData);
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(parsedData);
|
||||
if (parsedData.success)
|
||||
{
|
||||
var vm = parsedData.vm;
|
||||
|
||||
// vm - view model for this screen
|
||||
// vm.active_package_id: Active package id (-1 for none)
|
||||
// vm.percent_text: Percent through the current transfer
|
||||
// vm.text: Text to display
|
||||
// vm.transfer_logs: array of transfer request vms (start, stop, status, message)
|
||||
|
||||
if (activePackageId != vm.active_package_id)
|
||||
{
|
||||
// Once we have an active package ID allow the stop button to be clicked
|
||||
$("#dup-pro-stop-transfer-btn").prop("disabled", false);
|
||||
}
|
||||
|
||||
activePackageId = vm.active_package_id;
|
||||
if (vm.active_package_id == -1)
|
||||
{
|
||||
// No packages are running
|
||||
DupPro.Pack.Transfer.SetUIState(false);
|
||||
|
||||
} else if (vm.active_package_id == package_id) {
|
||||
|
||||
// This package is running
|
||||
if (vm.percent_text != '')
|
||||
{
|
||||
$("#dpro-progress-bar-percent").text(vm.percent_text);
|
||||
} else
|
||||
{
|
||||
$("#dpro-progress-bar-percent").text('');
|
||||
}
|
||||
|
||||
$("#dpro-progress-bar-text").html(vm.text);
|
||||
DupPro.Pack.Transfer.SetUIState(true);
|
||||
} else {
|
||||
|
||||
// A package other than this one is running
|
||||
$("#dpro-progress-bar-text").html(vm.text);
|
||||
DupPro.Pack.Transfer.SetUIState(true);
|
||||
}
|
||||
DupPro.Pack.Transfer.UpdateTransferLog(vm);
|
||||
} else {
|
||||
if (parsedData.message != '') {
|
||||
<?php $alert6->showAlert(); ?>
|
||||
$("#<?php echo esc_js($alert6->getID()); ?>_message").html(parsedData.message);
|
||||
}
|
||||
DupPro.Pack.Transfer.SetUIState(false);
|
||||
console.log(data);
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.log("Transfer failure.");
|
||||
DupPro.Pack.Transfer.SetUIState(false);
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* METHOD: Updates the transfer log with the information from the view model */
|
||||
DupPro.Pack.Transfer.UpdateTransferLog = function (vm) {
|
||||
$("#dup-transfer-transfer-log table tbody").empty();
|
||||
var row_style, row_html;
|
||||
for (var i = 0; i < vm.transfer_logs.length; i++) {
|
||||
|
||||
var transfer_log = vm.transfer_logs[i];
|
||||
console.log(transfer_log);
|
||||
|
||||
row_style = (i % 2) ? ' alternate' : '';
|
||||
switch(transfer_log.status_text) {
|
||||
case 'Pending': row_style += ' status-pending'; break;
|
||||
case 'Running': row_style += ' status-running'; break;
|
||||
case 'Failed': row_style += ' status-failed'; break;
|
||||
default: row_style += ' status-normal'; break;
|
||||
}
|
||||
|
||||
row_html =
|
||||
`<tr class="package-row ${row_style}">
|
||||
<td>${transfer_log.started}</td>
|
||||
<td>${transfer_log.stopped}</td>
|
||||
<td>${transfer_log.status_text}</td>
|
||||
<td>${transfer_log.storage_type_text}</td>
|
||||
<td>${transfer_log.message}</td>
|
||||
</tr>`;
|
||||
|
||||
$("#dup-transfer-transfer-log table tbody").append(row_html);
|
||||
$('#dup-pack-details-trans-log-count').html('<?php esc_html_e('Log Items:', 'duplicator-pro') ?> ' + (i + 1) );
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
var row_html = '<tr><td colspan="5" style="text-align:center">' +
|
||||
'<?php esc_html_e('- No transactions found for this package -', 'duplicator-pro'); ?></td></tr>';
|
||||
$("#dup-transfer-transfer-log table tbody").append(row_html);
|
||||
}
|
||||
};
|
||||
|
||||
//INIT
|
||||
DupPro.Pack.Transfer.GetPackageState();
|
||||
setInterval(DupPro.Pack.Transfer.GetPackageState, 8000);
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user