database-tables.php
46 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @var stdClass $options |
| 5 | * |
| 6 | * @see \WPStaging\Backend\Modules\Jobs\Scan::start For details on $options. |
| 7 | */ |
| 8 | |
| 9 | use WPStaging\Backend\Modules\Jobs\Job; |
| 10 | |
| 11 | ?> |
| 12 | <?php |
| 13 | do_action("wpstg_scanning_db"); |
| 14 | $dbPrefix = WPStaging\Core\WPStaging::getTablePrefix(); |
| 15 | ?> |
| 16 | <p> |
| 17 | <strong><?php esc_html_e("Select Tables to Copy", "wp-staging"); ?></strong> |
| 18 | <br> |
| 19 | <?php echo sprintf(esc_html__("Tables with the live site prefix %s have been selected.", "wp-staging"), "<code>" . esc_html($dbPrefix) . "</code>"); ?> |
| 20 | </p> |
| 21 | <p style="display: none;"> |
| 22 | <?php esc_html_e("Selected tables will be copied/replaced with the tables from the production site.", "wp-staging"); ?> |
| 23 | </p> |
| 24 | <div class="wpstg-my-10px"> |
| 25 | <button type="button" class="wpstg-button-unselect button"><?php esc_html_e('Unselect All', 'wp-staging'); ?></button> |
| 26 | <button type="button" class="wpstg-button-select button"> <?php echo esc_html($dbPrefix); ?> </button> |
| 27 | </div> |
| 28 | <select multiple="multiple" id="wpstg_select_tables_cloning"> |
| 29 | <?php |
| 30 | foreach ($options->tables as $table) : |
| 31 | $attributes = !in_array($table->name, $options->excludedTables) && (strpos($table->name, $dbPrefix) === 0) ? "selected='selected'" : ""; |
| 32 | if (($options->mainJob === Job::UPDATE || $options->mainJob === Job::RESET) && isset($options->currentClone['includedTables'])) { |
| 33 | $attributes = !in_array($table->name, $options->excludedTables) && in_array($table->name, $options->currentClone['includedTables']) ? "selected='selected'" : ""; |
| 34 | } |
| 35 | |
| 36 | $attributes .= in_array($table->name, $options->clonedTables) ? "disabled" : ''; |
| 37 | ?> |
| 38 | <option class="wpstg-db-table" value="<?php echo esc_attr($table->name); ?>" name="<?php echo esc_attr($table->name); ?>" <?php echo esc_html($attributes); ?>> |
| 39 | <?php echo esc_html($table->name); ?> - <?php echo esc_html(size_format($table->size, 2)); ?> |
| 40 | </option> |
| 41 | <?php endforeach ?> |
| 42 | </select> |
| 43 | <p> |
| 44 | <?php esc_html_e("You can select multiple tables. Press left mouse button & move or press STRG+Left mouse button. (Apple: ⌘+Left Mouse Button)", "wp-staging"); ?> |
| 45 | </p> |
| 46 |