Error: Permission denied, make sure you have write permission for folder
Backup file will replace ' . esc_attr( $wp_db_backup_search_text ) . ' text with ' . esc_attr( $wp_db_backup_replace_text ) . '. For Regular Database Backup without replace then Go to Dashboard=>Tool=>WP-DB Backup > Settings > '.esc_html__('Search and Replace - Set Blank Fields', 'wpdbbkp').'
'; } else { echo ' '.esc_html__('Create Database Backup', 'wpdbbkp').''; echo ' '.esc_html__('Create Full Backup', 'wpdbbkp').''; echo ''; } include_once 'admin-header-notification.php'; ?> var $j = jQuery.noConflict(); $j(document).ready(function () { var table = $j("#wpdbbkp_table").DataTable({ order: [[0, "desc"]], }); $j(".popoverid").popover(); $j("#create_backup").click(function() { $j(".wpdbbkp_notification").hide(); $j("#backup_process").show(); $j("#create_backup").attr("disabled", true); }); }); function excludetableall(){ var checkboxes = document.getElementsByClassName("wp_db_exclude_table"); var checked = ""; if($j("#wp_db_exclude_table_all").prop("checked") == true){ checked = "checked"; } $j(".wp_db_exclude_table").each(function() { this.checked = checked; }); } '; echo '| # | '; echo 'Date | '; if($wp_db_log==1){ echo 'Log | '; } echo 'Destination | '; echo 'Type | '; echo 'Backup File | '; echo 'Size | '; echo 'Action | '; echo '||
|---|---|---|---|---|---|---|---|---|---|
| ' . esc_attr( $count ) . ' | '; $curr_date = new DateTime(date( 'Y-m-d H:i:s', $option['date'] )); $curr_date->setTimezone(new DateTimeZone(wp_timezone_string())); echo '' .$this->wpdbbkp_get_timeago($option['date']).''; echo ' | '; if($wp_db_log==1){ echo ''; if (!empty($option['log'])) { if(isset($option['type']) && ($option['type'] == 'complete' || $option['type'] == 'database')){ echo ''; echo ''; echo ''; }else{ echo ''; } } echo ' | '; } echo ''; if ( ! empty( $option['destination'] ) ) { $destination = ( explode( ',', $option['destination'] ) ); foreach ( $destination as $dest ) { $key = trim( $dest ); if ( ! empty( $dest ) && array_key_exists( $key, $destination_icon ) ) { echo ' '; } } } echo ' | '; if(isset($option['type']) && !empty($option['type'])){ if($option['type'] == 'complete'){ echo ''.esc_html__('Full Backup', 'wpdbbkp').' | '; } if($option['type'] == 'database'){ echo ''.esc_html__('Database', 'wpdbbkp').' | '; } }else{ echo 'Database | '; } echo ''; echo ''; echo ' Download | '; echo '' . esc_attr( $this->wp_db_backup_format_bytes( $option['size'] ) ) . ' | '; $remove_backup_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=removebackup&_wpnonce=' . esc_attr( $nonce ) . '&index=' . esc_attr( ( $count - 1 ) ); echo 'Remove '; if ( isset( $option['search_replace'] ) && 1 === (int) $option['search_replace'] ) { echo ''; } else { $restore_url_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=restorebackup&_wpnonce=' . esc_attr( $nonce ) . '&index=' . esc_attr( ( $count - 1 ) ); if(isset($option['type']) && !empty($option['type'])){ if($option['type'] == 'complete'){ $restore_url_href = esc_url( site_url() ) . '/wp-admin/admin.php?page=wp-database-backup&action=wpdbbkrestorefullbackup&_wpnonce=' . esc_attr( $nonce ) . '&index=' . esc_attr( ( $count - 1 ) ); } } echo ' Restore '; } echo ' |
No Database Backups Created!
'; } echo 'If you like WP Database Backup please leave us a rating . Many thanks in advance!
'; echo '
| v |
| ' . esc_attr( number_format_i18n( $no ) ) . ' | '; echo '' . esc_attr( $tablestatus_arr['Name'] ) . ' | '; echo '' . esc_attr( number_format_i18n( isset($tablestatus_arr['Rows'])?$tablestatus_arr['Rows']:0 ) ) . ' | '; $row_usage += $tablestatus_arr['Rows']; echo '
| Total: | '; echo '' . esc_attr( number_format_i18n( $no ) ) . ' Table | '; echo '' . esc_attr( number_format_i18n( $row_usage ) ) . ' Records | '; echo '
'.$message.'
' . $path . ' must be a valid directory path');
$this->root = self::conform_dir($path);
}
public static function get_home_path() {
$home_url = home_url();
$site_url = site_url();
$home_path = ABSPATH;
// If site_url contains home_url and they differ then assume WordPress is installed in a sub directory
if ($home_url !== $site_url && strpos($site_url, $home_url) === 0)
$home_path = trailingslashit(substr(self::conform_dir(ABSPATH), 0, strrpos(self::conform_dir(ABSPATH), str_replace($home_url, '', $site_url))));
return self::conform_dir($home_path);
}
private function warning($context, $warning) {
if (empty($context) || empty($warning))
return;
$this->warnings[$context][$_key = md5(implode(':', (array) $warning))] = $warning;
}
public function exclude_string($context = 'zip') {
// Return a comma separated list by default
$separator = ', ';
$wildcard = '';
// The zip command
if ($context === 'zip') {
$wildcard = '*';
$separator = ' -x ';
// The PclZip fallback library
} elseif ($context === 'regex') {
$wildcard = '([\s\S]*?)';
$separator = '|';
}
$wp_all_backup_exclude_dir = get_option('wp_db_backup_exclude_dir');
if (empty($wp_all_backup_exclude_dir)) {
$excludes = WPDB_BACKUPS_DIR;
} else {
$excludes = WPDB_BACKUPS_DIR . '|' . $wp_all_backup_exclude_dir;
}
$excludes = explode("|", $excludes);
foreach ($excludes as $key => &$rule) {
$file = $absolute = $fragment = false;
// Files don't end with /
if (!in_array(substr($rule, -1), array('\\', '/')))
$file = true;
// If rule starts with a / then treat as absolute path
elseif (in_array(substr($rule, 0, 1), array('\\', '/')))
$absolute = true;
// Otherwise treat as dir fragment
else
$fragment = true;
// Strip $this->root and conform
$rule = str_ireplace($this->get_root(), '', untrailingslashit(self::conform_dir($rule)));
// Strip the preceeding slash
if (in_array(substr($rule, 0, 1), array('\\', '/')))
$rule = substr($rule, 1);
// Escape string for regex
if ($context === 'regex')
$rule = str_replace('.', '\.', $rule);
// Convert any existing wildcards
if ($wildcard !== '*' && strpos($rule, '*') !== false)
$rule = str_replace('*', $wildcard, $rule);
// Wrap directory fragments and files in wildcards for zip
if ($context === 'zip' && ( $fragment || $file ))
$rule = $wildcard . $rule . $wildcard;
// Add a wildcard to the end of absolute url for zips
if ($context === 'zip' && $absolute)
$rule .= $wildcard;
// Add and end carrot to files for pclzip but only if it doesn't end in a wildcard
if ($file && $context === 'regex')
$rule .= '$';
// Add a start carrot to absolute urls for pclzip
if ($absolute && $context === 'regex')
$rule = '^' . $rule;
}
// Escape shell args for zip command
if ($context === 'zip')
$excludes = array_map('escapeshellarg', array_unique($excludes));
return implode($separator, $excludes);
}
public function get_archive_method() {
return $this->archive_method;
}
public function verify_archive($WPDBFileName) {
// If we've already passed then no need to check again
if (!empty($this->archive_verified))
return true;
// If there are errors delete the backup file.
if ($this->get_errors($this->get_archive_method()) && file_exists($WPDBFileName))
unlink($WPDBFileName);
// If the archive file still exists assume it's good
if (file_exists($WPDBFileName))
return $this->archive_verified = true;
return false;
}
public function get_files() {
if (!empty($this->files))
return $this->files;
$this->files = array();
// We only want to use the RecursiveDirectoryIterator if the FOLLOW_SYMLINKS flag is available
if (defined('RecursiveDirectoryIterator::FOLLOW_SYMLINKS')) {
$this->files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->get_root(), RecursiveDirectoryIterator::FOLLOW_SYMLINKS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD);
// Skip dot files if the SKIP_Dots flag is available
if (defined('RecursiveDirectoryIterator::SKIP_DOTS'))
$this->files->setFlags(RecursiveDirectoryIterator::SKIP_DOTS + RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
// If RecursiveDirectoryIterator::FOLLOW_SYMLINKS isn't available then fallback to a less memory efficient method
} else {
$this->files = $this->get_files_fallback($this->get_root());
}
return $this->files;
}
public function wpdbbkp_get_timeago( $time )
{
$time_difference = time() - $time;
if( $time_difference < 1 ) { return 'less than 1 second ago'; }
$condition = array( 12 * 30 * 24 * 60 * 60 => 'year',
30 * 24 * 60 * 60 => 'month',
24 * 60 * 60 => 'day',
60 * 60 => 'hour',
60 => 'minute',
1 => 'second'
);
foreach( $condition as $secs => $str )
{
$d = $time_difference / $secs;
if( $d >= 1 )
{
$t = floor( $d );
return 'About ' . $t . ' ' . $str . ( $t > 1 ? 's' : '' ) . ' ago';
}
}
}
}
new Wpdb_Admin();