PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.6.1
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.6.1
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
← All changes | classes/Upgrades/PluginMeta_2.php +30 -4 2.0.12 → 2.6.1 View file →
@@ -37,11 +37,39 @@
37 37 ];
38 38 }
39 39
40 40 /**
41 + * Get the remaps for this upgrade.
42 + *
43 + * @var array<string,string>
44 + */
45 + private $remaps = [
46 + 'jp_cc_reviews_installed_on' => 'content_control_installed_on',
47 + ];
48 +
49 + /**
50 + * Check if the upgrade is required.
51 + *
52 + * @return bool
53 + */
54 + public function is_required() {
55 + $remaps = $this->remaps;
56 +
57 + foreach ( $remaps as $key => $new_key ) {
58 + $value = \get_option( $key, null );
59 +
60 + if ( null !== $value ) {
61 + return true;
62 + }
63 + }
64 +
65 + return false;
66 + }
67 +
68 + /**
41 69 * Run the upgrade.
42 70 *
43 - * @return void|\WP_Error|false
71 + * @return void
44 72 */
45 73 public function run() {
46 74 // Gets a stream or mock stream for sending events.
47 75 $stream = $this->stream();
@@ -47,11 +75,9 @@
47 75 $stream = $this->stream();
48 76
49 77 $stream->start_task( __( 'Migrating plugin meta', 'content-control' ) );
50 78
51 - $remaps = [
52 - 'jp_cc_reviews_installed_on' => 'content_control_installed_on',
53 - ];
79 + $remaps = $this->remaps;
54 80
55 81 foreach ( $remaps as $key => $new_key ) {
56 82 $value = \get_option( $key, null );
57 83