PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.9.2.7
Advanced Custom Fields: Extended v0.9.2.7
0.9.2.7 0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / modules / post-type / module-post-type-upgrades.php
acf-extended / includes / modules / post-type Last commit date
module-post-type-features.php 3 months ago module-post-type-fields.php 3 years ago module-post-type-upgrades.php 3 years ago module-post-type.php 3 months ago
module-post-type-upgrades.php
161 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_module_post_type_upgrades')):
8
9 class acfe_module_post_type_upgrades{
10
11 /**
12 * construct
13 */
14 function __construct(){
15
16 add_action('acfe/do_upgrade', array($this, 'upgrade_0_8_9'), 30);
17 add_action('acfe/do_upgrade', array($this, 'upgrade_0_8_8'), 20);
18 add_action('acfe/do_upgrade', array($this, 'upgrade_0_8_5'), 10);
19
20 }
21
22 /**
23 * upgrade_0_8_9
24 *
25 * acfe/do_upgrade:30
26 *
27 * @param $db_version
28 */
29 function upgrade_0_8_9($db_version){
30
31 // check already done
32 if(acf_version_compare($db_version, '>=', '0.8.9')){
33 return;
34 }
35
36 // hook on init to load all WP components
37 // post types, post statuses 'acf-disabled' etc...
38 add_action('init', function(){
39
40 // get posts
41 $posts = get_posts(array(
42 'post_type' => 'acfe-dpt',
43 'posts_per_page' => -1,
44 'fields' => 'ids',
45 'post_status' => 'any',
46 ));
47
48 $todo = array();
49
50 foreach($posts as $post_id){
51
52 if(acfe_is_module_v2_item($post_id)){
53 $todo[] = $post_id;
54 }
55
56 }
57
58 if(!$todo){
59 return;
60 }
61
62 // get module
63 $module = acfe_get_module('post_type');
64
65 // loop
66 foreach($todo as $post_id){
67
68 $name = get_post_field('post_name', $post_id);
69 $settings = acfe_get_settings("modules.post_types.{$name}", array());
70
71 // db settings found
72 if($settings){
73
74 // generate item
75 $item = wp_parse_args($settings, array(
76 'ID' => $post_id,
77 'name' => $name,
78 ));
79
80 // import item (update db)
81 $module->import_item($item);
82
83 }
84
85 }
86
87 // log
88 acf_log('[ACF Extended] 0.8.9 Upgrade: Post Types');
89
90 });
91
92 }
93
94 /**
95 * upgrade_0_8_8
96 *
97 * acfe/do_upgrade:20
98 *
99 * @param $db_version
100 */
101 function upgrade_0_8_8($db_version){
102
103 // check already done
104 if(acf_version_compare($db_version, '>=', '0.8.8')){
105 return;
106 }
107
108 $old = acfe_get_settings('modules.dynamic_post_type.data', array());
109 $new = acfe_get_settings('modules.post_types', array());
110
111 acfe_delete_settings('modules.dynamic_post_type');
112
113 // Check
114 if(empty($old)){
115 return;
116 }
117
118 // Log
119 acf_log('[ACF Extended] 0.8.8 Upgrade: Post Types');
120
121 // Update
122 acfe_update_settings('modules.post_types', array_merge($old, $new));
123
124 }
125
126
127 /**
128 * upgrade_0_8_5
129 *
130 * acfe/do_upgrade:10
131 *
132 * @param $db_version
133 */
134 function upgrade_0_8_5($db_version){
135
136 // check already done
137 if(acf_version_compare($db_version, '>=', '0.8.5')){
138 return;
139 }
140
141 $old = get_option('acfe_dynamic_post_types', array());
142 $new = acfe_get_settings('modules.post_types', array());
143
144 delete_option('acfe_dynamic_post_types');
145
146 if(empty($old)){
147 return;
148 }
149
150 acf_log('[ACF Extended] 0.8.5 Upgrade: Post Types');
151
152 // Update
153 acfe_update_settings('modules.post_types', array_merge($old, $new));
154
155 }
156
157 }
158
159 acf_new_instance('acfe_module_post_type_upgrades');
160
161 endif;