/home/techb158/balacoffee.com/wp-content/plugins/updraftplus/addons
Edit: /home/techb158/balacoffee.com/wp-content/plugins/updraftplus/addons/morefiles.php (56507B)
'._x('Download', '(verb)', 'updraftplus').'';
}
public function updraftplus_command_get_zipfile_download($result, $params) {// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found -- Unused parameter is present because the method is used as a WP filter.
global $updraftplus;
$zip_object = $updraftplus->get_zip_object_name();
// Retrieve the information from our backup history
$backup_history = UpdraftPlus_Backup_History::get_history();
// Base name
$file = $backup_history[$params['timestamp']][$params['type']];
// Deal with multi-archive sets
if (is_array($file)) $file = $file[$params['findex']];
// Where it should end up being downloaded to
$fullpath = $updraftplus->backups_dir_location().'/'.$file;
$path = substr($params['path'], strpos($params['path'], DIRECTORY_SEPARATOR) + 1);
if (file_exists($fullpath) && is_readable($fullpath) && filesize($fullpath)>0) {
$zip = new $zip_object;
if (!$zip->open($fullpath)) {
return array('error' => 'UpdraftPlus: opening zip (' . $fullpath . '): failed to open this zip file.');
} else {
if ('UpdraftPlus_PclZip' == $zip_object) {
$extracted = $zip->extract($updraftplus->backups_dir_location() . DIRECTORY_SEPARATOR . 'ziptemp' . DIRECTORY_SEPARATOR, $path);
} else {
$replaced_dir_sep_path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
$extracted = $zip->extractTo($updraftplus->backups_dir_location() . DIRECTORY_SEPARATOR . 'ziptemp' . DIRECTORY_SEPARATOR, $replaced_dir_sep_path);
}
@$zip->close();// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- Silenced to suppress errors that may arise because of the method.
if ($extracted) {
return array('path' => 'ziptemp'.DIRECTORY_SEPARATOR.$path);
} else {
return array('error' => 'UpdraftPlus: failed to extract (' . $path . ')');
}
}
}
return array('error' => 'UpdraftPlus: no such file or diretory (' . $fullpath . '): if the file does exist please make sure it is readable by the server.');
}
public function fileinfo_more($data, $ind) {
if (!is_array($data) || !is_numeric($ind) || empty($this->more_paths) || !is_array($this->more_paths) || empty($this->more_paths[$ind])) return $data;
global $updraftplus;
$file_entities = $updraftplus->jobdata_get('job_file_entities');
if (!isset($file_entities['more'])) return $data;
return array(
'html'=> '
'.__('Contains:', 'updraftplus').' '.htmlspecialchars($this->more_paths[$ind]),
'text'=> '\r\n'.__('Contains:', 'updraftplus').' '.$this->more_paths[$ind]
);
}
public function restore_form_wpcore() {
?>
'.__('The above files comprise everything in a WordPress installation.', 'updraftplus').'
';
}
public function backupable_file_entities($arr, $full_info) {
if ($full_info) {
$arr['wpcore'] = array(
'path' => untrailingslashit(ABSPATH),
'description' => apply_filters('updraft_wpcore_description', __('WordPress core (including any additions to your WordPress root directory)', 'updraftplus')),
'htmltitle' => sprintf(__('WordPress root directory server path: %s', 'updraftplus'), ABSPATH)
);
} else {
$arr['wpcore'] = untrailingslashit(ABSPATH);
}
return $arr;
}
/**
* N.B. &$err is also available as a fourth parameter if needed
*
* @param string $zipfile
* @param array $mess
* @param array $warn
* @return void
*/
public function checkzip_wpcore($zipfile, &$mess, &$warn) {
if (!empty($this->wpcore_foundyet) && 3 == $this->wpcore_foundyet) return;
if (!is_readable($zipfile)) {
$warn[] = sprintf(__('Unable to read zip file (%s) - could not pre-scan it to check its integrity.', 'updraftplus'), basename($zipfile));
return;
}
if ('.zip' == strtolower(substr($zipfile, -4, 4))) {
if (!class_exists('UpdraftPlus_PclZip')) updraft_try_include_file('includes/class-zip.php', 'include');
$zip = new UpdraftPlus_PclZip;
if (!$zip->open($zipfile)) {
$warn[] = sprintf(__('Unable to open zip file (%s) - could not pre-scan it to check its integrity.', 'updraftplus'), basename($zipfile));
return;
}
// Don't put this in the for loop, or the magic __get() method gets called every time the loop goes round
$numfiles = $zip->numFiles;
if (false === $numfiles) {
$warn[] = sprintf(__('Unable to read any files from the zip (%s) - could not pre-scan it to check its integrity. Zip error: (%s)', 'updraftplus'), basename($zipfile), $zip->last_error);
return;
}
for ($i=0; $i < $numfiles; $i++) {
$si = $zip->statIndex($i);
if ('wp-admin/index.php' == $si['name']) {
$this->wpcore_foundyet = $this->wpcore_foundyet | 1;
if (3 == $this->wpcore_foundyet) return;
}
if ('xmlrpc.php' == $si['name'] || 'xmlrpc.php/xmlrpc.php' == $si['name']) {
$this->wpcore_foundyet = $this->wpcore_foundyet | 2;
if (3 == $this->wpcore_foundyet) return;
}
}
@$zip->close();// phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged -- Silenced to suppress errors that may arise because of the method.
} elseif (preg_match('/\.tar(\.(gz|bz2))$/i', $zipfile)) {
if (!class_exists('UpdraftPlus_Archive_Tar')) {
if (false === strpos(get_include_path(), UPDRAFTPLUS_DIR.'/includes/PEAR')) set_include_path(UPDRAFTPLUS_DIR.'/includes/PEAR'.PATH_SEPARATOR.get_include_path());
updraft_try_include_file('includes/PEAR/Archive/Tar.php', 'include_once');
}
$p_compress = null;
if ('.tar.gz' == strtolower(substr($zipfile, -7, 7))) {
$p_compress = 'gz';
} elseif ('.tar.bz2' == strtolower(substr($zipfile, -8, 8))) {
$p_compress = 'bz2';
}
$tar = new UpdraftPlus_Archive_Tar($zipfile, $p_compress);
$list = $tar->listContent();
foreach ($list as $file) {
if (is_array($file) && isset($file['filename'])) {
if ('wp-admin/index.php' == $file['filename']) {
$this->wpcore_foundyet = $this->wpcore_foundyet | 1;
if (3 == $this->wpcore_foundyet) return;
} elseif ('xmlrpc.php' == $file['filename']) {
$this->wpcore_foundyet = $this->wpcore_foundyet | 2;
if (3 == $this->wpcore_foundyet) return;
}
}
}
}
}
public function checkzip_end_wpcore(&$mess, &$warn, &$err) {// phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable -- Unused parameter is present because the method is used as a WP filter.
if (!empty($this->wpcore_foundyet) && 3 == $this->wpcore_foundyet) return;
if (0 == ($this->wpcore_foundyet & 1)) $warn[] = sprintf(__('This does not look like a valid WordPress core backup - the file %s was missing.', 'updraftplus'), 'wp-admin/index.php').' '.__('If you are not sure then you should stop; otherwise you may destroy this WordPress installation.', 'updraftplus');
if (0 == ($this->wpcore_foundyet & 2)) $warn[] = sprintf(__('This does not look like a valid WordPress core backup - the file %s was missing.', 'updraftplus'), 'xmlrpc.php').' '.__('If you are not sure then you should stop; otherwise you may destroy this WordPress installation.', 'updraftplus');
}
public function backupable_file_entities_final($arr, $full_info) {
$path = UpdraftPlus_Options::get_updraft_option('updraft_include_more_path');
if (is_array($path)) {
$path = array_map('untrailingslashit', $path);
if (1 == count($path)) $path = array_shift($path);
} else {
$path = untrailingslashit($path);
}
if ($full_info) {
$arr['more'] = array(
'path' => $path,
'description' => __('Any other file/directory on your server that you wish to backup', 'updraftplus'),
'shortdescription' => __('More Files', 'updraftplus'),
'restorable' => true
);
} else {
$arr['more'] = $path;
}
return $arr;
}
public function config_option_include_more($ret, $prefix) {
if ($prefix) return $ret;
$display = UpdraftPlus_Options::get_updraft_option('updraft_include_more') ? '' : 'style="display:none;"';
$class = $display ? 'updraft-hidden' : '';
$paths = UpdraftPlus_Options::get_updraft_option('updraft_include_more_path', array());
// Remove empty elements
$paths = is_array($paths) ? array_filter($paths) : array($paths);
$ret .= "';
if (empty($backups[$timestamp]['morefiles_linked_indexes']) || empty($backups[$timestamp]['morefiles_more_locations'])) {
$not_found = true;
foreach ($backups[$timestamp]['more'] as $key => $value) {
$more_ui .= $this->get_jstree_row_ui($key, $value, '', true, false, $key);
}
} else {
$last_index = -1;
$split_set = false;
foreach ($backups[$timestamp]['more'] as $key => $value) {
if (!isset($backups[$timestamp]['morefiles_linked_indexes'][$key])) {
$not_found = true;
$more_ui .= $this->get_jstree_row_ui($key, $value, '', true, false, $key);
}
$index = $backups[$timestamp]['morefiles_linked_indexes'][$key];
$split_set = $last_index === $index ? true : false;
if (!file_exists(dirname($backups[$timestamp]['morefiles_more_locations'][$index]))) {
$not_found = true;
$more_ui .= $this->get_jstree_row_ui($key, $value, $backups[$timestamp]['morefiles_more_locations'][$index], true, $split_set, $index);
} else {
$more_ui .= $this->get_jstree_row_ui($key, $value, $backups[$timestamp]['morefiles_more_locations'][$index], false, $split_set, $index);
}
$last_index = $index;
}
}
$more_ui .= $this->get_jstree_ui('restore');
$more_ui .= '
';
if ($not_found) {
$warn[] = __('The original filesystem location for some of the following items was not found. Please select where you want these backups to be restored to.', 'updraftplus');
}
$mess[] = __('Please select the more files backups that you wish to restore:', 'updraftplus');
$info['addui'] = empty($info['addui']) ? $more_ui : $info['addui'] . '