Orderadmin/card/feature/class-versions.php 0000644 00000003152 14757772271 0013710 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Versions
*
* @since 1.11.0
*/
class Versions extends \Boldgrid\Library\Library\Ui\Feature {
/**
*
*/
public function init() {
$data = wp_get_update_data();
$has_updates = ! empty( $data['counts']['plugins'] ) || ! empty( $data['counts']['themes'] ) || ! empty( $data['counts']['wordpress'] );
$this->icon = '';
$this->title = esc_html__( 'WordPress, Plugins, & Theme Version', 'boldgrid-backup' );
if ( $has_updates ) {
$this->content = '
' . wp_kses(
sprintf(
// translators: 1 A description of what updates are available (such as plugins, themes, or core).
__( 'The following updates are available: %1$s', 'boldgrid-backup' ),
$data['title']
),
[]
) . '
';
$this->content .= '' .
wp_kses(
sprintf(
// translators: 1 An opening anchor tag to the update-core.php page, 2 its closing tag.
__( 'Not everything is up to date. %1$sFix this%2$s.', 'boldgrid-backup' ),
'',
''
),
[
'a' => [
'href' => [],
],
]
) .
'
';
} else {
$this->content = '' . esc_html__( 'Everything is up to date!', 'boldgrid-backup' ) . '
';
}
}
}
admin/card/feature/class-timely-auto-updates.php 0000644 00000003411 14757772271 0015752 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Timely_Auto_Updates.
*
* This class is responsible for rendering the, "Timely Auto Updates" feature on the BoldGrid.
* Backup Dashboard.
*
* @since 1.14.0
*/
class Timely_Auto_Updates extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.14.0
*/
public function init() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
$this->icon = '';
$this->title = __( 'Timely Auto Updates', 'boldgrid-backup' );
// Determine whether or not this feature is enabled.
$auto_update_settings = $core->settings->get_setting( 'auto_update' );
$is_enabled = ! empty( $auto_update_settings['timely-updates-enabled'] );
if ( $is_enabled ) {
$this->content = '' . esc_html__( 'Timely Auto Updates are enabled!', 'boldgrid-backup' ) . '
';
} else {
$this->content = '' . esc_html__( 'By setting up Timely Auto Updates, you can have more control over when new updates are installed by WordPress.', 'boldgrid-backup' ) . '
';
$this->content .= '' . wp_kses(
sprintf(
// translators: 1 Opening anchor tag to "Auto Updates" settings page, 2 its closing tag.
__( 'Timely Auto Updates are not enabled. %1$sFix this%2$s.', 'boldgrid-backup' ),
'',
''
),
[ 'a' => [ 'href' => [] ] ]
) . '
';
}
}
}
admin/card/feature/class-speed-coach.php 0000644 00000001550 14757772271 0014213 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Speed_Coach
*
* @since 1.11.0
*/
class Speed_Coach extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$this->icon = '';
$this->title = esc_html__( 'Speed Coach', 'boldgrid-backup' );
$this->content = '' . esc_html__( 'A faster website means happier visitors and higher rankings on the search engines. Simply type in your website’s URL and receive detailed advice on making your site lightning fast.', 'boldgrid-backup' ) . '
';
}
}
admin/card/feature/class-sign-up.php 0000644 00000002113 14757772271 0013416 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Sign_Up
*
* @since 1.11.0
*/
class Sign_Up extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$new_key_url = \Boldgrid\Library\Library\Key\PostNewKey::getCentralUrl( admin_url( 'admin.php?page=boldgrid-backup-dashboard' ) );
$this->icon = '';
$this->content = '' . esc_html__( 'There’s more waiting for you in BoldGrid Central. Download the full-featured community versions of ALL our plugins for FREE. It’s just a click away.', 'boldgrid-backup' ) . '
';
$this->content .= '' . __( 'Sign Up for Free!', 'boldgrid-backup' ) . '
';
}
}
admin/card/feature/class-scheduled-backups.php 0000644 00000005471 14757772271 0015434 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Scheduled_Backups
*
* This class is responsible for displaying the scheduled backups feature on this plugin's dashboard.
*
* @since 1.11.0
*/
class Scheduled_Backups extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
$this->icon = '';
$this->title = esc_html__( 'Scheduled Backups', 'boldgrid-backup' );
$cron = new \Boldgrid\Backup\Admin\Cron();
$backup_entry = $cron->get_entry( 'backup' );
/*
* If a user does not have backups scheduled, suggest they schedule them.
*
* As of 1.11.4, in addition to checking if a schedule is saved in the settings, we also ensure
* that the backup cron can be found. We need to check for the scenario in which the user has
* manually deleted the cron entry yet the settings say backups are scheduled.
*
* In some cases where the settings say backups are scheduled but the cron doesn't actually
* exist, false positives may be given or errors triggered. We may want to explore the idea
* of showing an admin notice. For now, if this scenario exists, the dashboard will tell the
* user to schedule backups, and resaving the settings will resave the cron entry.
*/
if ( $core->settings->has_scheduled_backups() && $backup_entry->is_set() ) {
$next_runtime = $backup_entry->get_next_runtime();
$this->content = '' . wp_kses(
sprintf(
// Translators: 1 An opening span tag, 2 the date of the next backup, 3 its closing span tag.
__( 'Next backup in: %1$s%2$s%3$s', 'boldgrid-backup' ),
'',
human_time_diff( time(), $next_runtime ),
''
),
[
'span' => [
'class' => [],
'title' => [],
],
]
) . '
';
} else {
$this->content = '' . esc_html__( 'It\'s easy to forget to make a backup. Schedule automatic backups so they\'re made for you.', 'boldgrid-backup' ) . '
';
$this->content .= '' . wp_kses(
sprintf(
// translators: 1 An opening anchor tag to the settings page, 2 its closing tag.
__( 'Scheduled Backups not configured. %1$sFix this%2$s.', 'boldgrid-backup' ),
'',
''
),
[
'a' => [
'href' => [],
],
]
) . '
';
}
}
}
admin/card/feature/class-remote-storage.php 0000644 00000003475 14757772271 0015005 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Remote_Storage
*
* @since 1.11.0
*/
class Remote_Storage extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
$this->icon = '';
$this->title = esc_html__( 'Remote Storage', 'boldgrid-backup' );
if ( $core->settings->has_remote_configured() ) {
$storage_locations = $core->remote->get_enabled( 'title' );
$this->content = '' .
wp_kses(
sprintf(
// translators: 1 An opening span tag, A list of remote backup storage locations (csv), its closing span tag.
__( 'Backups saved to: %1$s%2$s%3$s', 'boldgrid-bakcup' ),
'',
esc_html( implode( ', ', $storage_locations ) ),
''
),
[
'span' => [
'class' => [],
],
]
) .
'
';
} else {
$this->content = '' . esc_html__( 'Don\'t put all of your eggs in one basket! Store your backups remotely.', 'boldgrid-backup' ) . '
';
$this->content .= '' . wp_kses(
sprintf(
// translators: 1 An opening anchor tag to the Remote Storage settings, 2 its closing anchor tag.
__( 'Remote Storage is not configured. %1$sFix this%2$s', 'boldgrid-backup' ),
'',
''
),
[ 'a' => [ 'href' => [] ] ]
) . '
';
}
}
}
admin/card/feature/class-more-central.php 0000644 00000002217 14757772271 0014431 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: More_Central
*
* @since 1.11.0
*/
class More_Central extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
$get_premium_url = $core->go_pro->get_premium_url( 'bgbkup-dashboard' );
$this->icon = '';
$this->title = esc_html__( 'More BoldGrid Central Features', 'boldgrid-backup' );
$this->content = '' . esc_html__( 'Unlock more features within BoldGrid Central, including Cloud WordPress Advanced Controls and Automated Website Speed Tests.', 'boldgrid-backup' ) . '
';
$this->content .= '' . __( 'Get Premium', 'boldgrid-backup' ) . '
';
}
}
admin/card/feature/class-more-boldgrid.php 0000644 00000001543 14757772271 0014570 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: More_Boldgrid
*
* @since 1.11.0
*/
class More_Boldgrid extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$this->icon = '';
$this->title = esc_html__( 'More Premium BoldGrid Plugins', 'boldgrid-backup' );
$this->content = '' . esc_html__( 'Gain access to all BoldGrid premium plugins and services. This includes Post and Page Builder Premium, which offers premium Blocks and native sliders.', 'boldgrid-backup' ) . '
';
}
}
admin/card/feature/class-more-backup.php 0000644 00000002404 14757772271 0014244 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: More_Backup
*
* @since 1.11.0
*/
class More_Backup extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$this->icon = '';
$this->title = sprintf(
// translators: 1: Plugin title.
esc_html__( 'More %1$s Features', 'boldgrid-backup' ),
BOLDGRID_BACKUP_TITLE
);
$this->content = '' . wp_kses(
sprintf(
// translators: 1 A span displaying the Google Drive logo, 2 a span displaying the Amazon S3 logo.
esc_html__( '%3$s can store backups on %1$s and %2$s, restore individual files with just a click, and more!', 'boldgrid-backup' ),
'',
'',
BOLDGRID_BACKUP_TITLE . ' Premium'
),
[
'span' => [
'class' => [],
'title' => [],
],
]
) . '
';
}
}
admin/card/feature/class-database-encryption.php 0000644 00000002506 14757772271 0015776 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Database_Encryption
*
* @since 1.13.0
*/
class Database_Encryption extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.13.0
*/
public function init() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
$this->icon = '
';
$this->title = esc_html__( 'Database Encryption', 'boldgrid-backup' );
$this->content = '' . esc_html__( 'Secure your sensitive data with Database Encryption.', 'boldgrid-backup' ) . '
';
$this->content .= '' . wp_kses(
sprintf(
// translators: 1 An opening anchor tag to the Remote Storage settings, 2 its closing anchor tag.
__( 'Database Encryption is not configured. %1$sFix this%2$s', 'boldgrid-backup' ),
'',
''
),
[ 'a' => [ 'href' => [] ] ]
) . '
';
}
}
admin/card/feature/class-cloud-wordpress.php 0000644 00000001522 14757772271 0015173 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Cloud_WordPress
*
* @since 1.11.0
*/
class Cloud_Wordpress extends \Boldgrid\Library\Library\Ui\Feature { //phpcs:ignore
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$this->icon = '';
$this->title = __( 'Cloud WordPress', 'boldgrid-backup' );
$this->content = '' . __( 'Create a fully functional free WordPress demo in just a few clicks. Easily design, build, test and share your WordPress website with clients or teams.', 'boldgrid-backup' ) . '
';
}
}
admin/card/feature/class-central.php 0000644 00000002241 14757772271 0013466 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Central
*
* This class is responsible for initializing a BoldGrid Central "feature" for use within a card.
*
* @since 1.11.0
*/
class Central extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$reseller = new \Boldgrid\Library\Library\Reseller();
$this->icon = '';
$this->title = esc_html__( 'BoldGrid Central', 'boldgrid-backup' );
$this->content = '' . esc_html__( 'Manage your account, Run Automated Website Speed Tests, and more within BoldGrid Central.', 'boldgrid-backup' ) . '
';
$this->content .= '' . esc_html__( 'BoldGrid Central Login', 'boldgrid-backup' ) . '
'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
}
}
admin/card/feature/class-auto-update-backup.php 0000644 00000003341 14757772271 0015533 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Auto_Update_Backup
*
* This class is responsible for rendering the, "Auto Backup Before Updates" feature on the BoldGrid
* Backup Dashboard.
*
* @since 1.11.0
*/
class Auto_Update_Backup extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
$this->icon = '';
$this->title = __( 'Auto Backup Before Updates', 'boldgrid-backup' );
// Determine whether or not this feature is enabled.
$setting_value = $core->settings->get_setting( 'auto_backup' );
$is_enabled = ! empty( $setting_value );
if ( $is_enabled ) {
$this->content = '' . esc_html__( 'Auto Backup Before Updates is enabled!', 'boldgrid-backup' ) . '
';
} else {
$this->content = '' . esc_html__( 'When Auto Backup is enabled, we will backup your site before any auto-updates occur.', 'boldgrid-backup' ) . '
';
$this->content .= '' . wp_kses(
sprintf(
// translators: 1 Opening anchor tag to "Auto Updates" settings page, 2 its closing tag.
__( 'Auto Backup Before Updates is not enabled. %1$sFix this%2$s.', 'boldgrid-backup' ),
'',
''
),
[ 'a' => [ 'href' => [] ] ]
) . '
';
}
}
}
admin/card/feature/class-auto-rollback.php 0000644 00000003040 14757772271 0014573 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card\Feature;
/**
* Class: Auto_Rollback
*
* This class is responsible for rendering the "Auto Rollback" feature on this plugin's dashboard.
*
* @since 1.11.0
*/
class Auto_Rollback extends \Boldgrid\Library\Library\Ui\Feature {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
$this->icon = '';
$this->title = __( 'Auto Rollback', 'boldgrid-backup' );
if ( $core->auto_rollback->is_enabled() ) {
$this->content = '' . esc_html__( 'Auto Rollback is enabled!', 'boldgrid-backup' ) . '
';
} else {
$this->content = '' . esc_html__( 'With Auto Rollback, we can help fix your site if anything goes wrong while performing updates.', 'boldgrid-backup' ) . '
';
$this->content .= '' .
wp_kses(
sprintf(
// translators: 1 An opening anchor tag to the "Auto Updates" settings page, 2 its closing tag.
__( 'Auto Rollback is not enabled. %1$sFix this%2$s.', 'boldgrid-backup' ),
'',
''
),
[ 'a' => [ 'href' => [] ] ]
) . '
';
}
}
}
admin/card/class-updates.php 0000644 00000002272 14757772271 0012054 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Updates
*
* This class is responsible for rendering the "Update Management" card on this plugin's dashboard.
*
* @since 1.11.0
*/
class Updates extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
$this->id = 'bgbkup_updates';
$this->title = esc_html__( 'Update Management', 'boldgrid-backup' );
$this->subTitle = esc_html__( 'Keep everything tidy and up to date.', 'boldgrid-backup' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
$this->icon = '';
$this->features = [
new Feature\Versions(),
new Feature\Auto_Rollback(),
new Feature\Auto_Update_Backup(),
];
if ( $core->config->get_is_premium() ) {
$this->features[] = new Feature\Timely_Auto_Updates();
}
}
}
admin/card/class-timely-auto-updates.php 0000644 00000002255 14757772271 0014324 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Timely Auto Updates
*
* This class is responsible for rendering the "Timely Auto Updates" card on this plugin's Premium Features page.
*
* @since 1.14.0
*/
class Timely_Auto_Updates extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.14.0
*/
public function init() {
$this->id = 'bgbkup_timely_auto_updates';
$this->title = esc_html__( 'Timely Auto Updates', 'boldgrid-backup' );
$this->footer = '
' .
esc_html__(
'Gives you more control over when new updates are installed by WordPress\' Automatic Updates.',
'boldgrid-backup' ) .
'
';
$url = esc_url( 'https://www.boldgrid.com/support/total-upkeep/timely-auto-updates/' );
$this->links = '
' .
esc_html__( 'Setup Guide', 'boldgrid-backup' ) . '
';
$this->icon = '';
}
}
admin/card/class-premium.php 0000644 00000003750 14757772271 0012067 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Premium
*
* This class is responsible for rendering the "Premium" card on this plugin's dashboard.
*
* @since 1.11.0
*/
class Premium extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
$api_key = apply_filters( 'Boldgrid\Library\License\getApiKey', '' ); // phpcs:ignore
$this->id = 'bgbkup_get_premium';
$this->icon = '';
$features = [];
if ( empty( $api_key ) ) {
$this->title = esc_html__( 'BoldGrid Central', 'boldgrid-backup' );
$this->subTitle = esc_html__( 'All the tools and services you need to succeed.', 'boldgrid-backup' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
$this->features = [
new Feature\Cloud_Wordpress(),
new Feature\Speed_Coach(),
new Feature\Sign_Up(),
];
} elseif ( ! $core->config->get_is_premium() ) {
$this->title = esc_html__( 'Enjoying your free account?', 'boldgrid-backup' );
$this->subTitle = esc_html__( 'We hope so. There\'s more available by upgrading now!', 'boldgrid-backup' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
$this->features = [
new Feature\More_Backup(),
new Feature\More_Boldgrid(),
new Feature\More_Central(),
];
} else {
$this->title = esc_html__( 'BoldGrid Premium', 'boldgrid-backup' );
$this->subTitle = esc_html__( 'Thank you for running BoldGrid Premium!', 'boldgrid-backup' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar
$this->features = [
new Feature\Central(),
];
}
}
}
admin/card/class-plugin-editor-tools.php 0000644 00000003153 14757772271 0014326 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Plugin_Editor_Tools.
*
* This class is responsible for rendering the "Plugin Editor Tools".
* card on this plugin's Premium Features Page.
*
* @since 1.13.0
*/
class Plugin_Editor_Tools extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.13.0
*/
public function init() {
$this->id = 'bgbkup_plugin_editor_tools';
$this->title = esc_html__( 'Plugin Editor Tools', 'boldgrid-backup' );
$this->icon = '';
$this->footer = '
' .
esc_html__(
'When using the WordPress Plugin Editor, Total Upkeep Premium will save a copy of the file in case you need to undo any changes.',
'boldgrid-backup'
) .
'
';
$url = 'https://www.boldgrid.com/support/total-upkeep/plugin-editor-backup/?source=plugin-editor-tools';
$video = 'https://www.youtube.com/embed/Nb0AFEXpE00?controls=1&autoplay=1&modestbranding=1&width=560&height=315&KeepThis=true&TB_iframe=true';
$this->links = '
' .
esc_html__( 'Learn More' ) .
'' .
esc_html__( 'Setup Guide' ) . '
';
}
}
admin/card/class-one-click-restoration.php 0000644 00000003103 14757772271 0014614 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: One_Click_Restoration.
*
* This class is responsible for rendering the "One Click Restoration" card.
* on this plugin's Premium Features Page.
*
* @since 1.13.0
*/
class One_Click_Restoration extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.13.0
*/
public function init() {
$this->id = 'bgbkup_one_click_restoration';
$this->title = esc_html__( 'One Click File Restorations', 'boldgrid-backup' );
$this->icon = '';
$this->footer = '
' .
esc_html__(
'Restore a single file within the backup browser. Helpful when modifying individual files.',
'boldgrid-backup'
) .
'
';
$url = 'https://www.boldgrid.com/support/total-upkeep/individual-file-restorations/?source=one-click-restore';
$video = 'https://www.youtube.com/embed/r2VCQ-9fQP8?controls=1&autoplay=1&modestbranding=1&width=560&height=315&KeepThis=true&TB_iframe=true';
$this->links = '
' .
esc_html__( 'Learn More' ) .
'' .
esc_html__( 'Setup Guide' ) . '
';
}
}
admin/card/class-history.php 0000644 00000003033 14757772271 0012104 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: History.
*
* This class is responsible for rendering the "History" card on this plugin's.
* Premium Features Page.
*
* @since 1.13.0
*/
class History extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.13.0
*/
public function init() {
$this->id = 'bgbkup_history';
$this->title = esc_html__( 'Update History', 'boldgrid-backup' );
$this->icon = '';
$this->footer = '
' .
esc_html__(
'View a running log of significant actions to your WordPress site, including which users updated a plugin, theme, or WordPress itself.',
'boldgrid-backup'
) .
'
';
$url = 'https://www.boldgrid.com/support/total-upkeep/backup-changed-files-history/?source=update-history';
$video = 'https://www.youtube.com/embed/kaeb30pYPYU?controls=1&autoplay=1&modestbranding=1&width=560&height=315&KeepThis=true&TB_iframe=true';
$this->links = '
' .
esc_html__( 'Learn More' ) .
'' .
esc_html__( 'Setup Guide' ) . '
';
}
}
admin/card/class-historical-versions.php 0000644 00000003070 14757772271 0014413 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Historical_Versions.
*
* This class is responsible for rendering the "Historical Versions" card on this.
* plugin's Premium Features Page.
*
* @since 1.13.0
*/
class Historical_Versions extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.13.0
*/
public function init() {
$this->id = 'bgbkup_historical_versions';
$this->title = esc_html__( 'Historical Versions', 'boldgrid-backup' );
$this->icon = '';
$this->footer = '
' .
esc_html__(
'Search through all backup archives for a particular, individual file and restore it.',
'boldgrid-backup'
) .
'
';
$url = 'https://www.boldgrid.com/support/total-upkeep/restore-historical-files/?source=historical-versions';
$video = 'https://www.youtube.com/embed/wGda86tdScg?controls=1&autoplay=1&modestbranding=1&width=560&height=315&KeepThis=true&TB_iframe=true';
$this->links = '
' .
esc_html__( 'Learn More' ) .
'' .
esc_html__( 'Setup Guide' ) . '
';
}
}
admin/card/class-google-drive.php 0000644 00000003051 14757772271 0012766 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Google Drive.
*
* This class is responsible for rendering the "Google drive" card on this.
* plugin's Premium Features Page.
*
* @since 1.13.0
*/
class Google_Drive extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.13.0
*/
public function init() {
$this->id = 'bgbkup_google_drive';
$this->title = esc_html__( 'Google Drive', 'boldgrid-backup' );
$this->icon = '
';
$this->footer = '
' .
esc_html__(
'Keep your backup archives safe and secure with remote, automated backups to Google Drive.',
'boldgrid-backup'
) .
'
';
$url = 'https://www.boldgrid.com/support/total-upkeep/auto-backup-to-google-drive/?source=google-drive';
$video = 'https://www.youtube.com/embed/p6I_xxo4TLo?controls=1&autoplay=1&modestbranding=1&width=560&height=315&KeepThis=true&TB_iframe=true';
$this->links = '
' .
esc_html__( 'Learn More' ) .
'' .
esc_html__( 'Setup Guide' ) . '
';
}
}
admin/card/class-find-modified-files.php 0000644 00000002122 14757772271 0014177 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Find Modified Files.
*
* @since 1.13.1
*/
class Find_Modified_Files extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.13.1
*/
public function init() {
$this->id = 'bgbkup_find_modified_files';
$this->title = esc_html__( 'Find Modified Files', 'boldgrid-backup' );
$this->icon = '';
$this->footer = '
' .
esc_html__(
'Search for all files modified within a certain time period. You can also look for other versions of that file within your backups.',
'boldgrid-backup'
) .
'
';
$url = esc_url( 'https://www.boldgrid.com/support/total-upkeep/additional-tools/' );
$this->links = '
' .
esc_html__( 'Setup Guide' ) . '
';
}
}
admin/card/class-dream-objects.php 0000644 00000003103 14757772271 0013120 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Dream_Objects.
*
* This class is responsible for rendering the "Dream Objects" card.
* on this plugin's Premium Features Page.
*
* @since 1.13.0
*/
class Dream_Objects extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.13.0
*/
public function init() {
$this->id = 'bgbkup_dream_objects';
$this->title = esc_html__( 'DreamObjects', 'boldgrid-backup' );
$this->footer = '
' .
esc_html__(
'Safely store backups in the cloud via DreamObjects by DreamHost. Compatible with automated backups feature.',
'boldgrid-backup'
) .
'
';
$url = 'https://www.boldgrid.com/support/total-upkeep/dreamobjects-storage/?source=dreamobjects';
$video = 'https://www.youtube.com/embed/fJXnMq5JYi8?controls=1&autoplay=1&modestbranding=1&width=560&height=315&KeepThis=true&TB_iframe=true';
$this->links = '
' .
esc_html__( 'Learn More' ) .
'' .
esc_html__( 'Setup Guide' ) . '
';
$this->icon = '
';
}
}
admin/card/class-database-encryption.php 0000644 00000003106 14757772271 0014340 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Encryption.
*
* This class is responsible for rendering the "Encryption" card on this plugin's Premium Features page.
*
* @since 1.13.0
*/
class Database_Encryption extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.13.0
*/
public function init() {
$this->id = 'bgbkup_database_encryption';
$this->title = esc_html__( 'Database Encryption', 'boldgrid-backup' );
$this->footer = '
' .
esc_html__(
'Provides another level of protection by preventing unauthorized access to your database backup archives.',
'boldgrid-backup'
) .
'
';
$url = 'https://www.boldgrid.com/support/total-upkeep/encrypt-database-backups/?source=encrypt-database-backups';
$video = 'https://www.youtube.com/embed/Pwxous6_LKg?controls=1&autoplay=1&modestbranding=1&width=560&height=315&KeepThis=true&TB_iframe=true';
$this->links = '
' .
esc_html__( 'Learn More' ) .
'' .
esc_html__( 'Setup Guide' ) . '
';
$this->icon = '
';
}
}
admin/card/class-backups.php 0000644 00000002134 14757772271 0012034 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Backups.
*
* This class is responsible for rendering the "Backups" card on this plugin's dashboard.
*
* @since 1.11.0
*/
class Backups extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.11.0
*/
public function init() {
$this->id = 'bgbkup_backups';
$this->title = esc_html__( 'Backups', 'boldgrid-backup' );
$this->subTitle = esc_html__( 'It\'s website insurance. Make sure you have a backup.', 'boldgrid-backup' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName
$this->icon = '';
$this->features = array(
new Feature\Scheduled_Backups(),
new Feature\Remote_Storage(),
);
if ( ! get_option( 'boldgrid_backup_settings' )['encrypt_db'] ) {
$this->features[] = new Feature\Database_Encryption();
}
}
}
admin/card/class-amazon-s3.php 0000644 00000003035 14757772271 0012215 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Card;
/**
* Class: Amazon_S3.
*
* This class is responsible for rendering the "Amazon S3" card on this plugin's Premium Features page.
*
* @since 1.13.0
*/
class Amazon_S3 extends \Boldgrid\Library\Library\Ui\Card {
/**
* Init.
*
* @since 1.13.0
*/
public function init() {
$this->id = 'bgbkup_amazon_s3';
$this->title = esc_html__( 'Amazon S3', 'boldgrid-backup' );
$this->footer = '
' .
esc_html__(
'Safely store backups in the cloud via Amazon S3. Compatible with automated remote backups feature.',
'boldgrid-backup'
) .
'
';
$url = 'https://www.boldgrid.com/support/total-upkeep/backup-wordpress-to-amazon-s3/?source=amazon-s3';
$video = 'https://www.youtube.com/embed/ZN0lab5ndhE?controls=1&autoplay=1&modestbranding=1&width=560&height=315&KeepThis=true&TB_iframe=true';
$this->links = '
' .
esc_html__( 'Learn More' ) .
'' .
esc_html__( 'Setup Guide' ) . '
';
$this->icon = '
';
}
}
admin/compressor/class-boldgrid-backup-admin-compressor-system-zip-test.php 0000644 00000016706 14757772271 0023311 0 ustar 00
*/
/**
* Class: Boldgrid_Backup_Admin_Compressor_System_Zip_Test
*
* @since 1.13.0
*/
class Boldgrid_Backup_Admin_Compressor_System_Zip_Test {
/**
* An instance of core.
*
* @since 1.13.0
* @access private
* @var Boldgrid_Backup_Admin_Core
*/
private $core;
/**
* An error message.
*
* @since 1.13.0
* @access private
* @var string
*/
private $error;
/**
* An array of files that will make up the self::filelist_filepath file.
*
* @since 1.13.0
* @access private
* @var array
*/
private $filelist = [];
/**
* A filepath to the file containing a list of files we will zip.
*
* @since 1.13.0
* @access private
* @var array
*/
private $filelist_filepath;
/**
* An array of files and folders that we will create.
*
* @since 1.13.0
* @access private
* @var array
*/
private $items;
/**
* A path to a directory we will be creating, filling with files, and zipping.
*
* @since 1.13.0
* @access private
* @var string
*/
private $test_dir;
/**
* A filepath to the zip we will be creating.
*
* @since 1.13.0
* @access private
* @var string
*/
private $zip_filepath;
/**
* Constructor.
*
* @since 1.13.0
*
* @param Boldgrid_Backup_Admin_Core $core
*/
public function __construct( Boldgrid_Backup_Admin_Core $core ) {
$this->core = $core;
$this->items = [
[
'type' => 'f',
'name' => 'file.txt',
],
[
'type' => 'd',
'name' => 'folder-empty',
],
[
'type' => 'd',
'name' => 'folder-1',
],
[
'type' => 'f',
'name' => 'folder-1/file-1.txt',
],
[
'type' => 'd',
'name' => 'folder-1/folder-1a',
],
[
'type' => 'd',
'name' => 'folder-1/folder-1a/folder-1a.txt',
],
];
$this->zip_filepath = $this->core->backup_dir->get_path_to( $this->core->test->test_prefix . 'system-zip-test.zip' );
$this->filelist_filepath = $this->core->backup_dir->get_path_to( $this->core->test->test_prefix . 'system-zip-filelist.txt' );
$this->test_dir = $this->core->backup_dir->get_path_to( $this->core->test->test_prefix . 'system-zip-test' );
}
/**
* Get our error message.
*
* @since 1.13.0
*
* @return string
*/
public function get_error() {
return $this->error;
}
/**
* Create and setup our test directory.
*
* We will be zipping up this directory.
*
* @since 1.13.0
*
* @return bool True on success.
*/
private function test_dir_create() {
// Create our test directory.
if ( ! $this->core->wp_filesystem->mkdir( $this->test_dir ) ) {
$this->error = sprintf(
// translators: 1 The name of a folder that could not be created.
esc_html__( 'Unable to create test directory: %1$s', 'boldgrid-backup' ),
$this->test_dir
);
return false;
}
// Create all the files. Abort if one could not be.
foreach ( $this->items as $item ) {
$created = false;
switch ( $item['type'] ) {
case 'd':
$created = $this->core->wp_filesystem->mkdir( $this->test_dir . DIRECTORY_SEPARATOR . $item['name'] );
break;
case 'f':
$created = $this->core->wp_filesystem->touch( $this->test_dir . DIRECTORY_SEPARATOR . $item['name'] );
break;
}
// Add this item to our filelist (a .txt file containing a list of files to backup).
$this->filelist[] = $item['name'];
// Above if we could not create a file.
if ( ! $created ) {
$this->error = sprintf(
// translators: 1 The name of a file that could not be created.
esc_html__( 'Unable to create test file: %1$s', 'boldgrid-backup' ),
$item['name']
);
return false;
}
}
// Save the filelist.
if ( ! $this->core->wp_filesystem->put_contents( $this->filelist_filepath, implode( PHP_EOL, $this->filelist ) ) ) {
$this->error = esc_html__( 'Unable to create filelist.txt', 'boldgrid-backup' );
return false;
}
return true;
}
/**
* Restore our test directory from zip and make sure everything was restored.
*
* @since 1.13.0
*
* @return bool True on success.
*/
private function test_dir_restore() {
// Delete the folder we zipped and make sure it's gone.
if ( ! $this->core->wp_filesystem->delete( $this->test_dir, true ) ) {
$this->error = esc_html__( 'Unable to delete test directory.', 'boldgrid-backup' );
return false;
}
// Create our test directory again.
if ( ! $this->core->wp_filesystem->mkdir( $this->test_dir ) ) {
$this->error = esc_html__( 'Unable to recreate test directory.', 'boldgrid-backup' );
return false;
}
// Move our zip file to our test directory.
if ( ! $this->core->wp_filesystem->move( $this->zip_filepath, $this->test_dir . DIRECTORY_SEPARATOR . basename( $this->zip_filepath ) ) ) {
$this->error = esc_html__( 'Unable to move zip to test directory.', 'boldgrid-backup' );
return false;
}
// Unzip.
$this->core->execute_command( 'cd ' . $this->test_dir . '; unzip ' . basename( $this->zip_filepath ) );
foreach ( $this->items as $item ) {
$path = $this->test_dir . DIRECTORY_SEPARATOR . $item['name'];
if ( ! $this->core->wp_filesystem->exists( $path ) ) {
$this->error = esc_html__( 'Unable to restore all files and folders.', 'boldgrid-backup' );
return false;
}
}
return true;
}
/**
* Zip up our test directory.
*
* @since 1.13.0
*
* @return bool True on success.
*/
private function test_dir_zip() {
// Zip everything up and make sure it worked.
$this->core->execute_command( 'cd ' . $this->test_dir . '; zip ' . $this->zip_filepath . ' -@ < ' . $this->filelist_filepath );
if ( ! $this->core->wp_filesystem->exists( $this->zip_filepath ) ) {
$this->error = esc_html__( 'Unable to create zip file.', 'boldgrid-backup' );
return false;
}
return true;
}
/**
* Determine if system_zip is working as expected.
*
* On average, this takes 0.019 seconds to complete.
*
* @since 1.13.0
*
* @param bool $force Whether to run this test or get results from transient.
* @return bool True on success.
*/
public function run( $force = false ) {
// Force a fresh test if we're on the preflight check page.
$force = Boldgrid_Backup_Admin_Utility::is_admin_page( 'boldgrid-backup-test' ) ? true : $force;
$pass = 1;
$transient_key = 'boldgrid_backup_system_zip_test';
$transient_value = get_transient( $transient_key );
if ( ! $force && false !== $transient_value ) {
return $transient_value;
}
// Before and after running the test, delete test files created.
$this->core->test->delete_test_files( $this->core->backup_dir->get() );
// This is the beef of the test, where we actually test things.
if ( ! $this->core->execute_command( '/usr/bin/zip -v ' ) ) {
$this->error = __( '/usr/bin/zip is not available.', 'boldgrid-backup' );
$pass = 0;
} elseif ( ! $this->test_dir_create() ) {
// Create our test directory.
$pass = 0;
} elseif ( ! $this->test_dir_zip() ) {
// Zip up our test directory.
$pass = 0;
} elseif ( ! $this->test_dir_restore() ) {
// Restore our test directory.
$pass = 0;
}
$this->core->test->delete_test_files( $this->core->backup_dir->get() );
set_transient( $transient_key, $pass, 24 * HOUR_IN_SECONDS );
return ! empty( $pass );
}
}
admin/compressor/class-boldgrid-backup-admin-compressor-system-zip-temp-folder.php 0000644 00000004715 14757772271 0024545 0 ustar 00
*/
/**
* Class: Boldgrid_Backup_Admin_Compressor_System_Zip_Temp_Folder
*
* @since 1.13.0
*/
class Boldgrid_Backup_Admin_Compressor_System_Zip_Temp_Folder {
/**
* An instance of core.
*
* @since 1.13.0
* @access private
* @var Boldgrid_Backup_Admin_Core
*/
private $core;
/**
* The name of the temporary folder where the compression will take place.
*
* @since 1.13.0
* @access private
* @var string
*/
private static $name = 'system-zip-temp';
/**
* Constructor.
*
* @since 1.13.0
*/
public function __construct() {
$this->core = apply_filters( 'boldgrid_backup_get_core', null );
}
/**
* Create the temp folder.
*
* @since 1.13.0
*
* @return bool True on success.
*/
public function create() {
return $this->core->wp_filesystem->mkdir( self::get_path() );
}
/**
* Delete the temp folder.
*
* @since 1.13.0
*
* @return bool True on success.
*/
public function delete() {
return $this->core->wp_filesystem->rmdir( self::get_path() );
}
/**
* Determine whether or not the system zip temp folder exists.
*
* @since 1.13.8
*
* @return bool
*/
public function exists() {
$path = self::get_path();
return $this->core->wp_filesystem->exists( $path );
}
/**
* Return a list of files in the system zip temp folder.
*
* @since 1.13.8
*
* @return array
*/
public function dirlist() {
$dirlist = array();
if ( $this->exists() ) {
$path = trailingslashit( self::get_path() );
$dirlist = $this->core->wp_filesystem->dirlist( $path );
$dirlist = empty( $dirlist ) ? array() : $dirlist;
/*
* When using WP_Filesystem, the key of each array element is the name of the file. For
* this method, we prefer the keys to be the full path to the file.
*/
foreach ( $dirlist as $filename => $data ) {
$dirlist[ $path . $filename ] = $data;
unset( $dirlist[ $filename ] );
}
}
return $dirlist;
}
/**
* Get the path to our temp folder.
*
* @since 1.13.0
*
* @return string
*/
public static function get_path() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
return $core->backup_dir->get_path_to( self::$name );
}
}
admin/compressor/class-boldgrid-backup-admin-compressor-system-zip.php 0000644 00000025207 14757772271 0022330 0 ustar 00
*/
/**
* Class: Boldgrid_Backup_Admin_Compressor_System_Zip
*
* @since 1.13.0
*/
class Boldgrid_Backup_Admin_Compressor_System_Zip extends Boldgrid_Backup_Admin_Compressor {
/**
* An error message.
*
* If we encounter an error while zipping, the error may be placed here - key phrase "may be placed
* here". At the introduction of this class property, it is being used in only one place. The entire
* class was not checked and tested to ensure all methods add any errors they run into here.
*
* @since SINCEVERSION
* @access private
* @var string
*/
private $error;
/**
* An array of files that should be archived.
*
* @since 1.13.0
* @access private
* @var array {
* An array of files.
*
* @type string 0 Path. Example: ""/home/user/public_html/readme.html".
* @type string 1 basename. Example: "readme.html".
* @type int 2 File size (in bytes). Example: "7413".
* @type string 3 File type. Examples: "d", "f".
* }
*/
private $filelist = [];
/**
* The filepath to our text file holding list of files to archive.
*
* @since 1.13.0
* @access private
* @var string
*/
private $filelist_path;
/**
* The filepath to the zip file.
*
* @since 1.13.0
* @access PRIVATE
* @var string
*/
private $filepath;
/**
* The temporary folder used when saving a zip file.
*
* @since 1.13.0
* @access private
* @var Boldgrid_Backup_Admin_Compressor_System_Zip_Temp_Folder
*/
private $temp_folder;
/**
* Key.
*
* @since 1.13.0
* @access protected
* @var string
*/
protected $key = 'system_zip';
/**
* Total Size Archived.
*
* @since 1.14.0
* @var int
*/
public $total_size_archived;
/**
* Default Compression Level.
*
* @since 1.14.0
* @var string
*/
public $default_compression_level = '6';
/**
* Constructor.
*
* @since 1.13.0
*/
public function __construct() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
parent::__construct( $core );
$this->temp_folder = new Boldgrid_Backup_Admin_Compressor_System_Zip_Temp_Folder();
}
/**
* Archive files.
*
* @since 1.5.1
*
* @see Boldgrid_Backup_Admin_Filelist::get_total_size()
*
* @param array $filelist {
* File details.
*
* @type string 0 Path. Example: ""/home/user/public_html/readme.html".
* @type string 1 basename. Example: "readme.html".
* @type int 2 File size (in bytes). Example: "7413".
* @type string 3 File type. Examples: "d", "f".
* }
* @param array $info {
* Data about the backup archive we are generating.
*
* @type string mode backup
* @type bool dryrun
* @type string compressor php_zip
* @type int filesize 0
* @type bool save 1
* @type int total_size 0
* }
* @return mixed True on success, an array on failure. This approach has been taken to follow the
* standards already set by the pcl-zip and php-zip classes.
*/
public function archive_files( $filelist, &$info ) {
if ( $info['dryrun'] ) {
return true;
}
// Prevent this process from ending; allow the archive to be completed.
ignore_user_abort( true );
set_time_limit( 0 );
$this->filelist = $filelist;
$this->filepath = $info['filepath'];
$this->filelist_create();
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'step', 3 );
$zip_success = $this->zip();
// @todo Simliar to the zip call above which returns a success status, so should zip_sql.
$this->zip_sql();
Boldgrid_Backup_Admin_In_Progress_Data::delete_arg( 'step' );
// Actions to take when we're all done / cleanup.
$this->core->wp_filesystem->delete( $this->filelist_path );
return true === $zip_success ? true : array(
'error' => $this->error,
);
}
/**
* Create the file containing a list of files to backup.
*
* @since 1.13.0
*/
private function filelist_create() {
$this->core->logger->add( 'Starting to create list of files to include in zip.' );
$this->core->logger->add_memory();
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'step', 2 );
$this->filelist_path = $this->core->backup_dir->get_path_to( 'system_zip_filelist-' . time() . '.txt' );
$this->total_size_archived = 0;
// Create the file list.
$filelist_array = [];
foreach ( $this->filelist as $file ) {
$filelist_array[] = str_replace( ABSPATH, '', $file[0] );
$this->total_size_archived += empty( $file[2] ) ? 0 : $file[2];
}
// Add some values for "In progress".
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'total_files_done', count( $this->filelist ) );
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'total_size_archived', $this->total_size_archived );
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'total_size_archived_size_format', size_format( $this->total_size_archived, 2 ) );
/*
* Remove our db_dump_filepath from the list.
*
* If we add it now, the zip file will include /home/user/boldgrid_backup/db.sql
*
* We'll add the sql separately in self::zip_sql().
*/
if ( ( $key = array_search( $this->core->db_dump_filepath, $filelist_array ) ) !== false ) { // phpcs:ignore
unset( $filelist_array[ $key ] );
}
$this->core->wp_filesystem->put_contents(
$this->filelist_path,
implode( PHP_EOL, $filelist_array )
);
$this->core->logger->add( 'Finished creating list of files to include in zip. ' . count( $filelist_array ) . ' files in zip.' );
$this->core->logger->add_memory();
}
/**
* Run the command to actually zip the files.
*
* @since 1.13.0
*
* @return bool True on success. Do note that $this->close() calls $this->zip_proc(), which will
* store any error messages in $this->error.
*/
private function zip() {
$this->core->logger->add( 'Starting to close the zip file.' );
$this->core->logger->add_memory();
$this->temp_folder->create();
$success = $this->close();
$this->temp_folder->delete();
$this->core->logger->add( 'Finished closing the zip file.' );
$this->core->logger->add_memory();
return $success;
}
/**
* Get Filelist Chunks.
*
* @since 1.14.0
*
* @return array Example https://pastebin.com/JsSEzNwA
*/
public function get_filelist_chunks() {
// Chunk size in bytes.
$max_chunk_size = 26214400;
$size_of_chunk = 0;
$filelist_chunks = array( array() );
$chunk_position = 0;
foreach ( $this->filelist as $file ) {
// Adds file to this chunk.
$filelist_chunks[ $chunk_position ][] = $file[1];
// Adds the most recent file's size to chunk size.
$size_of_chunk = $size_of_chunk + (int) $file[2];
// If the chunk size is >= the max chunk size, then move to next chunk.
if ( $size_of_chunk >= $max_chunk_size ) {
$chunk_position++;
$size_of_chunk = 0;
}
}
return $filelist_chunks;
}
/**
* Close.
*
* @since 1.14.0
*/
private function close() {
$chunks_closed = 0;
$filelist_chunks = $this->get_filelist_chunks();
$total_chunks = count( $filelist_chunks );
foreach ( $filelist_chunks as $filelist_chunk ) {
$chunk_start_time = microtime( true );
$success = $this->zip_proc( $filelist_chunk );
if ( ! $success ) {
return false;
}
// Process some stats.
$chunks_closed++;
$percent_complete = round( $chunks_closed / $total_chunks, 2 );
$chunk_end_time = microtime( true );
$close_duration = $chunk_end_time - $chunk_start_time;
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'percent_closed', $percent_complete );
// Add messages to the log.
$this->core->logger->add(
'Chunk closed in ' .
$close_duration .
' seconds. ' . $percent_complete * 100 .
'% complete closing'
);
$this->core->logger->add_memory();
}
return true;
}
/**
* Get Compression Level.
*
* @since 1.14.0
*
* @return string
*/
private function get_compression_level() {
$compression_level = $this->core->settings->get_setting( 'compression_level' );
return isset( $compression_level ) ? $compression_level : $this->default_compression_level;
}
/**
* Close Zip using proc_open.
*
* @since 1.14.0
*
* @param array $filelist_chunk Array of Files to be added.
* @return bool True on success.
*/
private function zip_proc( $filelist_chunk ) {
$has_error = false;
$descriptorspec = array(
0 => array( 'pipe', 'r' ), // stdin is a pipe that the child will read from.
1 => array( 'pipe', 'w' ), // stdout is a pipe that the child will write to.
/**
* Initially we sent errors to /tmp/error-output.txt. This caused warnings when the file
* was not writable. For any error messages, see $pipes[2] further down this method.
*/
2 => array( 'pipe', 'w' ),
);
$cwd = ABSPATH;
$compression_level = $this->get_compression_level();
$process = proc_open( //phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_proc_open
'zip -' . $compression_level . ' -g -q -@ ' . $this->filepath,
$descriptorspec,
$pipes,
$cwd
);
if ( is_resource( $process ) ) {
foreach ( $filelist_chunk as $file ) {
fwrite( $pipes[0], $file . "\n" ); //phpcs:ignore WordPress.WP.AlternativeFunctions
}
fclose( $pipes[0] ); //phpcs:ignore WordPress.WP.AlternativeFunctions
fclose( $pipes[1] ); //phpcs:ignore WordPress.WP.AlternativeFunctions
// Check for any errors.
$stderr = stream_get_contents( $pipes[2] );
fclose( $pipes[2] ); //phpcs:ignore WordPress.WP.AlternativeFunctions
if ( ! empty( $stderr ) ) {
$this->error = $stderr;
$this->core->logger->add( 'Error zipping files with system zip: ' . $stderr );
$has_error = true;
}
// It is important that you close any pipes before calling.
// proc_close in order to avoid a deadlock.
proc_close( $process );
} else {
$has_error = true;
}
return ! $has_error;
}
/**
* Add the .sql file individually.
*
* @since 1.13.0
*
* @see self::filelist_create
*/
private function zip_sql() {
$this->core->logger->add( 'Starting to add db dump to the zip file.' );
$this->core->logger->add_memory();
$dir = pathinfo( $this->core->db_dump_filepath, PATHINFO_DIRNAME );
$compression_level = $this->get_compression_level();
$this->core->execute_command( 'cd ' . $dir . '; zip -' . $compression_level . ' -g -q ' . $this->filepath . ' ' . basename( $this->core->db_dump_filepath ) . ';' );
$this->core->logger->add( 'Finished adding db dump to the zip file.' );
$this->core->logger->add_memory();
}
}
admin/compressor/class-boldgrid-backup-admin-compressor-php-zip.php 0000644 00000024347 14757772271 0021577 0 ustar 00
*/
/**
* Class: Boldgrid_Backup_Admin_Compressor_Php_Zip
*
* @since 1.5.1
*/
class Boldgrid_Backup_Admin_Compressor_Php_Zip extends Boldgrid_Backup_Admin_Compressor {
/**
* An array of directories we've added to the zip.
*
* @since 1.6.0
* @access public
* @var array
*/
public $dirs = array();
/**
* The status of our test result.
*
* @since 1.5.1
* @access public
* @var mixed|bool|null
*/
public static $test_result = null;
/**
* An array of any errors received while testing.
*
* @since 1.5.1
* @access public
* @var array
*/
public $test_errors = array();
/**
* An instance of ZipArchive.
*
* @since 1.5.1
* @var ZipArchive
*/
public $zip;
/**
* Key.
*
* @since 1.13.0
* @access protected
* @var string
*/
protected $key = 'php_zip';
/**
* Add a file's directories to the zip.
*
* When you add a file, the parent directories are not always explicitly
* created. For example, if you add wp-content/themes/pavilion/index.php the
* wp-content directory (and so forth) is not explicity added to the zip.
*
* @since 1.6.0
*
* @param string $file A file path.
*/
public function add_dir( $file ) {
$add_directory = '';
$dirs = explode( DIRECTORY_SEPARATOR, dirname( $file ) );
foreach ( $dirs as $key => $dir ) {
if ( 0 === $key ) {
$add_directory = $dir;
} else {
$add_directory .= '/' . $dir;
}
if ( ! in_array( $add_directory, $this->dirs, true ) ) {
$this->zip->addEmptyDir( $add_directory );
$this->dirs[] = $add_directory;
}
}
}
/**
* Archive files.
*
* @since 1.5.1
*
* @see Boldgrid_Backup_Admin_Filelist::get_total_size()
*
* @param array $filelist {
* File details.
*
* @type string 0 Path. Example: ""/home/user/public_html/readme.html".
* @type string 1 basename. Example: "readme.html".
* @type int 2 File size (in bytes). Example: "7413".
* @type string 3 File type. Examples: "d", "f".
* }
* @param array $info {
* Data about the backup archive we are generating.
*
* @type string mode backup
* @type bool dryrun
* @type string compressor php_zip
* @type int filesize 0
* @type bool save 1
* @type int total_size 0
* }
*/
public function archive_files( $filelist, &$info ) {
// Init vars used for our "in progress" bar.
$number_files_archived = 0;
$total_size_archived = 0;
$number_files_todo = count( $filelist );
$last_x_files = array();
if ( $info['dryrun'] ) {
return true;
}
// Prevent this process from ending; allow the archive to be completed.
ignore_user_abort( true );
set_time_limit( 0 );
$this->zip = new ZipArchive();
$status = $this->zip->open( $info['filepath'], ZipArchive::CREATE );
if ( ! $status ) {
return array(
'error' => 'Cannot open ZIP archive file "' . $info['filepath'] . '".',
'error_code' => $status,
'error_message' => Boldgrid_Backup_Admin_Utility::translate_zip_error( $status ),
);
}
$has_setexternalattributesname = method_exists( $this->zip, 'setExternalAttributesName' );
foreach ( $filelist as $fileinfo ) {
$is_dir = ! empty( $fileinfo[3] ) && 'd' === $fileinfo[3];
switch ( $is_dir ) {
case true:
$this->zip->addEmptyDir( $fileinfo[1] );
break;
case false:
if ( ! is_readable( $fileinfo[0] ) ) {
$info['backup_errors'][] = sprintf(
// translators: 1 The path to a file that was unable to be added to the backup.
__( 'Permission defined. Unable to add the following file to your backup: %1$s', 'boldgrid-backup' ),
$fileinfo[0]
);
continue 2;
} else {
$this->zip->addFile( $fileinfo[0], $fileinfo[1] );
$this->add_dir( $fileinfo[1] );
}
break;
}
/*
* ZipArchive::setExternalAttributesName() is avaiable in PHP >= 5.6.
* If available, use the method to set the permissions for items in the ZIP archive.
* By default, items in a ZIP file are extracted with loose (777/666) modes, which can
* cause issues on Linux systems using suEXEX/suPHP or other mechanisms requiring
* tighter (755/644; world non-writable permissions) modes on directories and files.
*/
if ( $has_setexternalattributesname ) {
$this->zip->setExternalAttributesName(
$is_dir ? $fileinfo[1] . '/' : $fileinfo[1],
ZipArchive::OPSYS_UNIX,
fileperms( $fileinfo[0] ) << 16
);
}
$number_files_archived++;
$total_size_archived += empty( $fileinfo[2] ) ? 0 : $fileinfo[2];
/*
* If applicable, add this file to the list of files archived that we show the user.
*
* To give the user a more broad sense of the files being added, our list only contains
* every 20th file.
*
* Our list is only 5 long because we make hook into the heartbeat every 5 seconds to grab
* the last 5 files, and we display each file for 1 second.
*/
if ( 0 === $number_files_archived % 20 ) {
$last_x_files[] = $fileinfo[1];
if ( count( $last_x_files ) > 5 ) {
array_shift( $last_x_files );
}
}
/*
* Update our "in progress" data.
*
* To prevent excessive calls to update options, we only update our in progress data every
* 100 files.
*/
$all_files_archived = $number_files_archived >= $number_files_todo;
if ( 0 === $number_files_archived % 100 || $all_files_archived ) {
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'total_files_done', $number_files_archived );
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'last_files', $last_x_files );
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'total_size_archived', $total_size_archived );
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'total_size_archived_size_format', size_format( $total_size_archived, 2 ) );
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'step', 2 );
}
}
$this->core->logger->add(
sprintf(
'Total files / size archived: %1$s / %2$s (%3$s)',
$number_files_archived,
$total_size_archived,
size_format( $total_size_archived, 2 )
)
);
/*
* We're done archiving all files.
*
* Empty out the "last files archived" data, and set an appropriate status.
*/
Boldgrid_Backup_Admin_In_Progress_Data::delete_arg( 'last_files' );
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'step', 3 );
/*
* Verify files before write/close. Delete any invalid file indicies in the ZIP index.
*
* In some scenarios, a file will be added above, but then deleted before the zip->close()
* call below. For example, while a backup is in progress, users may be editing pages and
* on save, cache files may get deleted. If the cache file was added to the zip above, and then
* deleted before the zip->close() below, we're going to have a problem.
*
* There is one file path outside of ABSPATH; the database dump file.
* The full path of each file is determined by checking if it is the dump file or not.
*
* @todo The user is not notified if a file is removed below.
*/
for ( $i = 0; $i < $this->zip->numFiles; $i++ ) {
$filename = $this->zip->getNameIndex( $i );
$filepath = false !== strpos( $this->core->db_dump_filepath, $filename ) ?
$this->core->db_dump_filepath : ABSPATH . $filename;
if ( ! $this->core->wp_filesystem->is_readable( $filepath ) ) {
$this->zip->deleteIndex( $i );
}
}
$this->core->logger->add( 'Starting to close the zip file.' );
$this->core->logger->add_memory();
$close = $this->zip->close();
$this->core->logger->add( 'Finished closing the zip file.' );
$this->core->logger->add_memory();
Boldgrid_Backup_Admin_In_Progress_Data::delete_arg( 'step' );
if ( ! $close ) {
return array(
'error' => 'Cannot close ZIP archive file "' . $info['filepath'] . '".',
);
}
return true;
}
/**
* Determine if ZipArchive is available.
*
* @since 1.5.2
*/
public static function is_extension_available() {
return extension_loaded( 'zip' ) && class_exists( 'ZipArchive' );
}
/**
* Test the functionality of php_zip.
*
* @since 1.5
*
* @return bool
*/
public function test() {
if ( null !== self::$test_result ) {
return self::$test_result;
}
$backup_dir = $this->core->backup_dir->get();
$test_file_contents = sprintf(
// translators: 1: Plugin title.
__( 'This is a test file from %1$s. You can delete this file.', 'boldgrid-backup' ),
BOLDGRID_BACKUP_TITLE
);
// translators: 1: A filename.
$cannot_open_zip = __( 'Unable to create zip file: %1$s', 'boldgrid-backup' );
// translators: 1: Backup directory path.
$cannot_close_zip = __( 'When testing ZipArchive functionality, we are able to create a zip file and add files to it, but we were unable to close the zip file.
Please be sure the following backup directory has modify permissions:
%1$s', 'boldgrid-backup' );
$safe_to_delete = __( 'safe-to-delete', 'boldgrid-backup' );
$test_zip_file = $this->core->test->test_prefix . '-zip';
$test_filename = sprintf( '%1$s%5$s%2$s-%3$s-%4$s', $backup_dir, $test_zip_file, mt_rand(), $safe_to_delete, DIRECTORY_SEPARATOR );
$zip_filepath = $test_filename . '.zip';
$random_filename = $test_filename . '.txt';
$zip = new ZipArchive();
$status = $zip->open( $zip_filepath, ZipArchive::CREATE );
if ( ! $status ) {
$this->test_errors[] = sprintf( $cannot_open_zip, $zip_filepath );
self::$test_result = false;
return false;
}
$this->core->wp_filesystem->touch( $random_filename );
$this->core->wp_filesystem->put_contents( $random_filename, $test_file_contents );
$zip->addFile( $random_filename, 'test.txt' );
$zip_closed = @$zip->close(); // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
$this->core->test->delete_test_files( $backup_dir );
if ( ! $zip_closed ) {
$this->test_errors[] = sprintf( $cannot_close_zip, $backup_dir );
self::$test_result = false;
return false;
}
self::$test_result = true;
return true;
}
}
admin/compressor/class-boldgrid-backup-admin-compressor-pcl-zip.php 0000644 00000037265 14757772271 0021571 0 ustar 00
*/
/**
* Class: Boldgrid_Backup_Admin_Compressor_Pcl_Zip
*
* @since 1.5.1
*/
class Boldgrid_Backup_Admin_Compressor_Pcl_Zip extends Boldgrid_Backup_Admin_Compressor {
/**
* An array of errors.
*
* @since 1.6.0
* @access public
* @var array
*/
public $errors = array();
/**
* The status of our test result.
*
* @since 1.5.1
* @access public
* @var mixed|bool|null
*/
public static $test_result = null;
/**
* An array of any errors received while testing.
*
* @since 1.5.1
* @access public
* @var array
*/
public $test_errors = array();
/**
* Key.
*
* @since 1.13.0
* @access proteced
* @var string
*/
protected $key = 'pcl_zip';
/**
* Constructor.
*
* @since 1.5.1
*
* @param Boldgrid_Backup_Admin_Core $core Boldgrid_Backup_Admin_Core object.
*/
public function __construct( $core ) {
if ( ! class_exists( 'PclZip' ) ) {
require_once ABSPATH . '/wp-admin/includes/class-pclzip.php';
}
parent::__construct( $core );
}
/**
* Add empty directories to current directory we're browsing.
*
* This method is used by this->browse, and it's whole reason for existence
* is because ZipArchive gives you the ability to simply add a directory to
* the archive, but PclZip does not.
*
* If PclZip archive only includes one file, such as
* wp-content/plugins/boldgrid/index.php, we need to "artificially" create
* these directories for the zip browser:
* # wp-content/
* # wp-content/plugins/
* # wp-content/plugins/boldgrid/
*
* @since 1.6.0
*
* @param array $list A list of files.
* @param array $contents Contents; not used here.
* @param array $filenames Filenames.
* @param string $in_dir Current directory.
* @return array An updated $contents.
*/
public function browse_add_dirs( $list, $contents, $filenames, $in_dir ) {
foreach ( $list as $key => $file ) {
// These variables are very similar, both exist for readability.
$top_dir = null;
$next_dir = null;
if ( '.' === $in_dir ) {
$top_dir = explode( '/', $file['filename'] );
$top_dir = $top_dir[0];
if ( empty( $top_dir ) || in_array( $top_dir, $filenames, true ) ) {
continue;
}
} else {
/*
* Determine if file is in directory.
*
* For example, We want to know if file wp-admin/user/about is
* in wp-content/
*/
$file_in_dir = 0 === strpos( $file['filename'], $in_dir . '/' );
if ( ! $file_in_dir ) {
continue;
}
/*
* Calcular our next directory.
*
* If we're looking for all folders within wp-content/plugins
* and we're given a filename of
* wp-content/plugins/boldgrid/index.php, then we can say that
* wp-content/plugins/boldgrid exists in wp-content/plugins.
*/
$next_dir = str_replace( $in_dir . '/', '', $file['filename'] );
$next_dir = explode( '/', $next_dir );
$next_dir = $in_dir . '/' . $next_dir[0];
if ( $next_dir === $file['filename'] || in_array( $next_dir, $filenames, true ) ) {
continue;
}
}
$dir = ! empty( $top_dir ) ? $top_dir : $next_dir;
$sudo_file = array(
'filename' => $dir,
'folder' => true,
);
$contents[] = $sudo_file;
$filenames[] = $dir;
}
return $contents;
}
/**
* Archive files.
*
* @since 1.5.1
*
* @see Boldgrid_Backup_Admin_Filelist::get_total_size()
*
* @param array $filelist File list.
* @param array $info {
* An array of data about the backup archive we are generating.
*
* @type string mode backup
* @type bool dryrun
* @type string compressor php_zip
* @type ing filesize 0
* @type bool save 1
* @type int total_size 0
* }
*/
public function archive_files( $filelist, &$info ) {
if ( $info['dryrun'] ) {
return true;
}
$cwd = $this->wp_filesystem->cwd();
$archive = new PclZip( $info['filepath'] );
if ( 0 === $archive ) {
return array(
'error' => sprintf( 'Cannot create ZIP archive file %1$s. %2$s.', $info['filepath'], $archive->errorInfo() ),
);
}
// Prevent this process from ending; allow the archive to be completed.
ignore_user_abort( true );
set_time_limit( 0 );
/*
* Create our $new_filelist.
*
* We can pass $archive->add() an array of files to archive. $filelist
* is an array of arrays, so we need to convert to simply an array of
* strings (filenames to archive).
*/
$total_size_archived = 0;
$new_filelist = [];
foreach ( $filelist as $file ) {
// Don't add the database dump at this time, it will be added later.
if ( ! empty( $this->core->db_dump_filepath ) && $file[0] === $this->core->db_dump_filepath ) {
continue;
}
$total_size_archived += empty( $file[2] ) ? 0 : $file[2];
$new_filelist[] = $file[0];
}
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'step', 3 );
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'total_size_archived', $total_size_archived );
Boldgrid_Backup_Admin_In_Progress_Data::set_arg( 'total_size_archived_size_format', size_format( $total_size_archived, 2 ) );
$status = $archive->add(
$new_filelist,
PCLZIP_OPT_REMOVE_PATH, ABSPATH
);
if ( 0 === $status ) {
$error_info = $archive->errorInfo();
$custom_error = $this->parse_error_info( $error_info );
if ( false === $custom_error ) {
return array(
'error' => sprintf( 'Cannot add files to ZIP archive file: %1$s', $archive->errorInfo() ),
);
} else {
return array(
'error' => $custom_error,
);
}
}
/*
* Add our database dump to the zip.
*
* The check for ! empty is here because the user may have opted not
* to backup their database.
*/
if ( ! empty( $this->core->db_dump_filepath ) ) {
$status = $archive->add( $this->core->db_dump_filepath, PCLZIP_OPT_REMOVE_ALL_PATH );
if ( 0 === $status ) {
return array(
'error' => sprintf( 'Cannot add database dump to ZIP archive file: %1$s', $archive->errorInfo() ),
);
}
}
Boldgrid_Backup_Admin_In_Progress_Data::delete_arg( 'step' );
$this->wp_filesystem->chdir( $cwd );
return true;
}
/**
* Get the contents of a zip file.
*
* @param string $filepath File path.
* @param string $in_dir Current directory.
* @return array
*/
public function browse( $filepath, $in_dir = '.' ) {
$in_dir = untrailingslashit( $in_dir );
/*
* Keep track of the contents of the directory we're trying to browse.
*
* This variable is different than the below $filenames variable because
* $contents contains an array arrays (info ABOUT each filename) while
* $filenames just contains either the file or folder name.
*/
$contents = array();
/*
* Keep track of just file and folder names added to the $contents. For
* example:
*
* [0] wp-content (folder)
* [1] wp-content/index.php (file)
*/
$filenames = array();
$zip = new PclZip( $filepath );
$list = $zip->listContent();
if ( empty( $list ) ) {
return $contents;
}
/*
* Each $file is an array. Several example $file's can be seen here:
* https://pastebin.com/bjQZYcAt
*/
foreach ( $list as $key => $file ) {
/*
* Calculate the parent directory this file / folder belongs to.
*
* Examples:
* * readme.html = .
* * wp-admin/press-this.php = wp-admin
* * wp-admin/js/user-profile.min.js = wp-admin/js
*/
$parent_dir = dirname( $file['filename'] );
if ( $parent_dir !== $in_dir ) {
continue;
}
$contents[] = $file;
$filenames[] = rtrim( $file['filename'], '/' );
}
$contents = $this->browse_add_dirs( $list, $contents, $filenames, $in_dir );
return $contents;
}
/**
* Extract one file from an archive.
*
* @since 1.5.3
*
* @param string $filepath Archive path, such as "/home/user/boldgrid_backup/archive.zip".
* @param string $file A file path in the archive file, such as "wp-content/index.php".
* @return bool
*/
public function extract_one( $filepath, $file ) {
if ( ! $this->core->archive->is_archive( $filepath ) ) {
$this->errors[] = __( 'Not an archive.', 'boldgrid-backup' );
return false;
}
if ( empty( $file ) ) {
$this->errors[] = __( 'Empty file.', 'boldgrid-backup' );
return false;
}
$file_contents = $this->get_file( $filepath, $file );
if ( empty( $file_contents ) ) {
$this->errors[] = __( 'Unable to extract single file from archive.', 'boldgrid-backup' );
return false;
}
// Make sure the file's dir exists, write the file, and adjust the timestamp.
$file_abspath = ABSPATH . $file;
wp_mkdir_p( dirname( $file_abspath ) );
$written = $this->core->wp_filesystem->put_contents( $file_abspath, $file_contents[0]['content'] );
if ( ! $written ) {
$this->errors[] = __( 'Not written.', 'boldgrid-backup' );
return false;
}
return $this->core->wp_filesystem->touch( ABSPATH . $file, $file_contents[0]['mtime'] );
}
/**
* Extract 1 file from a zip archive.
*
* @since 1.5.3
*
* @param string $filepath Archive path, such as "/home/user/boldgrid_backup/archive.zip".
* @param string $file A file path in the archive file, such as "wp-content/index.php".
* @return mixed False on failure, array on success {
* Accessed via $file_contents[0].
*
* @type string $filename wp-content/index.php
* @type string $stored_filename wp-content/index.php
* @type int $size 28
* @type int $compressed_size 30
* @type int $mtime 1505997200
* @type string $comment
* @type bool $folder
* @type int $index 25054
* @type string $status ok
* @type int $crc 4212199498
* @type string $content
* }
*/
public function get_file( $filepath, $file ) {
if ( ! $this->core->archive->is_archive( $filepath ) ) {
return false;
}
if ( empty( $file ) ) {
return false;
}
$zip = new PclZip( $filepath );
$list = $zip->listContent();
if ( empty( $list ) ) {
return false;
}
$file_index = false;
foreach ( $list as $index => $filedata ) {
if ( $file === $filedata['filename'] ) {
$file_index = $index;
}
}
/*
* We use to check if(! $file_index) however sometimes the file we want
* is at the 0 index.
*/
if ( false === $file_index ) {
return false;
}
$file_contents = $zip->extractByIndex( $file_index, PCLZIP_OPT_EXTRACT_AS_STRING );
/*
* Ensure the mtime is UTC.
*
* mtime can vary based upon how the archive was initially created (php_zip
* or pcl_zip). Make sure it is in UTC.
*/
$this->core->archive->init( $filepath );
$this->core->time->init( $file_contents[0]['mtime'], $this->core->archive->compressor );
$file_contents[0]['mtime'] = $this->core->time->utc_time;
return $file_contents;
}
/**
* Get a list of all sql dumps in an archive's root.
*
* When restoring an archive, this method is helpful in determining which
* sql dump to restore. We're expecting only 1 to be found.
*
* @since 1.5.2
*
* @param string $filepath Full path to zip file.
* @return array An array of sql dumps found in the root.
*/
public function get_sqls( $filepath ) {
$sqls = array();
$zip = new PclZip( $filepath );
$list = $zip->listContent();
if ( empty( $list ) ) {
return $sqls;
}
foreach ( $list as $key => $file ) {
$filename = $file['filename'];
// If it's not in the root, skip it.
if ( false !== strpos( $filename, '/' ) || false !== strpos( $filename, '\\' ) ) {
continue;
}
// If it's not in this format, skip it - Format: "*.########-######.sql".
if ( 1 !== preg_match( '/\.[\d]+-[\d]+\.sql$/', $filename ) ) {
continue;
}
$sqls[] = $filename;
}
return $sqls;
}
/**
* Parse the error message and take appropriate action.
*
* @since 1.5.2
*
* @param string $error_info Error message.
* @return mixed False when no messages should be displayed, String when
* returning a message to the user.
*/
public function parse_error_info( $error_info ) {
$parts = explode( '\'', $error_info );
$force_php_zip = false;
$messages = array();
// Does not exist [code -4].
if ( ! empty( $parts[2] ) && false !== strpos( $parts[2], 'code -4' ) ) {
$path = ABSPATH . $parts[1];
// Check for broken symlink.
if ( is_link( $path ) && ! $this->core->wp_filesystem->exists( $path ) ) {
$force_php_zip = true;
// translators: 1: File path.
$messages[] = sprintf( __( 'PclZip encountered the following broken symlink and is unable to create a backup:
%1$s', 'boldgrid-backup' ), $parts[1] );
}
}
/*
* If we have flagged that ZipArchive should be used instead of PclZip,
* then update the settings.
*/
if ( $force_php_zip ) {
$php_zip_set = $this->core->compressors->set_php_zip();
if ( $php_zip_set ) {
$messages[] = __( 'We have changed your compressor from PclZip to ZipArchive. Please try to create a backup again.' );
}
}
return empty( $messages ) ? false : implode( '
', $messages );
}
/**
* Test the functionality of php_zip.
*
* @since 1.5
*
* @param bool $display_errors Display errors; default is TRUE.
* @return bool
*/
public function test( $display_errors = true ) {
if ( null !== self::$test_result ) {
return self::$test_result;
}
$backup_dir = $this->core->backup_dir->get();
// Strings to help with creating test files.
$test_file_contents = sprintf(
// translators: 1: Plugin title.
__( 'This is a test file from %1$s. You can delete this file.', 'boldgrid-backup' ),
BOLDGRID_BACKUP_TITLE
);
$safe_to_delete = __( 'safe-to-delete', 'boldgrid-backup' );
$test_zip_file = $this->core->test->test_prefix . '-zip';
$test_filename = sprintf(
'%1$s%5$s%2$s-%3$s-%4$s',
$backup_dir,
$test_zip_file,
mt_rand(),
$safe_to_delete,
DIRECTORY_SEPARATOR
);
$zip_filepath = $test_filename . '.zip';
$random_filename = $test_filename . '.txt';
// translators: 1: File path.
$cannot_touch_file = __(
'PclZip test failed. We were unable to create the following test file:
%1$s.
Please ensure your backup directory has read, write, and modify permissions.',
'boldgrid-backup'
);
// translators: 1: File path.
$cannot_put_contents = __(
'PclZip test failed. We were able to create the following test file, but we were unable to modify it. were unable to modify it:
%1$s
Please ensure your backup directory has read, write, and modify permissions.',
'boldgrid-backup'
);
$touched = $this->core->wp_filesystem->touch( $random_filename );
if ( ! $touched ) {
$this->test_errors[] = sprintf( $cannot_touch_file, $random_filename );
self::$test_result = false;
return false;
}
$contents_put = $this->core->wp_filesystem->put_contents( $random_filename, $test_file_contents );
if ( ! $contents_put ) {
$this->test_errors[] = sprintf( $cannot_put_contents, $random_filename );
self::$test_result = false;
return false;
}
$archive = new PclZip( $zip_filepath );
if ( 0 === $archive ) {
$this->test_errors[] = sprintf( 'Cannot create ZIP archive file %1$s. %2$s.', $info['filepath'], $archive->errorInfo() );
}
$status = $archive->add( $random_filename );
if ( 0 === $status ) {
$this->test_errors[] = sprintf( 'Cannot add files to PclZip archive file: %1$s', $archive->errorInfo() );
}
$this->core->test->delete_test_files( $backup_dir );
self::$test_result = true;
return true;
}
}
admin/cron/entry/class-wpcron.php 0000644 00000003072 14757772271 0013107 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Cron\Entry;
use Boldgrid\Backup\Admin\Cron\Entry\Entry;
use Boldgrid\Backup\Admin\Cron\Entry\Base;
/**
* Class: Entry
*
* @since 1.11.0
*/
class Wpcron extends Base implements Entry {
/**
* The hook this wpcron uses.
*
* @since 1.11.0
* @access private
* @var string
*/
private $hook;
/**
* Whether or not this wpcron is set / configured within the wpcron system.
*
* @since 1.11.0
* @access private
* @var bool
*/
private $is_set;
/**
* Get the next runtime of this wpcron.
*
* @since 1.11.0
*
* @return string Timestamp, the time the scheduled event will next occur (unix timestamp).
* False, if the event isn't scheduled.
*/
public function get_next_runtime() {
return wp_next_scheduled( $this->hook );
}
/**
* Initialize this wpcron entry.
*
* @since 1.11.0
*
* @param string $hook
*/
public function init_via_search( array $patterns = [] ) {
$this->is_set = false;
$this->hook = $patterns[0];
$schedule = wp_get_schedule( $this->hook );
if ( ! empty( $schedule ) ) {
$this->is_set = true;
}
}
/**
* Get whether or not this wpcron entry exists.
*
* @since 1.11.0
*
* @return bool
*/
public function is_set() {
return $this->is_set;
}
}
admin/cron/entry/class-entry.php 0000644 00000000771 14757772271 0012743 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Cron\Entry;
/**
* Class: Entry
*
* @since 1.11.0
*/
interface Entry {
public function get_next_runtime();
public function init_via_search( array $patterns = [] );
public function is_set();
}
admin/cron/entry/class-crontab.php 0000644 00000006332 14757772271 0013231 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Cron\Entry;
use Boldgrid\Backup\Admin\Cron\Entry\Entry;
use Boldgrid\Backup\Admin\Cron\Entry\Base;
/**
* Class: Crontab Entry.
*
* @since 1.11.0
*/
class Crontab extends Base implements Entry {
/**
* Our cron entry's command.
*
* Given the following entry:
* "* * * * * COMMAND"
*
* This property is the "COMMAND" part.
*
* @since 1.11.0
* @access private
* @var string
*/
private $command;
/**
* Whether or not this cron exists in the crontab.
*
* @since 1.11.0
* @access private
* @var bool
*/
private $is_set;
/**
* The cron's entire command.
*
* Given the following entry:
* "* * * * * COMMAND"
*
* The raw command is the entire string, "* * * * * COMMAND".
*
* @since 1.11.0
* @access private
* @var string
*/
private $raw_command;
/**
* The time defined for the cron.
*
* Given the following entry:
* "* * * * * COMMAND"
*
* The time is the "* * * * *" part.
*
* @since 1.11.0
* @access private
* @var string
*/
private $time;
/**
* An instance of Boldgrid\Backup\Admin\Cron\Crontab.
*
* @since 1.11.0
* @access private
* @var Boldgrid\Backup\Admin\Cron\Crontab
*/
private $engine;
/**
*
*/
public function __construct() {
$this->engine = new \Boldgrid\Backup\Admin\Cron\Crontab();
}
/**
* Get our cron's next runtime.
*
* @since 1.11.0
*
* @return string The unix timestamp (UTC) of when this cron will run next.
*/
public function get_next_runtime() {
$core = apply_filters( 'boldgrid_backup_get_core', null );
require_once BOLDGRID_BACKUP_PATH . '/vendor/boldgrid/tdcron/class.tdcron.php';
require_once BOLDGRID_BACKUP_PATH . '/vendor/boldgrid/tdcron/class.tdcron.entry.php';
/*
* Get our next runtime.
*
* Cron jobs are configured to run on the server's timezone, not UTC. Therefore, our next
* runtime will be server time.
*/
$next_runtime = \tdCron::getNextOccurrence( $this->time );
/*
* Initialize our time class with our $next_runtime, and specify the time is in the server's
* timezone (local).
*/
$core->time->init( $next_runtime, 'local' );
return $core->time->utc_time;
}
/**
* Init this cron entry.
*
* @since 1.11.0
*
* @return mixed
*/
public function init_via_search( array $patterns = [] ) {
$this->is_set = false;
$matched_crons = $this->engine->find_crons( $patterns );
if ( 1 === count( $matched_crons ) ) {
$this->raw_command = $matched_crons[0];
$exploded_command = explode( ' ', trim( $this->raw_command ) );
$time = array_slice( $exploded_command, 0, 5 );
$this->time = implode( ' ', $time );
$command = array_splice( $exploded_command, 5 );
$this->command = implode( ' ', $command );
$this->is_set = true;
}
}
/**
* Whether or not this cron entry exists in the crontab.
*
* @since 1.11.0
*
* @return bool
*/
public function is_set() {
return $this->is_set;
}
}
admin/cron/entry/class-base.php 0000644 00000001637 14757772271 0012516 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Cron\Entry;
use Boldgrid\Backup\Admin\Cron\Entry\Entry;
/**
* Class: Entry
*
* @since 1.11.0
*/
class Base implements Entry {
/**
* Get our cron entry's next runtime.
*
* @since 1.11.0
*
* @return bool
*/
public function get_next_runtime() {
return false;
}
/**
* Initialize our cron entry.
*
* @since 1.11.0
*
* @return bool
*/
public function init_via_search( array $patterns = [] ) {
return false;
}
/**
* Get whether or not our cron entry exists in the cron engine.
*
* @since 1.11.0
*
* @return boolean
*/
public function is_set() {
return false;
}
}
admin/cron/class-crontab.php 0000644 00000005533 14757772271 0012072 0 ustar 00
*/
namespace Boldgrid\Backup\Admin\Cron;
/**
* Class: Crontab
*
* @since 1.11.0
*/
class Crontab {
/**
* Boldgrid_Backup_Admin_Core object.
*
* @since 1.11.1
* @access private
*
* @var Boldgrid_Backup_Admin_Core
*/
private $core;
/**
* Constructor.
*
* @since 1.11.1
*/
public function __construct() {
$this->core = apply_filters( 'boldgrid_backup_get_core', null );
}
/**
* Search for cron entries.
*
* This method is similar to the Boldgrid_Backup_Admin_Cron::entry_search() method, except it
* accepts an array of patterns to search for, rather than just one.
*
* @since 1.11.0
*
* @param array $patterns An array of patterns to search for. All patterns must be found in
* order to return a cron entry as a match.
* @return array An array of crons.
*/
public function find_crons( array $patterns = [] ) {
$all_crons = $this->core->cron->get_all( false );
$all_crons = false === $all_crons ? array() : $all_crons;
$matched_crons = [];
foreach ( $all_crons as $cron ) {
$all_patterns_found = true;
foreach ( $patterns as $pattern ) {
if ( false === strpos( $cron, $pattern ) ) {
$all_patterns_found = false;
}
}
if ( $all_patterns_found ) {
$matched_crons[] = $cron;
}
}
return $matched_crons;
}
/**
* Write to the system crontab.
*
* The crontab contents will be replaced with the string passed to this method.
*
* @since 1.11.1
*
* @param string $crontab The crontab contents to be written.
* @return bool
*/
public function write_crontab( $crontab ) {
$backup_directory = $this->core->backup_dir->get();
if ( ! $this->core->wp_filesystem->is_writable( $backup_directory ) ) {
return false;
}
// Strip extra line breaks.
$crontab = str_replace( "\n\n", "\n", $crontab );
// Trim the crontab.
$crontab = trim( $crontab );
// Add a line break at the end of the file.
$crontab .= "\n";
// Save the temp crontab to file.
$temp_crontab_path = $backup_directory . '/crontab.' . microtime( true ) . '.tmp';
// Save a temporary file for crontab.
$this->core->wp_filesystem->put_contents( $temp_crontab_path, $crontab, 0600 );
// Check if the defaults file was written.
if ( ! $this->core->wp_filesystem->exists( $temp_crontab_path ) ) {
return false;
}
// Write crontab.
$command = 'crontab ' . $temp_crontab_path;
$this->core->execute_command( $command, $success );
// Remove temp crontab file.
$this->core->wp_filesystem->delete( $temp_crontab_path, false, 'f' );
return (bool) $success;
}
}
admin/css/boldgrid-backup-admin-zip-browser.css 0000644 00000001072 14757772271 0015561 0 ustar 00 .listing .dashicons.dashicons-portfolio {
color: #c4963d;
}
.listing .dashicons.dashicons-media-default {
color: #0073aa;
}
.listing a,
a.restore-db,
a.view-db,
a.load-browser,
.breadcrumbs a {
cursor: pointer;
}
.breadcrumbs .dashicons.dashicons-admin-home {
vertical-align: text-bottom;
}
.file-actions > td {
padding-left:35px;
}
/* Mimic postbox toggle arrows. These generally are in the last thead th. */
.bulk-action-notice .toggle-indicator {
float: right;
cursor: pointer;
}
.bulk-action-notice .toggle-indicator.closed:before {
content: "\f140";
} admin/css/boldgrid-backup-admin-test.css 0000644 00000001513 14757772271 0014255 0 ustar 00 .functionality-test-section table {
border-collapse: collapse;
}
.functionality-test-section table tr {
border: 1px solid #ddd;
}
.functionality-test-section table tr td {
padding: 5px 10px;
vertical-align: top;
}
.functionality-test-section table tr td h2 {
margin-bottom: 5px;
margin-top: 30px;
}
/* The first tr will be the status (pass/fail) */
.functionality-test-section table tr:first-of-type {
background: none;
border: none;
font-weight: bold;
}
/* Highlight errors and warnings. */
.wp-list-table .error {
color: #dc3232;
font-weight: bold;
}
.wp-list-table .warning {
color: #ffba00;
font-weight: bold;
}
.wp-list-table .success {
color: green;
font-weight: bold;
}
.functionality-test-section tr.heading {
border: 0px;
background: transparent;
}
.functionality-test-section pre {
white-space: pre-line;
} admin/css/boldgrid-backup-admin-settings.css 0000644 00000001506 14757772271 0015140 0 ustar 00 /* If a day of the week checkbox is disabled, modify its hover cursor. */
.schedule-dow input[type='checkbox'][disabled]:hover {
cursor: not-allowed;
}
.form-table tr td p {
padding: 5px 0px;
margin: 0px;
}
.bgb-unbold {
font-weight: normal;
}
#auto-recovery-tr {
display: none;
}
/**
* Auto Update Styles
*/
.auto-update-settings.form-table .table-help td,
.auto-update-settings.form-table .table-help td p {
padding: 0;
padding-left: 5px;
}
.form-table .bglib-divider {
border-bottom: 1px solid #e2e4e7;
}
#section_auto_updates .form-table th {
width: auto;
}
.auto-update-settings.form-table td {
padding: 5px 5px;
}
.auto-update-settings .toggle.right {
float: right;
}
.auto-update-settings input[type="number"] {
width: 5em;
}
.auto-update-settings .help-icon {
vertical-align: middle;
padding-left: 0.25em;
} admin/css/boldgrid-backup-admin-premium.css 0000644 00000003554 14757772271 0014763 0 ustar 00 /**
* Style for specific premium feature cards.
*/
#bgbkup_amazon_s3 .bglib-card-icon {
border-top-color: #feb424;
}
#bgbkup_database_encryption .bglib-card-icon {
border-top-color: #aaa;
}
#bgbkup_dream_objects .bglib-card-icon {
border-top-color: #3e95be;
}
#bgbkup_backups .bglib-card-icon {
border-top-color: #0073aa;
}
#bgbkup_google_drive .bglib-card-icon {
border-top-color: #1ba160;
}
#bgbkup_amazon .bglib-card-icon {
border-top-color: #feb424;
}
#bgbkup_dream_objects .bglib-card-icon {
border-top-color: #3e95be;
}
#bgbkup_history .bglib-card-icon {
color: #f04207;
border-top-color: #f04207;
}
#bgbkup_historical_versions .bglib-card-icon {
color: #9ebaa0;
border-top-color: #9ebaa0;
}
#bgbkup_plugin_editor_tools .bglib-card-icon {
color: #5d824b;
border-top-color: #5d824b;
}
#bgbkup_backups .bglib-card-icon .dashicons {
color: #0073aa;
}
#bgbkup_updates .bglib-card-icon {
border-top-color: #aa0073;
}
#bgbkup_updates .bglib-card-icon .dashicons {
color: #aa0073;
}
#bgbkup_one_click_restoration .bglib-card-icon {
color: #c604c6;
border-top-color: #c604c6;
}
#bgbkup_get_premium .bglib-card-icon {
border-top-color: #f95b26;
}
#bgbkup_get_premium .bglib-card-icon .dashicons {
color: #f95b26;
}
/**
* Misc.
*/
/* The get premium button in the top notice. */
.bglib-card {
display: flex;
flex-direction: column;
}
.bglib-card-icon {
height: 60px;
}
.bg-box-bottom.premium .button-success {
float: none;
}
.bglib-card-footer {
flex-grow: 10;
}
.bglib-card-links {
flex-grow: 1;
}
.bglib-card-links a {
margin: 1em;
}
.bg-box-title {
font-size: 1.25em;
font-weight: 600;
}
.bglib-card-title {
height: 2em;
}
.bglib-card-links span.dashicons {
vertical-align: text-top;
padding-right: 0.25em;
}
.bglib-card .bglib-card-links {
justify-content: flex-end;
}
.bglib-smaller .bglib-card-links a.button {
margin-right: 10px;
} admin/css/boldgrid-backup-admin-new-thickbox-style.css 0000644 00000001066 14757772271 0017041 0 ustar 00 /**
* Thickbox styles.
*
* Thickbox appears when user clicks "View details" for a backup. These styles
* make the standard thickbox look more like the modal of a plugin's
* "View details" link.
*/
body #TB_window,
#TB_window #TB_title {
background-color: rgba(0, 0, 0, 0);
border: 0px;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
#TB_closeAjaxWindow #TB_closeWindowButton {
right: -29px;
top: 30px;
}
#TB_closeAjaxWindow .tb-close-icon:before {
font: normal 30px/30px dashicons;
color: #eee;
}
#TB_ajaxContent {
background: #fff;
} admin/css/boldgrid-backup-admin-home.css 0000644 00000000520 14757772271 0014223 0 ustar 00 #upload-archive-section .spinner {
display: none;
float: none !important;
}
.upload-plugin .help {
background: none;
padding-top: 0px;
padding-bottom: 0px;
border: 0px;
}
/* Disable floating of mine count so help section displays nicely. */
.subsubsub {
float: none;
}
.page-title-actions {
display: inline-block;
}
admin/css/boldgrid-backup-admin-hide-all.css 0000644 00000001005 14757772271 0014751 0 ustar 00 /**
* Hide all but content.
*
* This set of styles hides everything on the page except for what the plugin
* displays. This helps make the page look better in an iframe / modal.
*/
.boldgrid-backup-in-progress,
.update-nag,
#adminmenumain,
[id$="-tgmpa"],
#wpadminbar,
#wpfooter {
display: none;
}
#wpwrap {
position: absolute;
top: 0px;
left: 0px;
}
#wpwrap #wpcontent {
margin: 0px; !important;
padding-left: 10px; !important;
padding-right: 10px; !important;
}
#wpbody-content {
padding-bottom: 0px;
}
admin/css/boldgrid-backup-admin-ftp-settings.css 0000644 00000000141 14757772271 0015721 0 ustar 00 table [type="text"],
table [type="password"] {
width: 100%;
}
[type="number"] {
width: 75px;
} admin/css/boldgrid-backup-admin-folder-exclude.css 0000644 00000003570 14757772271 0016205 0 ustar 00 /**
* This section contains code for the "Exclude Folder" interface on the Settings
* page.
*/
.folder_exclude_help tr th {
vertical-align: top;
width: 70px;
}
.folder_exclude_help tr th,
.folder_exclude_help tr td {
padding: 5px 5px;
}
.folder_exclude_help .example {
font-style: italic;
color: #696969;
}
.form-table th h2 {
display: inline;
}
#folder_exclusion_filter {
margin: 3px 0px 0px 0px;
}
#exclude_folders_preview ul {
max-height: 300px;
overflow: auto;
background: #fff;
padding: 5px;
border: 1px solid #ddd;
clear: both;
}
/**
* This section contains the css for the "Exclude Folder" interface within a
* modal, such as the "Backup Site Now" modal.
*/
#TB_ajaxContent {
background: #f1f1f1;
}
#TB_ajaxContent .form-table {
margin-top: 0px;
}
#TB_ajaxContent .form-table tr:first-of-type th,
#TB_ajaxContent .form-table tr:first-of-type td {
padding-top: 10px;
vertical-align:top;
}
#TB_ajaxContent .form-table td {
padding-bottom: 0px;
}
#TB_ajaxContent .form-table td p:first-of-type {
padding-top: 0px;
margin-top: 0px;
}
#TB_ajaxContent #exclude_folders_preview {
max-width: 420px;
}
#TB_ajaxContent .form-table th {
width: 100px;
}
/**
* This section includes code for the "include tables" database setting.
*/
.include-tables,
#tables_to_include .tables {
margin-top: 15px;
}
.include-tables div {
float: left;
width: 300px;
white-space: nowrap;
overflow: hidden;
margin-right: 10px;
}
/**
* This section contains misc. code for the "Backup Site Now" modal.
*/
.setting-section {
background:#efefef;
border:1px solid #ddd;
padding:0px 15px;
margin-bottom: 15px;
}
.setting-section.last {
margin-bottom: 65px;
}
#TB_ajaxContent .plugin-card-bottom {
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
padding: 0px 10px;
}
.plugin-card-bottom #you_may_leave {
float: left;
margin-top: 5px;
}
.plugin-card-bottom .notice {
margin-bottom: 10px;
} admin/css/boldgrid-backup-admin-dashboard.css 0000644 00000000671 14757772271 0015231 0 ustar 00 /**
* Style for specific cards.
*/
#bgbkup_backups .bglib-card-icon {
border-top-color: #0073aa;
}
#bgbkup_backups .bglib-card-icon .dashicons {
color: #0073aa;
}
#bgbkup_updates .bglib-card-icon {
border-top-color: #aa0073;
}
#bgbkup_updates .bglib-card-icon .dashicons {
color: #aa0073;
}
#bgbkup_get_premium .bglib-card-icon {
border-top-color: #f95b26;
}
#bgbkup_get_premium .bglib-card-icon .dashicons {
color: #f95b26;
}
admin/css/boldgrid-backup-admin-customizer.css 0000644 00000000566 14757772271 0015511 0 ustar 00 .control-panel-themes .customize-themes-notifications div.boldgrid-backup-protect-now,
.control-panel-themes .customize-themes-notifications div.boldgrid-backup-in-progress,
.control-panel-themes .customize-themes-notifications div.boldgrid-backup-complete,
.control-panel-themes .customize-themes-notifications div.boldgrid-backup-protected {
margin: 0px 25px 25px 25px;
} admin/css/boldgrid-backup-admin.css 0000644 00000020122 14757772271 0013275 0 ustar 00 [id^=toplevel_page_boldgrid-backup] .wp-menu-image::before {
content: "\f178";
}
.dashicons-editor-help {
display: inline-block;
position: relative;
cursor: pointer;
}
.help[data-id] {
display: none;
}
th .help[data-id] {
font-weight: normal;
}
/* Create an inline spinner. */
.spinner.inline {
float: none;
visibility: visible;
vertical-align: bottom;
margin-left: 0px;
}
.spinner.inline.middle {
vertical-align: middle;
}
.spinner.hidden {
display: none;
}
/* When the user clicks to rollback site, show the spinner. */
#restore-now-section .spinner.is-active {
display: inline-block;
}
/* While thickbox is loading, show something rather than nothing. */
#TB_iframeContent {
background: #f1f1f1;
}
/* Prevent clicks on disabled links. */
.bgbkup-page-container a[disabled="disabled"],
.bgbkup-page-container a[disabled="true"] {
pointer-events: none;
}
.bgbu-wait {
cursor: wait !important;
}
.dashicons.red {
color: #dc3232;
}
.dashicons-warning.yellow {
color: #ffb900;
}
.dashicons.green {
color: #46b450;
}
div .dashicons {
vertical-align: bottom;
}
/* Dashicon in "mine count". */
.subsubsub .dashicons {
vertical-align: text-top;
}
/* The table of size data. */
#size-data table tr td {
vertical-align: top;
}
.total-size {
background: #ddd;
width: 325px;
}
.usage {
height: 5px;
max-width: 100% !important;
}
.usage.size-error {
background: #dc3232;
}
.usage.size-warning {
background: #ffb900;
}
.usage.size-success {
background: #46b450;
}
/* Format a table within a table. */
.form-table table td {
padding: 0px 10px 0px 0px;
}
/* Clean up headers we place in any admin notices. */
.notice .header-notice {
margin-top: 10px;
}
hr.separator {
margin: 30px 0px;
}
hr.separator-small {
margin: 20px 0px;
}
/* Get Premium link in the left nav. */
#adminmenu [class*=boldgrid-backup] .get-premium,
#adminmenu [class*=boldgrid-backup] .dashicons-dashboard {
color: #ffb900;
}
/* Needed style for bouncing help icon in mine count. */
.subsubsub .ui-effects-wrapper {
display: inline-block;
}
/* WordPress by default has both the h2 and h3 tags set to the same font size. */
h3 {
font-size: 1.2em;
}
input:invalid {
border: 1px solid red;
}
#download-link-copy, #url-import-notice {
display: none;
}
#download-copy-button .dashicons {
font-size: 16px;
}
/**
* Progress bar.
*
* When a backup is in progress, we show the user a progress bar.
*/
#boldgrid-backup-in-progress-bar:before {
transition: background-color 2s ease;
background-color: transparent;
}
.heartbeat-lost-focus #boldgrid-backup-in-progress-bar:before {
content:"";
display: block;
height: 100%;
position: absolute;
top: 0;
left: 0;
width: 100%;
background-color: rgba( 255, 255, 255, .9 );
}
.heartbeat-lost-focus #boldgrid-backup-in-progress-bar #last_file_archived,
.heartbeat-lost-focus #boldgrid-backup-in-progress-bar .progress-label {
color: #ddd;
}
#boldgrid-backup-in-progress-bar {
position: relative;
background: #f7f7f7;
border: 1px solid #ccc;
clear:both;
overflow: visible;
height: 2em;
margin: 0px;
margin-bottom: 20px;
}
/* The actual progress bar that goes from 0% to 100%. */
#boldgrid-backup-in-progress-bar .ui-progressbar-value {
background-color: #0085ba;
-webkit-transition: width 1s ease-out;
-moz-transition: width 1s ease-out;
-o-transition: width 1s ease-out;
transition: width 1s ease-out;
}
#boldgrid-backup-in-progress-bar #last_file_archived {
font-size: 10px;
position: absolute;
bottom: -20px;
left: 0px;
white-space: nowrap;
}
#boldgrid-backup-in-progress-bar .spinner {
vertical-align: middle;
margin-top: -2px;
}
.ui-progressbar .ui-progressbar-value {
height: 100%;
}
.progress-label {
position: absolute;
top: 4px;
font-weight: bold;
text-shadow: 1px 1px 0 #fff;
left:0;
right:0;
font-weight: 600;
color: #0073aa;
text-align: center;
}
.progress-label.over-50 {
color: #fff;
text-shadow: none;
}
#boldgrid_backup_in_progress_steps .step {
float: left;
width: 33%;
text-align:center;
color: #ddd;
}
#boldgrid_backup_in_progress_steps .step:first-of-type {
text-align: left;
}
#boldgrid_backup_in_progress_steps .step:last-of-type {
text-align: right;
}
#boldgrid_backup_in_progress_steps .step.active {
color: #444;
font-weight: bold;
}
nav[class*="bgbkup-nav-tab-wrapper"] .nav-tab {
cursor: pointer;
}
/**
* A table showing when the backup started and how.
*/
#bgbkup_progress_status table {
margin-bottom: 10px;
}
#bgbkup_progress_status table th {
padding-right: 10px;
font-weight: 500;
text-align: left;
}
/**
* Custom "smaller" nav tab wrapper.
*
* For example, having nav tabs in an admin notice.
*/
.bgbkup-nav-tab-wrapper-small {
margin-bottom: 10px;
}
.bgbkup-nav-tab-wrapper-small .nav-tab {
font-size: 13px;
font-weight: normal;
padding: 2px 6px;
}
/*
* Backup Archive Details: title and description.
*
* This section contains styles for the title and description input fields.
*/
#titlediv #titlewrap #title {
margin-bottom: 15px;
}
[name="backup_description"] {
width: 100%;
height: 100px;
margin: 0px;
}
/*
* Remote Storage providers.
*
* More specifically, logos for remote storage providers.
*/
.bgbkup-gdrive-logo {
background-image: url('../image/remote/google-drive-logo.png');
background-repeat: no-repeat;
background-size: 100% 100%;
width: calc(292px / 2.3);
height: calc(50px / 2.3);
display: inline-block;
}
.bgbkup-gdrive-logo-smaller {
width: calc(292px / 2.8);
height: calc(50px / 2.8);
}
.amazon-s3-logo {
background-image: url('../image/remote/amazon-s3-logo.png');
background-repeat: no-repeat;
background-size: 100% 100%;
width: calc(195px / 2.3);
height: calc(50px / 2.3);
display: inline-block;
}
.amazon-s3-logo-smaller {
width: calc(195px / 2.8);
height: calc(50px / 2.8);
}
p > .bgbkup-remote-logo {
vertical-align: bottom;
}
/**
* Support tab.
*/
.bgbkup-support-page {
display: flex;
margin-top: 1em;
}
.bgbkup-support-page ul {
line-height: 1.4;
margin: 0;
}
/* @todo For reusability, these styles handling the bg-box display can be moved to library/src/assets/css/ui.css */
.bgbkup-support-page .bg-box {
margin: 1em;
width: 50%;
}
.bgbkup-premium-support .bgbkup-upgrade-message {
text-align: center;
}
.bgbkup-premium-support .bgbkup-upgrade-message p:first-of-type {
margin-top: 0;
}
.bgbkup-db-lock {
background-image: url('../image/db-lock-64.png');
background-position-y: 7px;
background-repeat: no-repeat;
background-size: 20px 20px;
display: block;
margin-left: 10px;
padding-left: 23px;
}
/**
* Override Library's Ui Page.
*/
.bgbkup-page-container #bglib-page-header {
background-image: url( '../image/icon-128x128.png' );
}
/**
* Misc.
*/
/* Allow the standard Thickbox to be shown full screen. */
#TB_window.bg-full-screen {
margin: 0 !important;
top: 30px;
left: 30px;
width: calc( 100% - 60px ) !important;
height: calc( 100% - 60px );
}
#TB_window.bg-full-screen #TB_ajaxContent {
width: calc( 100% - 40px ) !important;
height: calc( 100% - 60px ) !important;
}
.bgbkup-transfers-destination .bg-box-bottom.premium .button-success {
float: none;
margin: 10px;
}
.page-title-actions {
display: inline-block;
}
.bg-auto-update.dashicons {
margin-right: 6px;
vertical-align: bottom;
}
.bg-auto-update.dashicons.dashicons-warning {
color: #f56e28;
}
.bg-auto-update.dashicons.dashicons-yes {
color: #79ba49;
}
#upload-archive-section.wp-upload-form {
flex-wrap: wrap;
}
.bgbkup-page-container .upload-plugin .wp-upload-form {
max-width: 85%;
align-items: center;
}
.bgbkup-page-container .upload-plugin .wp-upload-form p {
padding-right: 1em;
}
.bgbkup-page-container .upload-plugin .wp-upload-form .error_messages p {
width: 100%;
}
.bgbkup-page-container .upload-plugin .wp-upload-form input[type=text] {
width: 30%;
margin-right:6px;
}
.bgbkup-page-container .upload-plugin #upload-archive-section {
align-items: center;
}
.bgbkup-page-container .upload-plugin #upload-archive-section form {
width: 60%;
}
.bgbkup-page-container .upload-plugin #upload-archive-section form input[type="file"] {
width: 50%;
}
.bgbkup-page-container .upload-plugin #upload-archive-section .error_messages {
width: 100%;
}
admin/image/remote/google-drive.png 0000644 00000012200 14757772271 0013320 0 ustar 00 PNG
IHDR , , N~G gAMA a sRGB