WordPointsOrg_Un_Installer   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 6
Bugs 1 Features 0
Metric Value
c 6
b 1
f 0
dl 0
loc 93
rs 10
wmc 7
lcom 0
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A load_dependencies() 0 5 1
A uninstall_network() 0 6 1
A uninstall_single() 0 6 1
A before_update() 0 8 2
A update_network_to_1_1_3() 0 15 2
1
<?php
2
3
/**
4
 * Class to un/install the module.
5
 *
6
 * @package WordPointsOrg
7
 * @since 1.0.0
8
 */
9
10
/**
11
 * Un/install the module.
12
 *
13
 * @since 1.0.0
14
 */
15
class WordPointsOrg_Un_Installer extends WordPoints_Un_Installer_Base {
16
17
	/**
18
	 * @since 1.1.3
19
	 */
20
	protected $type = 'module';
21
22
	/**
23
	 * @since 1.1.3
24
	 */
25
	protected $custom_caps_getter = 'wordpointsorg_get_custom_caps';
26
27
	/**
28
	 * @since 1.1.3
29
	 */
30
	protected $uninstall = array(
31
		'global' => array(
32
			'options' => array(
33
				'wordpoints_edd_sl_module_licenses',
34
				'wordpoints_edd_sl_module_info',
35
			),
36
		),
37
	);
38
39
	/**
40
	 * @since 1.1.3
41
	 */
42
	protected $updates = array(
43
		'1.1.3' => array( 'network' => true ),
44
	);
45
46
	/**
47
	 * @since 1.0.0
48
	 */
49
	protected function load_dependencies() {
50
51
		require_once( dirname( __FILE__ ) . '/constants.php' );
52
		require_once( WORDPOINTSORG_DIR . '/includes/functions.php' );
53
	}
54
55
	/**
56
	 * @since 1.0.0
57
	 */
58
	protected function uninstall_network() {
59
60
		parent::uninstall_network();
61
62
		delete_site_transient( 'wordpoints_module_updates' );
63
	}
64
65
	/**
66
	 * @since 1.0.0
67
	 */
68
	protected function uninstall_single() {
69
70
		parent::uninstall_single();
71
72
		delete_transient( 'wordpoints_module_updates' );
73
	}
74
75
	/**
76
	 * @since 1.1.3
77
	 */
78
	protected function before_update() {
79
80
		parent::before_update();
81
82
		if ( 1 === version_compare( '1.1.3', $this->updating_from ) ) {
83
			$this->option_prefix = 'wordpointsorg_';
84
		}
85
	}
86
87
	/**
88
	 * Update the network to 1.1.3.
89
	 *
90
	 * @since 1.1.3
91
	 */
92
	protected function update_network_to_1_1_3() {
93
94
		update_site_option(
95
			'wordpoints_module_wordpointsorg_installed_sites'
96
			, wordpoints_get_array_option( 'wordpointsorg_installed_sites', 'site' )
97
		);
98
99
		delete_site_option( 'wordpointsorg_installed_sites' );
100
101
		if ( get_site_option( 'wordpointsorg_network_installed' ) ) {
102
			unset( $this->option_prefix );
103
			$this->set_network_installed();
104
			delete_site_option( 'wordpointsorg_network_installed' );
105
		}
106
	}
107
}
108
109
return 'WordPointsOrg_Un_Installer';
110
111
// EOF
112