upgrade
2 years ago
dump.sql
4 years ago
update-1.x.php
2 years ago
update-2.0-beta.php
2 years ago
update.php
8 years ago
update.php
83 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Pods\Upgrade |
| 4 | */ |
| 5 | |
| 6 | // Update to 2.0.3 |
| 7 | if ( version_compare( $pods_version, '2.0.3', '<' ) ) { |
| 8 | // Rename sister_field_id to sister_id |
| 9 | pods_query( "DELETE FROM `@wp_postmeta` WHERE `meta_key` = 'sister_field_id'", false ); |
| 10 | |
| 11 | update_option( 'pods_framework_version', '2.0.3' ); |
| 12 | } |
| 13 | |
| 14 | // Update to 2.3 |
| 15 | if ( version_compare( $pods_version, '2.3', '<' ) ) { |
| 16 | // Auto activate Advanced Content Types component |
| 17 | $oldget = $_GET; |
| 18 | |
| 19 | $_GET['toggle'] = 1; |
| 20 | |
| 21 | PodsInit::$components->toggle( 'advanced-content-types' ); |
| 22 | PodsInit::$components->toggle( 'table-storage' ); |
| 23 | |
| 24 | $_GET = $oldget; |
| 25 | |
| 26 | update_option( 'pods_framework_version', '2.3' ); |
| 27 | } |
| 28 | |
| 29 | // Update to 2.3.4 |
| 30 | if ( version_compare( $pods_version, '2.3.4', '<' ) ) { |
| 31 | if ( function_exists( 'pods_page_flush_rewrites' ) ) { |
| 32 | pods_page_flush_rewrites(); |
| 33 | } |
| 34 | |
| 35 | update_option( 'pods_framework_version', '2.3.4' ); |
| 36 | } |
| 37 | |
| 38 | // Update to 2.3.5 |
| 39 | if ( version_compare( $pods_version, '2.3.5', '<' ) ) { |
| 40 | global $wpdb; |
| 41 | |
| 42 | $wpdb->query( "UPDATE `{$wpdb->postmeta}` SET `meta_value` = 'dMy' WHERE `meta_key` IN ( 'date_format', 'datetime_format' ) AND `meta_value` = 'dMd'" ); |
| 43 | $wpdb->query( "UPDATE `{$wpdb->postmeta}` SET `meta_value` = 'dMy_dash' WHERE `meta_key` IN ( 'date_format', 'datetime_format' ) AND `meta_value` = 'dMd_dash'" ); |
| 44 | |
| 45 | $pods_object_ids = $wpdb->get_col( "SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` IN ( '_pods_pod', '_pods_field', '_pods_page', '_pods_template', '_pods_helper' )" ); |
| 46 | |
| 47 | if ( ! empty( $pods_object_ids ) ) { |
| 48 | array_walk( $pods_object_ids, 'absint' ); |
| 49 | |
| 50 | $wpdb->query( "DELETE FROM `{$wpdb->postmeta}` WHERE `post_id` IN ( " . implode( ', ', $pods_object_ids ) . " ) AND `meta_value` = ''" ); |
| 51 | } |
| 52 | |
| 53 | update_option( 'pods_framework_version', '2.3.5' ); |
| 54 | } |
| 55 | |
| 56 | // Update to 2.3.9 |
| 57 | if ( version_compare( $pods_version, '2.3.9-a-1', '<' ) ) { |
| 58 | // Set autoload on all necessary options to avoid extra queries |
| 59 | $autoload_options = array( |
| 60 | 'pods_framework_version' => '', |
| 61 | 'pods_framework_version_last' => '', |
| 62 | 'pods_framework_db_version' => '', |
| 63 | 'pods_framework_upgraded_1_x' => '0', |
| 64 | 'pods_version' => '', |
| 65 | 'pods_component_settings' => '', |
| 66 | 'pods_disable_file_browser' => '0', |
| 67 | 'pods_files_require_login' => '1', |
| 68 | 'pods_files_require_login_cap' => '', |
| 69 | 'pods_disable_file_upload' => '0', |
| 70 | 'pods_upload_require_login' => '1', |
| 71 | 'pods_upload_require_login_cap' => '', |
| 72 | ); |
| 73 | |
| 74 | foreach ( $autoload_options as $option_name => $default ) { |
| 75 | $option_value = get_option( $option_name, $default ); |
| 76 | |
| 77 | delete_option( $option_name ); |
| 78 | add_option( $option_name, $option_value, '', 'yes' ); |
| 79 | } |
| 80 | |
| 81 | update_option( 'pods_framework_version', '2.3.9-a-1' ); |
| 82 | }//end if |
| 83 |