PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/wp-content/plugins/backupbuddy/controllers/pages/_ms_import/_step1.php

https://bitbucket.org/betaimages/chakalos
PHP | 116 lines | 93 code | 20 blank | 3 comment | 14 complexity | dfdcff535f09bb4e3447f099efbd2da3 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. // This is a half-way conversion from RH's implementation into framework and reusing libraries.
  3. // Still a ways to go...
  4. //STEP 1
  5. $form_url = add_query_arg( array( 'action' => 'step2' ) , pb_backupbuddy::page_url() );
  6. global $current_site;
  7. ?>
  8. <?php _e( 'Multisite import allows you to import a site from a BackupBuddy backup archive as a new site within this Multisite network with a new URL. Please upload your BackupBuddy backup archive into the root of your site before proceeding or select an existing backup.','it-l10n-backupbuddy' ) ?>
  9. <?php _e( 'Only FULL backups may be imported into a Multisite Network.' ); ?>
  10. <br><br>
  11. <form method="post" action="<?php echo esc_url( $form_url ); ?>">
  12. <?php wp_nonce_field( 'bbms-migration', 'pb_bbms_migrate' ); ?>
  13. <table class="form-table">
  14. <tr class="form-field form-required">
  15. <th scope="row">Backup file to import</th>
  16. <td>
  17. <?php
  18. echo 'Backups in site root:<br>';
  19. $files = glob( ABSPATH . 'backup*.zip' );
  20. if ( !is_array( $files ) || empty( $files ) ) {
  21. $files = array();
  22. }
  23. foreach( $files as $i => $file ) {
  24. ?>
  25. <input style="width: auto;" type='radio' id='backup_<?php echo esc_attr( $i ); ?>' value='<?php echo esc_attr( $file );?>'
  26. <?php
  27. if ( count( $files ) == 1 ) {
  28. echo ' CHECKED';
  29. }
  30. ?> name='backup_file' />&nbsp;&nbsp;<label for='backup_<?php echo esc_attr( $i ); ?>'><?php echo esc_html( basename( $file ) ); ?></label><br />
  31. <?php
  32. }
  33. if ( count( $files ) == 0 ) {
  34. _e( 'No BackupBuddy backups found in the root directory of the site.','it-l10n-backupbuddy' );
  35. echo '<br>';
  36. }
  37. echo '<br>';
  38. echo 'Existing backups in this site\'s backup directory:';
  39. echo '<br>';
  40. $files = glob( pb_backupbuddy::$options['backup_directory'] . 'backup*.zip' );
  41. if ( !is_array( $files ) || empty( $files ) ) {
  42. $files = array();
  43. }
  44. foreach( $files as $i => $file ) {
  45. ?>
  46. <input style="width: auto;" type='radio' id='backup_<?php echo esc_attr( $i ); ?>' value='<?php echo esc_attr( $file );?>'
  47. <?php
  48. if ( count( $files ) == 1 ) {
  49. echo ' CHECKED';
  50. }
  51. ?> name='backup_file' />&nbsp;&nbsp;<label for='backup_<?php echo esc_attr( $i ); ?>'><?php echo esc_html( basename( $file ) ); ?></label><br />
  52. <?php
  53. }
  54. if ( count( $files ) == 0 ) {
  55. _e( 'No BackupBuddy backups found in this site\'s backup directory.','it-l10n-backupbuddy' );
  56. echo '<br>';
  57. }
  58. ?>
  59. </td>
  60. </tr>
  61. <tr>
  62. <th scope="row"><?php _e( 'New site address','it-l10n-backupbuddy' ) ?></th>
  63. <td>
  64. <?php if ( is_subdomain_install() ) { ?>
  65. <span> </span><input name="blog[domain]" type="text" class="regular-text" title="<?php _e( 'Domain','it-l10n-backupbuddy' ) ?>" style="width: 25em;">
  66. <?php } else {
  67. echo 'http://' . $current_blog->domain . $current_blog->path ?><input name="blog[domain]" class="regular-text" type="text" title="<?php _e( 'Domain','it-l10n-backupbuddy' ) ?>" style="width: 25em;">
  68. <?php }
  69. echo '<p class="description">' . __( 'Only the characters a-z and 0-9 recommended.','it-l10n-backupbuddy' ) . '</p>';
  70. ?>
  71. <p class='description'><?php esc_html_e( 'If the site already exists and is mapped into a different domain, simply use the domain name (e.g., jubyo.com)','it-l10n-backupbuddy' ); ?></p>
  72. <br>
  73. <?php // These advanced options will be available via $this->advanced_options from within the msimport class on each page. Passed along in the submitted form per step. ?>
  74. <span class="pb_toggle button-secondary" id="advanced">Advanced Configuration Options</span>
  75. <div id="pb_toggle-advanced" class="pb_toggled" style="margin-top: 12px; width: 600px;">
  76. <b>WARNING:</b> Improper use of Advanced Options could result in data loss.<br><br>
  77. <input type="hidden" name="advanced_options[skip_files]" value="false">
  78. <input type="checkbox" name="advanced_options[skip_files]" value="true"> Skip zip file extraction. <?php pb_backupbuddy::tip( 'Checking this box will prevent extraction/unzipping of the backup ZIP file. You will need to manually extract it either on your local computer then upload it or use a server-based tool such as cPanel to extract it. This feature is useful if the extraction step is unable to complete for some reason.' ); ?><br>
  79. <input type="hidden" name="advanced_options[ignore_sql_errors]" value="false">
  80. <input type="checkbox" name="advanced_options[ignore_sql_errors]" value="true" /> Ignore SQL errors & hide them. <br>
  81. <input type="hidden" name="advanced_options[skip_database_import]" value="false">
  82. <input type="checkbox" name="advanced_options[skip_database_import]" value="true" /> Skip import of database. <br>
  83. <input type="hidden" name="advanced_options[skip_database_migration]" value="false">
  84. <input type="checkbox" name="advanced_options[skip_database_migration]" value="true" /> Skip migration of database. <br>
  85. <input type="hidden" name="advanced_options[force_compatibility_medium]" value="false">
  86. <input type="checkbox" name="advanced_options[force_compatibility_medium]" value="true" /> Force medium speed compatibility mode (ZipArchive). <br>
  87. <input type="hidden" name="advanced_options[force_compatibility_slow]" value="false">
  88. <input type="checkbox" name="advanced_options[force_compatibility_slow]" value="true" /> Force slow speed compatibility mode (PCLZip). <br>
  89. <br>
  90. PHP Maximum Execution Time: <input type="text" name="advanced_options[max_execution_time]" value="<?php echo $this->detected_max_execution_time; ?>" size="5"> seconds. <?php pb_backupbuddy::tip( 'The maximum allowed PHP runtime. If your database import step is timing out then lowering this value will instruct the script to limit each `chunk` to allow it to finish within this time period.' ); ?>
  91. </div>
  92. </td>
  93. </tr>
  94. </table>
  95. <?php submit_button( __('Next Step') . ' &raquo;', 'primary', 'add-site' ); ?>
  96. </form>