$path) {
$file_path = '';
if (stripos($filename, '[hash]') !== false) {
$glob_files = glob($path);
if (!empty($glob_files)) {
if(count($glob_files) > 10) {
throw new Exception('Trying to delete too many files. Please contact Duplicator support.');
}
foreach ($glob_files as $glob_file) {
$file_path = $glob_file;
DUP_IO::deleteFile($file_path);
$removed_files = true;
}
}
} else if (is_file($path)) {
$file_path = $path;
DUP_IO::deleteFile($path);
$removed_files = true;
} else if (is_dir($path)) {
$file_path = $path;
// Extra protection to ensure we only are deleting the installer directory
if(DUP_STR::contains($path, 'dup-installer')) {
DUP_IO::deleteTree($path);
$removed_files = true;
}
}
if (!empty($file_path)) {
if (file_exists($file_path)) {
echo "
{$txt_found} - ".esc_html($file_path)."
";
$remove_error = true;
} else {
echo "
{$txt_removed} - ".esc_html($file_path)."
";
}
}
}
//No way to know exact name of archive file except from installer.
//The only place where the package can be removed is from installer
//So just show a message if removing from plugin.
if (file_exists($package_path)) {
$path_parts = pathinfo($package_name);
$path_parts = (isset($path_parts['extension'])) ? $path_parts['extension'] : '';
$valid_ext = ($path_parts == "zip" || $path_parts == "daf");
if ($valid_ext && !is_dir($package_path)) {
$html .= (@unlink($package_path))
? "
".esc_html($txt_removed)." - ".esc_html($package_path)."
"
: "
".esc_html($txt_found)." - ".esc_html($package_path)."
";
}
}
echo $html;
if (!$removed_files) {
echo '
'
. ' ' . esc_html__('No Duplicator installer files found on this WordPress Site.', 'duplicator') . ''
. '
';
}
?>
' . esc_html__('Security Notes', 'duplicator') . ': ';
_e('If the installer files do not successfully get removed with this action, then they WILL need to be removed manually through your hosts control panel '
. 'or FTP. Please remove all installer files to avoid any security issues on this site. For more details please visit '
. 'the FAQ link
Which files need to be removed after an install?', 'duplicator');
echo '
';
if ($remove_error) {
echo __('Some of the installer files did not get removed, ', 'duplicator').
'
'.
__('please retry the installer cleanup process', 'duplicator').
'.'.
__(' If this process continues please see the previous FAQ link.', 'duplicator').
'
';
}
echo '
' . esc_html__('Help Support Duplicator', 'duplicator') . ': ';
_e('The Duplicator team has worked many years to make moving a WordPress site a much easier process. Show your support with a '
. '
5 star review! We would be thrilled if you could!', 'duplicator');
?>
stylesheet != $active_theme->stylesheet){
$temp_theme = array('stylesheet' => $theme->stylesheet, 'template' => $theme->template);
break;
}
}
if($temp_theme != null){
//switch to another theme then backto default
switch_theme($temp_theme['template'], $temp_theme['stylesheet']);
switch_theme($active_theme->template, $active_theme->stylesheet);
}
break;
}
if (! DUP_Server::hasInstallerFiles()) {
echo "