cron-setting.php
4 months ago
custom-directory.php
1 month ago
directory-navigation.php
1 week ago
exclude-settings.php
4 months ago
external-database.php
2 months ago
login-data.php
3 months ago
mail-setting.php
4 months ago
plugins-update.php
1 year ago
process-lock.php
1 year ago
scan.php
1 week ago
start.php
1 year ago
symlink-uploads.php
1 year ago
update.php
1 year ago
external-database.php
89 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is currently being called for both FREE and PRO version: |
| 5 | * src/views/clone/ajax/scan.php |
| 6 | * |
| 7 | * @var \WPStaging\Backend\Modules\Jobs\Scan $scan |
| 8 | * @var stdClass $options |
| 9 | * @var boolean $isPro |
| 10 | * @var \wpdb $db |
| 11 | * |
| 12 | * @see \WPStaging\Backend\Modules\Jobs\Scan::start For details on $options. |
| 13 | */ |
| 14 | |
| 15 | use WPStaging\Framework\Facades\Sanitize; |
| 16 | use WPStaging\Framework\Facades\UI\Checkbox; |
| 17 | |
| 18 | $database = ''; |
| 19 | $username = ''; |
| 20 | $password = ''; |
| 21 | $prefix = ''; |
| 22 | $server = ''; |
| 23 | $useSsl = false; |
| 24 | $isDisabled = false; |
| 25 | |
| 26 | if (!$isPro) { |
| 27 | $isDisabled = true; |
| 28 | } |
| 29 | |
| 30 | if ($isPro && !empty($options->current) && $options->current !== null) { |
| 31 | $database = isset($options->existingClones[$options->current]['databaseDatabase']) ? Sanitize::sanitizeString($options->existingClones[$options->current]['databaseDatabase']) : ''; |
| 32 | $username = isset($options->existingClones[$options->current]['databaseUser']) ? Sanitize::sanitizeString($options->existingClones[$options->current]['databaseUser']) : ''; |
| 33 | $prefix = isset($options->existingClones[$options->current]['databasePrefix']) ? Sanitize::sanitizeString($options->existingClones[$options->current]['databasePrefix']) : ''; |
| 34 | $server = isset($options->existingClones[$options->current]['databaseServer']) ? Sanitize::sanitizeString($options->existingClones[$options->current]['databaseServer']) : ''; |
| 35 | $useSsl = !empty($options->existingClones[$options->current]['databaseSsl']); |
| 36 | $isDisabled = true; |
| 37 | $password = '*********'; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Avoid renaming the 'wpstg-db-user' field to 'wpstg-db-username' or simply 'username', |
| 42 | * and 'wpstg-db-pass' to 'wpstg-db-password' or 'password'. |
| 43 | * Renaming may lead to unintended autofill behavior if the fields are disabled. |
| 44 | */ |
| 45 | ?> |
| 46 | |
| 47 | <div class="wpstg--advanced-settings--checkbox"> |
| 48 | <label for="wpstg-ext-db"><?php esc_html_e('Change Database', 'wp-staging'); ?></label> |
| 49 | <?php Checkbox::render('wpstg-ext-db', 'wpstg-ext-db', 'true', false, ['classes' => 'wpstg-toggle-advance-settings-section', 'isDisabled' => !$isPro], ['id' => 'wpstg-external-db-section']); ?> |
| 50 | <span class="wpstg--tooltip"> |
| 51 | <img class="wpstg--dashicons" src="<?php echo esc_attr($scan->getInfoIcon()); ?>" alt="info" /> |
| 52 | <span class="wpstg--tooltiptext"> |
| 53 | <?php echo wp_kses_post(__('You can clone the staging site into a separate database. The Database must be created manually in advance before starting the cloning proccess.<br/><br/><strong>Note:</strong> If there are already tables with the same database prefix and name in this database, the cloning process will be aborted without any further asking!', 'wp-staging')); ?> |
| 54 | </span> |
| 55 | </span> |
| 56 | </div> |
| 57 | <div id="wpstg-external-db-section" <?php echo $isPro === true ? 'style="display: none;"' : '' ?>> |
| 58 | <div class="wpstg-form-group wpstg-text-field"> |
| 59 | <label for="wpstg-db-server"><?php esc_html_e('Server: ', 'wp-staging'); ?> </label> |
| 60 | <input type="text" class="wpstg-textbox" name="wpstg-db-server" id="wpstg-db-server" value="<?php echo esc_attr($server); ?>" title="wpstg-db-server" placeholder="localhost" autocapitalize="off" <?php echo $isDisabled ? 'disabled' : '' ?> readonly> |
| 61 | </div> |
| 62 | <div class="wpstg-form-group wpstg-text-field"> |
| 63 | <label for="wpstg-db-user"><?php esc_html_e('User: ', 'wp-staging'); ?></label> |
| 64 | <input type="text" class="wpstg-textbox" name="wpstg-db-user" id="wpstg-db-user" value="<?php echo esc_attr($username); ?>" autocapitalize="off" <?php echo $isDisabled ? 'disabled' : '' ?> readonly /> |
| 65 | </div> |
| 66 | <form> |
| 67 | <div class="wpstg-form-group wpstg-text-field"> |
| 68 | <label for="wpstg-db-pass"><?php esc_html_e('Password: ', 'wp-staging'); ?></label> |
| 69 | <input type="password" class="wpstg-textbox" name="wpstg-db-pass" id="wpstg-db-pass" value="<?php echo esc_attr($password); ?>" <?php echo $isDisabled ? 'disabled' : '' ?> readonly autocomplete="off" /> |
| 70 | </div> |
| 71 | </form> |
| 72 | <div class="wpstg-form-group wpstg-text-field"> |
| 73 | <label for="wpstg-db-database"><?php esc_html_e('Database: ', 'wp-staging'); ?></label> |
| 74 | <input type="text" class="wpstg-textbox" name="wpstg-db-database" id="wpstg-db-database" value="<?php echo esc_attr($database); ?>" autocapitalize="off" <?php echo $isDisabled ? 'disabled' : '' ?> readonly /> |
| 75 | </div> |
| 76 | <div class="wpstg-form-group wpstg-text-field"> |
| 77 | <label for="wpstg-db-prefix"><?php esc_html_e('Database Prefix: ', 'wp-staging'); ?></label> |
| 78 | <input type="text" class="wpstg-textbox" name="wpstg-db-prefix" id="wpstg-db-prefix" value="<?php echo esc_attr($prefix); ?>" placeholder="<?php echo $db->prefix; ?>" autocapitalize="off" <?php echo $isDisabled ? 'disabled' : '' ?> readonly /> |
| 79 | </div> |
| 80 | <div class="wpstg--advanced-settings--checkbox"> |
| 81 | <label for="wpstg-db-ssl"><?php esc_html_e('Enable SSL: ', 'wp-staging'); ?></label> |
| 82 | <?php Checkbox::render('wpstg-db-ssl', 'wpstg-db-ssl', 'true', $useSsl, ['isDisabled' => $isDisabled]); ?> |
| 83 | </div> |
| 84 | <div class="wpstg-form-group wpstg-text-field wpstg-mt-10px"> |
| 85 | <a href="#" id="wpstg-db-connect"><?php esc_html_e("Test Database Connection", "wp-staging"); ?></a> |
| 86 | </div> |
| 87 | <hr /> |
| 88 | </div> |
| 89 |