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 +41 -4 2.0.42.6.1 View file →
@@ -26,11 +26,50 @@
26 26 return __( 'Update plugin meta', 'content-control' );
27 27 }
28 28
29 29 /**
30 + * Get the dependencies for this upgrade.
31 + *
32 + * @return string[]
33 + */
34 + public function get_dependencies() {
35 + return [
36 + 'backup-2',
37 + ];
38 + }
39 +
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 + /**
30 69 * Run the upgrade.
31 70 *
32 - * @return void|WP_Error|false
71 + * @return void
33 72 */
34 73 public function run() {
35 74 // Gets a stream or mock stream for sending events.
36 75 $stream = $this->stream();
@@ -36,11 +75,9 @@
36 75 $stream = $this->stream();
37 76
38 77 $stream->start_task( __( 'Migrating plugin meta', 'content-control' ) );
39 78
40 - $remaps = [
41 - 'jp_cc_reviews_installed_on' => 'content_control_installed_on',
42 - ];
79 + $remaps = $this->remaps;
43 80
44 81 foreach ( $remaps as $key => $new_key ) {
45 82 $value = \get_option( $key, null );
46 83