PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.0.4
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.0.4
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
content-control / classes / Upgrades / PluginMeta_2.php

PluginMeta_2.php in Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More 2.0.4, at classes/Upgrades/PluginMeta_2.php

56 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Content Control Migrations
4 *
5 * @package ContentControl\Plugin
6 */
7
8 namespace ContentControl\Upgrades;
9
10 defined( 'ABSPATH' ) || exit;
11
12 /**
13 * Version 2 migration.
14 */
15 class PluginMeta_2 extends \ContentControl\Base\Upgrade {
16
17 const TYPE = 'plugin_meta';
18 const VERSION = 2;
19
20 /**
21 * Get the label for the upgrade.
22 *
23 * @return string
24 */
25 public function label() {
26 return __( 'Update plugin meta', 'content-control' );
27 }
28
29 /**
30 * Run the upgrade.
31 *
32 * @return void|WP_Error|false
33 */
34 public function run() {
35 // Gets a stream or mock stream for sending events.
36 $stream = $this->stream();
37
38 $stream->start_task( __( 'Migrating plugin meta', 'content-control' ) );
39
40 $remaps = [
41 'jp_cc_reviews_installed_on' => 'content_control_installed_on',
42 ];
43
44 foreach ( $remaps as $key => $new_key ) {
45 $value = \get_option( $key, null );
46
47 if ( null !== $value ) {
48 \update_option( $new_key, $value );
49 \delete_option( $key );
50 }
51 }
52
53 $stream->complete_task( __( 'Plugin meta migrated', 'content-control' ) );
54 }
55 }
56