Completed
Push — master ( a00b53...3dc4d8 )
by
unknown
21:18
created

Update_V3013::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 * Update to 3.0.13
4
 *
5
 * @package SimpleCalendar/Updates
6
 */
7
namespace SimpleCalendar\Updates;
8
9
use Carbon\Carbon;
10
use SimpleCalendar\Post_Types;
11
12
if ( ! defined( 'ABSPATH' ) ) {
13
	exit;
14
}
15
16
/**
17
 * Update to 3.0.13
18
 */
19
class Update_V3013 {
20
21
	/**
22
	 * Update posts and options.
23
	 *
24
	 * @param array $posts
25
	 */
26
	public function __construct( $posts ) {
0 ignored issues
show
Unused Code introduced by
The parameter $posts is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
28
		$this->update_options();
29
	}
30
31
32
	/**
33
	 * Update options.
34
	 */
35
	public function update_options() {
36
37
		$settings_advanced = get_option( 'simple-calendar_settings_advanced' );
38
		
39
		// Remove stored always_enqueue value
40
		if ( isset( $settings_advanced['assets']['always_enqueue'] ) ) {
41
			unset( $settings_advanced['assets']['always_enqueue'] );
42
		}
43
44
		// Remove stored disable_js value
45
		if ( isset( $settings_advanced['assets']['disable_js'] ) ) {
46
			unset( $settings_advanced['assets']['disable_js'] );
47
		}
48
49
		update_option( 'simple-calendar_settings_advanced', $settings_advanced );
50
51
		// Delete legacy options.
52
		delete_option( 'simple-calendar_defaults' );
53
	}
54
55
}
56