Completed
Push — master ( c8709b...1bb8b3 )
by David
02:56
created
src/install/class-wordlift-install-service.php 2 patches
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -18,143 +18,143 @@
 block discarded – undo
18 18
  */
19 19
 class Wordlift_Install_Service {
20 20
 
21
-	/**
22
-	 * A {@link Wordlift_Log_Service} instance.
23
-	 *
24
-	 * @since  3.18.0
25
-	 * @access private
26
-	 * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
27
-	 */
28
-	private $log;
29
-
30
-	/**
31
-	 * The singleton instance.
32
-	 *
33
-	 * @since  3.18.0
34
-	 * @access private
35
-	 * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance.
36
-	 */
37
-	private static $instance;
38
-
39
-	/**
40
-	 * Wordlift_Install_Service constructor.
41
-	 *
42
-	 * @since 3.18.0
43
-	 */
44
-	public function __construct() {
45
-
46
-		/** Installs. */
47
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
48
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
49
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
50
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
51
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
52
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
53
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
54
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
55
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-19-5.php';
56
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-20-0.php';
57
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-23-4.php';
58
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-all-entity-types.php';
59
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-package-type.php';
60
-
61
-		self::$instance = $this;
62
-
63
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
64
-
65
-	}
66
-
67
-	/**
68
-	 * Get the singleton instance.
69
-	 *
70
-	 * @since 3.18.0
71
-	 */
72
-	public static function get_instance() {
73
-
74
-		return self::$instance;
75
-	}
76
-
77
-	/**
78
-	 * Loop thought all versions and install the updates.
79
-	 *
80
-	 * @return void
81
-	 * @since 3.18.0
82
-	 *
83
-	 * @since 3.20.0 use a transient to avoid concurrent installation calls.
84
-	 */
85
-	public function install() {
86
-
87
-		if ( false === get_transient( '_wl_installing' ) ) {
88
-			set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS );
89
-
90
-			$this->do_install();
91
-
92
-			@delete_transient( '_wl_installing' );
93
-		}
94
-
95
-	}
96
-
97
-	/**
98
-	 * Perform the actual installation.
99
-	 *
100
-	 * @since 3.20.0
101
-	 */
102
-	private function do_install() {
103
-
104
-		// Get the install services.
105
-		$installs = array(
106
-			new Wordlift_Install_1_0_0(),
107
-			new Wordlift_Install_3_10_0(),
108
-			new Wordlift_Install_3_12_0(),
109
-			new Wordlift_Install_3_14_0(),
110
-			new Wordlift_Install_3_15_0(),
111
-			new Wordlift_Install_3_18_0(),
112
-			new Wordlift_Install_3_18_3(),
113
-			new Wordlift_Install_3_19_5(),
114
-			new Wordlift_Install_3_20_0(),
115
-			/*
21
+    /**
22
+     * A {@link Wordlift_Log_Service} instance.
23
+     *
24
+     * @since  3.18.0
25
+     * @access private
26
+     * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance.
27
+     */
28
+    private $log;
29
+
30
+    /**
31
+     * The singleton instance.
32
+     *
33
+     * @since  3.18.0
34
+     * @access private
35
+     * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance.
36
+     */
37
+    private static $instance;
38
+
39
+    /**
40
+     * Wordlift_Install_Service constructor.
41
+     *
42
+     * @since 3.18.0
43
+     */
44
+    public function __construct() {
45
+
46
+        /** Installs. */
47
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
48
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
49
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
50
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
51
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
52
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
53
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
54
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
55
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-19-5.php';
56
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-20-0.php';
57
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-23-4.php';
58
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-all-entity-types.php';
59
+        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-package-type.php';
60
+
61
+        self::$instance = $this;
62
+
63
+        $this->log = Wordlift_Log_Service::get_logger( get_class() );
64
+
65
+    }
66
+
67
+    /**
68
+     * Get the singleton instance.
69
+     *
70
+     * @since 3.18.0
71
+     */
72
+    public static function get_instance() {
73
+
74
+        return self::$instance;
75
+    }
76
+
77
+    /**
78
+     * Loop thought all versions and install the updates.
79
+     *
80
+     * @return void
81
+     * @since 3.18.0
82
+     *
83
+     * @since 3.20.0 use a transient to avoid concurrent installation calls.
84
+     */
85
+    public function install() {
86
+
87
+        if ( false === get_transient( '_wl_installing' ) ) {
88
+            set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS );
89
+
90
+            $this->do_install();
91
+
92
+            @delete_transient( '_wl_installing' );
93
+        }
94
+
95
+    }
96
+
97
+    /**
98
+     * Perform the actual installation.
99
+     *
100
+     * @since 3.20.0
101
+     */
102
+    private function do_install() {
103
+
104
+        // Get the install services.
105
+        $installs = array(
106
+            new Wordlift_Install_1_0_0(),
107
+            new Wordlift_Install_3_10_0(),
108
+            new Wordlift_Install_3_12_0(),
109
+            new Wordlift_Install_3_14_0(),
110
+            new Wordlift_Install_3_15_0(),
111
+            new Wordlift_Install_3_18_0(),
112
+            new Wordlift_Install_3_18_3(),
113
+            new Wordlift_Install_3_19_5(),
114
+            new Wordlift_Install_3_20_0(),
115
+            /*
116 116
 			 * This should be enabled with #852.
117 117
 			 */
118
-			// new Wordlift_Install_All_Entity_Types(),
119
-			new Wordlift_Install_Package_Type(),
120
-			new Wordlift_Install_3_23_4(),
121
-		);
118
+            // new Wordlift_Install_All_Entity_Types(),
119
+            new Wordlift_Install_Package_Type(),
120
+            new Wordlift_Install_3_23_4(),
121
+        );
122 122
 
123
-		$version = null;
123
+        $version = null;
124 124
 
125
-		/** @var Wordlift_Install $install */
126
-		foreach ( $installs as $install ) {
127
-			// Get the install version.
128
-			$version = $install->get_version();
125
+        /** @var Wordlift_Install $install */
126
+        foreach ( $installs as $install ) {
127
+            // Get the install version.
128
+            $version = $install->get_version();
129 129
 
130
-			if ( version_compare( $version, $this->get_current_version(), '>' )
131
-			     || $install->must_install() ) {
130
+            if ( version_compare( $version, $this->get_current_version(), '>' )
131
+                 || $install->must_install() ) {
132 132
 
133
-				$class_name = get_class( $install );
133
+                $class_name = get_class( $install );
134 134
 
135
-				$this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." );
135
+                $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." );
136 136
 
137
-				// Install version.
138
-				$install->install();
137
+                // Install version.
138
+                $install->install();
139 139
 
140
-				$this->log->info( "$class_name installed." );
140
+                $this->log->info( "$class_name installed." );
141 141
 
142
-				// Bump the version.
143
-				update_option( 'wl_db_version', $version );
142
+                // Bump the version.
143
+                update_option( 'wl_db_version', $version );
144 144
 
145
-			}
145
+            }
146 146
 
147
-		}
147
+        }
148 148
 
149
-	}
149
+    }
150 150
 
151
-	/**
152
-	 * Retrieve the current db version.
153
-	 *
154
-	 * @return type
155
-	 */
156
-	private function get_current_version() {
157
-		return get_option( 'wl_db_version', '0.0.0' );
158
-	}
151
+    /**
152
+     * Retrieve the current db version.
153
+     *
154
+     * @return type
155
+     */
156
+    private function get_current_version() {
157
+        return get_option( 'wl_db_version', '0.0.0' );
158
+    }
159 159
 
160 160
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
 	public function __construct() {
45 45
 
46 46
 		/** Installs. */
47
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php';
48
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php';
49
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php';
50
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php';
51
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php';
52
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php';
53
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php';
54
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php';
55
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-19-5.php';
56
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-20-0.php';
57
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-23-4.php';
58
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-all-entity-types.php';
59
-		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-package-type.php';
47
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install.php';
48
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-1-0-0.php';
49
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-10-0.php';
50
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-12-0.php';
51
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-14-0.php';
52
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-15-0.php';
53
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-18-0.php';
54
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-18-3.php';
55
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-19-5.php';
56
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-20-0.php';
57
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-23-4.php';
58
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-all-entity-types.php';
59
+		require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-package-type.php';
60 60
 
61 61
 		self::$instance = $this;
62 62
 
63
-		$this->log = Wordlift_Log_Service::get_logger( get_class() );
63
+		$this->log = Wordlift_Log_Service::get_logger(get_class());
64 64
 
65 65
 	}
66 66
 
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public function install() {
86 86
 
87
-		if ( false === get_transient( '_wl_installing' ) ) {
88
-			set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS );
87
+		if (false === get_transient('_wl_installing')) {
88
+			set_transient('_wl_installing', true, 5 * MINUTE_IN_SECONDS);
89 89
 
90 90
 			$this->do_install();
91 91
 
92
-			@delete_transient( '_wl_installing' );
92
+			@delete_transient('_wl_installing');
93 93
 		}
94 94
 
95 95
 	}
@@ -123,24 +123,24 @@  discard block
 block discarded – undo
123 123
 		$version = null;
124 124
 
125 125
 		/** @var Wordlift_Install $install */
126
-		foreach ( $installs as $install ) {
126
+		foreach ($installs as $install) {
127 127
 			// Get the install version.
128 128
 			$version = $install->get_version();
129 129
 
130
-			if ( version_compare( $version, $this->get_current_version(), '>' )
131
-			     || $install->must_install() ) {
130
+			if (version_compare($version, $this->get_current_version(), '>')
131
+			     || $install->must_install()) {
132 132
 
133
-				$class_name = get_class( $install );
133
+				$class_name = get_class($install);
134 134
 
135
-				$this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." );
135
+				$this->log->info("Current version is {$this->get_current_version()}, installing $class_name...");
136 136
 
137 137
 				// Install version.
138 138
 				$install->install();
139 139
 
140
-				$this->log->info( "$class_name installed." );
140
+				$this->log->info("$class_name installed.");
141 141
 
142 142
 				// Bump the version.
143
-				update_option( 'wl_db_version', $version );
143
+				update_option('wl_db_version', $version);
144 144
 
145 145
 			}
146 146
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @return type
155 155
 	 */
156 156
 	private function get_current_version() {
157
-		return get_option( 'wl_db_version', '0.0.0' );
157
+		return get_option('wl_db_version', '0.0.0');
158 158
 	}
159 159
 
160 160
 }
Please login to merge, or discard this patch.
src/install/class-wordlift-install-3-23-4.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,32 +14,32 @@
 block discarded – undo
14 14
  */
15 15
 class Wordlift_Install_3_23_4 extends Wordlift_Install {
16 16
 
17
-	/**
18
-	 * {@inheritdoc}
19
-	 */
20
-	protected static $version = '3.23.4';
17
+    /**
18
+     * {@inheritdoc}
19
+     */
20
+    protected static $version = '3.23.4';
21 21
 
22
-	public function install() {
22
+    public function install() {
23 23
 
24
-		$term = get_term_by( 'slug', 'web-page', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
24
+        $term = get_term_by( 'slug', 'web-page', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
25 25
 
26
-		// Bail out if term exists.
27
-		if ( false !== $term ) {
28
-			return;
29
-		}
26
+        // Bail out if term exists.
27
+        if ( false !== $term ) {
28
+            return;
29
+        }
30 30
 
31
-		wp_insert_term(
32
-			'WebPage',
33
-			Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
34
-			array(
35
-				'slug'        => 'web-page',
36
-				'description' => 'A Web Page.',
37
-			)
38
-		);
31
+        wp_insert_term(
32
+            'WebPage',
33
+            Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME,
34
+            array(
35
+                'slug'        => 'web-page',
36
+                'description' => 'A Web Page.',
37
+            )
38
+        );
39 39
 
40
-		update_term_meta( $term->term_id, '_wl_name', 'WebPage' );
41
-		update_term_meta( $term->term_id, '_wl_uri', "http://schema.org/WebPage" );
40
+        update_term_meta( $term->term_id, '_wl_name', 'WebPage' );
41
+        update_term_meta( $term->term_id, '_wl_uri', "http://schema.org/WebPage" );
42 42
 
43
-	}
43
+    }
44 44
 
45 45
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 
22 22
 	public function install() {
23 23
 
24
-		$term = get_term_by( 'slug', 'web-page', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
24
+		$term = get_term_by('slug', 'web-page', Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME);
25 25
 
26 26
 		// Bail out if term exists.
27
-		if ( false !== $term ) {
27
+		if (false !== $term) {
28 28
 			return;
29 29
 		}
30 30
 
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 			)
38 38
 		);
39 39
 
40
-		update_term_meta( $term->term_id, '_wl_name', 'WebPage' );
41
-		update_term_meta( $term->term_id, '_wl_uri', "http://schema.org/WebPage" );
40
+		update_term_meta($term->term_id, '_wl_name', 'WebPage');
41
+		update_term_meta($term->term_id, '_wl_uri', "http://schema.org/WebPage");
42 42
 
43 43
 	}
44 44
 
Please login to merge, or discard this patch.