upgrade_2_0_0.php
304 lines
| 1 | <?php |
| 2 | |
| 3 | // Don't load directly. |
| 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | die( '-1' ); |
| 6 | } |
| 7 | |
| 8 | // phpcs:ignoreFile WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound |
| 9 | |
| 10 | global $wpdb; |
| 11 | ?> |
| 12 | <div class="wrap pods-admin"> |
| 13 | <div id="icon-pods" class="icon32"><br /></div> |
| 14 | |
| 15 | <h2 class="italicized"><?php esc_html_e( 'Upgrade Pods', 'pods' ); ?></h2> |
| 16 | |
| 17 | <img src="<?php echo esc_url( PODS_URL ); ?>ui/images/pods-logo-notext-rgb-transparent.png" class="pods-leaf-watermark-right" /> |
| 18 | |
| 19 | <div id="pods-wizard-box" class="pods-wizard-steps-3" data-action="pods_admin" data-method="upgrade" data-_wpnonce="<?php echo esc_attr( wp_create_nonce( 'pods-upgrade' ) ); ?>" data-version="<?php echo esc_attr( $new_version ); ?>"> |
| 20 | <div id="pods-wizard-heading"> |
| 21 | <ul> |
| 22 | <li class="pods-wizard-menu-current" data-step="1"> |
| 23 | <i></i> <span>1</span> <?php esc_html_e( 'Getting Started', 'pods' ); ?> <em></em> |
| 24 | </li> |
| 25 | <li data-step="2"> |
| 26 | <i></i> <span>2</span> <?php esc_html_e( 'Prepare', 'pods' ); ?> <em></em> |
| 27 | </li> |
| 28 | <li data-step="3"> |
| 29 | <i></i> <span>3</span> <?php esc_html_e( 'Migrate', 'pods' ); ?> <em></em> |
| 30 | </li> |
| 31 | </ul> |
| 32 | </div> |
| 33 | <div id="pods-wizard-main"> |
| 34 | |
| 35 | <!-- Getting Started Panel --> |
| 36 | <div id="pods-wizard-panel-1" class="pods-wizard-panel"> |
| 37 | <div class="pods-wizard-content pods-wizard-grey"> |
| 38 | <p> |
| 39 | <?php |
| 40 | $intro = __( 'Welcome to Pods 2.x! We sincerely hope you enjoy over two years worth of planning and work, available to you for <em>free</em>.', 'pods' ) . ' ' . __( 'Due to a number of optimizations in Pods 2.x, we need to run a few updates to your database. This should not remove or change your existing Pod data from 1.x, so if you wish to rollback to Pods 1.x - you can easily do that.', 'pods' ); |
| 41 | |
| 42 | echo wp_kses_post( $intro ); |
| 43 | ?> |
| 44 | </p> |
| 45 | </div> |
| 46 | |
| 47 | <?php require_once PODS_DIR . 'ui/admin/upgrade/backup.php'; ?> |
| 48 | </div> |
| 49 | <!-- // Getting Started Panel --> |
| 50 | |
| 51 | <!-- Prepare Panel --> |
| 52 | <div id="pods-wizard-panel-2" class="pods-wizard-panel"> |
| 53 | <div class="pods-wizard-content"> |
| 54 | <p><?php esc_html_e( 'We will prepare all of your Pods, Settings, and Content for migration. If any issues are found they will be displayed below for your review. Be sure to backup your database before continuing onto the next step for Migration.', 'pods' ); ?></p> |
| 55 | </div> |
| 56 | <table cellpadding="0" cellspacing="0"> |
| 57 | <col style="width: 70px"> |
| 58 | <col style="width: 110px"> |
| 59 | <col style="width: 580px"> |
| 60 | <thead> |
| 61 | <tr> |
| 62 | <th colspan="3"><?php esc_html_e( 'Preparing Your Content for Migration', 'pods' ); ?>..</th> |
| 63 | </tr> |
| 64 | </thead> |
| 65 | <tbody> |
| 66 | <?php |
| 67 | $pods = $wpdb->get_results( "SELECT `name`, `label` FROM `{$wpdb->prefix}pod_types` ORDER BY `name`" ); |
| 68 | $count = count( $pods ); |
| 69 | ?> |
| 70 | <tr class="pods-wizard-table-<?php echo esc_attr( 0 < $count ? 'complete' : 'pending' ); ?>" data-upgrade="pods"> |
| 71 | <td class="pods-wizard-right pods-wizard-status"> |
| 72 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 73 | </td> |
| 74 | <td class="pods-wizard-right pods-wizard-count"><?php echo esc_attr( 0 < $count ? $count : '—' ); ?></td> |
| 75 | <td class="pods-wizard-name"> |
| 76 | <?php esc_html_e( 'Pods', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 77 | </td> |
| 78 | </tr> |
| 79 | <tr class="pods-wizard-table-pending" data-upgrade="fields"> |
| 80 | <td class="pods-wizard-right pods-wizard-status"> |
| 81 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 82 | </td> |
| 83 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 84 | <td class="pods-wizard-name"> |
| 85 | <?php esc_html_e( 'Fields', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 86 | </td> |
| 87 | </tr> |
| 88 | <tr class="pods-wizard-table-pending" data-upgrade="relationships"> |
| 89 | <td class="pods-wizard-right pods-wizard-status"> |
| 90 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 91 | </td> |
| 92 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 93 | <td class="pods-wizard-name"> |
| 94 | <?php esc_html_e( 'Relationships', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 95 | </td> |
| 96 | </tr> |
| 97 | <tr class="pods-wizard-table-pending" data-upgrade="index"> |
| 98 | <td class="pods-wizard-right pods-wizard-status"> |
| 99 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 100 | </td> |
| 101 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 102 | <td class="pods-wizard-name"> |
| 103 | <?php esc_html_e( 'Item Indexes', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 104 | </td> |
| 105 | </tr> |
| 106 | <tr class="pods-wizard-table-pending" data-upgrade="templates"> |
| 107 | <td class="pods-wizard-right pods-wizard-status"> |
| 108 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 109 | </td> |
| 110 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 111 | <td class="pods-wizard-name"> |
| 112 | <?php esc_html_e( 'Templates', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 113 | </td> |
| 114 | </tr> |
| 115 | <tr class="pods-wizard-table-pending" data-upgrade="pages"> |
| 116 | <td class="pods-wizard-right pods-wizard-status"> |
| 117 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 118 | </td> |
| 119 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 120 | <td class="pods-wizard-name"> |
| 121 | <?php esc_html_e( 'Pod Pages', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 122 | </td> |
| 123 | </tr> |
| 124 | <tr class="pods-wizard-table-pending" data-upgrade="helpers"> |
| 125 | <td class="pods-wizard-right pods-wizard-status"> |
| 126 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 127 | </td> |
| 128 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 129 | <td class="pods-wizard-name"> |
| 130 | <?php esc_html_e( 'Helpers', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 131 | </td> |
| 132 | </tr> |
| 133 | <?php |
| 134 | foreach ( $pods as $pod ) { |
| 135 | ?> |
| 136 | <tr class="pods-wizard-table-pending" data-upgrade="pod" data-pod="<?php echo esc_attr( $pod->name ); ?>"> |
| 137 | <td class="pods-wizard-right pods-wizard-status"> |
| 138 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 139 | </td> |
| 140 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 141 | <td class="pods-wizard-name"> |
| 142 | <?php echo esc_html( __( 'Content', 'pods' ) . ': ' . $pod->name ); ?> |
| 143 | <span class="pods-wizard-info"></span> |
| 144 | </td> |
| 145 | </tr> |
| 146 | <?php |
| 147 | } |
| 148 | ?> |
| 149 | </tbody> |
| 150 | </table> |
| 151 | </div> |
| 152 | <!-- // Prepare Panel --> |
| 153 | |
| 154 | <!-- Migrate Panel --> |
| 155 | <div id="pods-wizard-panel-3" class="pods-wizard-panel"> |
| 156 | <div class="pods-wizard-content"> |
| 157 | <p><?php esc_html_e( 'During this process your Pods, Settings, and Content will be migrated into the optimized Pods 2.x architecture. We will not delete any of your old data, the tables will remain until you choose to clean them up after a successful upgrade.', 'pods' ); ?></p> |
| 158 | </div> |
| 159 | <table cellpadding="0" cellspacing="0"> |
| 160 | <col style="width: 70px"> |
| 161 | <col style="width: 110px"> |
| 162 | <col style="width: 580px"> |
| 163 | <thead> |
| 164 | <tr> |
| 165 | <th colspan="3"><?php esc_html_e( 'Migrating Your Content', 'pods' ); ?>..</th> |
| 166 | </tr> |
| 167 | </thead> |
| 168 | <tbody><!-- complete|pending|active <i></i> --> |
| 169 | <tr class="pods-wizard-table-pending" data-upgrade="1_x"> |
| 170 | <td class="pods-wizard-right pods-wizard-status"> |
| 171 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 172 | </td> |
| 173 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 174 | <td class="pods-wizard-name"> |
| 175 | <?php esc_html_e( '1.x Updates', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 176 | </td> |
| 177 | </tr> |
| 178 | <tr class="pods-wizard-table-pending" data-upgrade="pods"> |
| 179 | <td class="pods-wizard-right pods-wizard-status"> |
| 180 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 181 | </td> |
| 182 | <td class="pods-wizard-right pods-wizard-count"><?php echo ( 0 < $count ? esc_html( $count ) : '—' ); ?></td> |
| 183 | <td class="pods-wizard-name"> |
| 184 | <?php esc_html_e( 'Pods', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 185 | </td> |
| 186 | </tr> |
| 187 | <tr class="pods-wizard-table-pending" data-upgrade="fields"> |
| 188 | <td class="pods-wizard-right pods-wizard-status"> |
| 189 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 190 | </td> |
| 191 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 192 | <td class="pods-wizard-name"> |
| 193 | <?php esc_html_e( 'Fields', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 194 | </td> |
| 195 | </tr> |
| 196 | <tr class="pods-wizard-table-pending" data-upgrade="relationships"> |
| 197 | <td class="pods-wizard-right pods-wizard-status"> |
| 198 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 199 | </td> |
| 200 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 201 | <td class="pods-wizard-name"> |
| 202 | <?php esc_html_e( 'Relationships', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 203 | </td> |
| 204 | </tr> |
| 205 | <tr class="pods-wizard-table-pending" data-upgrade="settings"> |
| 206 | <td class="pods-wizard-right pods-wizard-status"> |
| 207 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 208 | </td> |
| 209 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 210 | <td class="pods-wizard-name"> |
| 211 | <?php esc_html_e( 'Settings', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 212 | </td> |
| 213 | </tr> |
| 214 | <tr class="pods-wizard-table-pending" data-upgrade="templates"> |
| 215 | <td class="pods-wizard-right pods-wizard-status"> |
| 216 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 217 | </td> |
| 218 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 219 | <td class="pods-wizard-name"> |
| 220 | <?php esc_html_e( 'Templates', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 221 | </td> |
| 222 | </tr> |
| 223 | <tr class="pods-wizard-table-pending" data-upgrade="pages"> |
| 224 | <td class="pods-wizard-right pods-wizard-status"> |
| 225 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 226 | </td> |
| 227 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 228 | <td class="pods-wizard-name"> |
| 229 | <?php esc_html_e( 'Pod Pages', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 230 | </td> |
| 231 | </tr> |
| 232 | <tr class="pods-wizard-table-pending" data-upgrade="helpers"> |
| 233 | <td class="pods-wizard-right pods-wizard-status"> |
| 234 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 235 | </td> |
| 236 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 237 | <td class="pods-wizard-name"> |
| 238 | <?php esc_html_e( 'Helpers', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 239 | </td> |
| 240 | </tr> |
| 241 | <?php |
| 242 | foreach ( $pods as $pod ) { |
| 243 | ?> |
| 244 | <tr class="pods-wizard-table-pending" data-upgrade="pod" data-pod="<?php echo esc_attr( $pod->name ); ?>"> |
| 245 | <td class="pods-wizard-right pods-wizard-status"> |
| 246 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 247 | </td> |
| 248 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 249 | <td class="pods-wizard-name"> |
| 250 | <?php echo esc_html( __( 'Content', 'pods' ) . ': ' . $pod->name ); ?> |
| 251 | <span class="pods-wizard-info"></span> |
| 252 | </td> |
| 253 | </tr> |
| 254 | <?php |
| 255 | } |
| 256 | ?> |
| 257 | <tr class="pods-wizard-table-pending" data-upgrade="cleanup"> |
| 258 | <td class="pods-wizard-right pods-wizard-status"> |
| 259 | <i><img src="<?php echo esc_url( PODS_URL ); ?>ui/images/spinner.gif" alt="Loading..." /></i> |
| 260 | </td> |
| 261 | <td class="pods-wizard-right pods-wizard-count">—</td> |
| 262 | <td class="pods-wizard-name"> |
| 263 | <?php esc_html_e( 'Cleanup', 'pods' ); ?> <span class="pods-wizard-info"></span> |
| 264 | </td> |
| 265 | </tr> |
| 266 | </tbody> |
| 267 | </table> |
| 268 | </div> |
| 269 | <!-- // Mirate Panel --> |
| 270 | |
| 271 | </div> |
| 272 | <div id="pods-wizard-actions"> |
| 273 | <div id="pods-wizard-toolbar"> |
| 274 | <a href="#start" id="pods-wizard-start" class="button button-secondary"><?php esc_html_e( 'Start Over', 'pods' ); ?></a> |
| 275 | <a href="#next" id="pods-wizard-next" class="button button-primary" data-next="<?php esc_attr_e( 'Next Step', 'pods' ); ?>" data-finished="<?php esc_attr_e( 'Start using Pods', 'pods' ); ?>"><?php esc_html_e( 'Next Step', 'pods' ); ?></a> |
| 276 | </div> |
| 277 | <div id="pods-wizard-finished"> |
| 278 | <?php esc_html_e( 'Migration Complete!', 'pods' ); ?> |
| 279 | </div> |
| 280 | </div> |
| 281 | </div> |
| 282 | </div> |
| 283 | |
| 284 | <script> |
| 285 | var pods_admin_wizard_callback = function ( step ) { |
| 286 | jQuery( '#pods-wizard-start, #pods-wizard-next' ).hide(); |
| 287 | |
| 288 | if ( step == 2 ) { |
| 289 | jQuery( '#pods-wizard-box' ).PodsUpgrade( 'prepare' ); |
| 290 | |
| 291 | return false; |
| 292 | } |
| 293 | else { |
| 294 | if ( step == 3 ) { |
| 295 | jQuery( '#pods-wizard-box' ).PodsUpgrade( 'migrate' ); |
| 296 | } |
| 297 | } |
| 298 | }; |
| 299 | |
| 300 | jQuery( function ( $ ) { |
| 301 | $( '#pods-wizard-box' ).Pods( 'wizard' ); |
| 302 | } ); |
| 303 | </script> |
| 304 |