Diff: STRATO-apps/wordpress_03/app/wp-content/themes/blocksy/inc/classes/db-versioning/v2-0-36.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
namespace Blocksy\DbVersioning;
4
+
5
+
class V2036 {
6
+
public function migrate() {
7
+
if (
8
+
! function_exists('wc_get_attribute_taxonomies')
9
+
||
10
+
! class_exists('\Blocksy\Plugin')
11
+
||
12
+
! in_array(
13
+
'woocommerce-extra',
14
+
get_option('blocksy_active_extensions', [])
15
+
)
16
+
) {
17
+
return;
18
+
}
19
+
20
+
if (! class_exists('\Blocksy\Extensions\WoocommerceExtra\Storage')) {
21
+
return;
22
+
}
23
+
24
+
$storage = new \Blocksy\Extensions\WoocommerceExtra\Storage();
25
+
$settings = $storage->get_settings();
26
+
27
+
if (
28
+
! isset($settings['features']['variation-swatches'])
29
+
||
30
+
! $settings['features']['variation-swatches']
31
+
) {
32
+
return;
33
+
}
34
+
35
+
foreach (array_values(wc_get_attribute_taxonomies()) as $tax) {
36
+
$taxonomy = (array) $tax;
37
+
38
+
$new_type = 'button';
39
+
40
+
$meta = blocksy_get_taxonomy_options($taxonomy['attribute_id']);
41
+
42
+
if (
43
+
$meta
44
+
&&
45
+
isset($meta['swatch_type'])
46
+
) {
47
+
$new_type = $meta['swatch_type'];
48
+
}
49
+
50
+
if ($taxonomy['attribute_type'] !== $new_type) {
51
+
wc_update_attribute(
52
+
$taxonomy['attribute_id'],
53
+
[
54
+
'name' => $taxonomy['attribute_label'],
55
+
'slug' => $taxonomy['attribute_name'],
56
+
'type' => $new_type,
57
+
'order_by' => $taxonomy['attribute_orderby'],
58
+
'has_archives' => $taxonomy['attribute_public']
59
+
]
60
+
);
61
+
}
62
+
}
63
+
}
64
+
}
65
+
66
+
67
+