Completed
Push — update/ads-css ( 15ea64...33b47e )
by
unknown
23:45 queued 15:29
created

vaultpress.php ➔ jetpack_vaultpress_rewind_check()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 5
nc 2
nop 0
dl 0
loc 8
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
function jetpack_vaultpress_rewind_enabled_notice() {
4
	$plugin_file = 'vaultpress/vaultpress.php';
5
6
	deactivate_plugins( $plugin_file );
7
	?>
8
	<div class="notice notice-success">
9
		<h2 style="margin-bottom: 0.25em;"><?php _e( 'Jetpack is now handling your backups.', 'jetpack' ); ?></h2>
10
		<p><?php _e( 'VaultPress is no longer needed and has been deactivated.', 'jetpack' ); ?></p>
11
	</div>
12
	<?php
13
}
14
15
// If Rewind is enabled, then show a notification to disable VaultPress.
16
function jetpack_vaultpress_rewind_check() {
17
	if ( Jetpack::is_active() &&
18
		 Jetpack::is_plugin_active( 'vaultpress/vaultpress.php' ) &&
19
		 Jetpack::is_rewind_enabled()
20
		) {
21
		add_action( 'admin_notices', 'jetpack_vaultpress_rewind_enabled_notice' );
22
	}
23
}
24
25
26
add_action( 'admin_init', 'jetpack_vaultpress_rewind_check', 11 );