WP Migrate DB - Version 0.4.3

Version Description

  • 2012-12-18 =
  • Fixed deprecated error notices when debug mode is on
  • Bug fix: Exports views as tables
  • Compatibility tested with WordPress 3.5
Download this release

Release Info

Developer bradt
Plugin Icon 128x128 WP Migrate DB
Version 0.4.3
Comparing to
See all releases

Code changes from version 0.4.2 to 0.4.3

asset/css/styles.css CHANGED
@@ -99,13 +99,13 @@ p.submit img {
99
  margin: 0;
100
  }
101
  /* line 97, ../sass/styles.scss */
102
- #wpmdb-sidebar .poll {
103
  padding-bottom: 20px;
104
  margin-bottom: 20px;
105
  border-bottom: 1px solid #ccc;
106
  }
107
  /* line 102, ../sass/styles.scss */
108
- #wpmdb-sidebar .poll h2 {
109
  padding: 0;
110
  margin: 0;
111
  margin-bottom: 0.5em;
@@ -113,62 +113,72 @@ p.submit img {
113
  font-size: 20px;
114
  }
115
  /* line 110, ../sass/styles.scss */
116
- #wpmdb-sidebar .poll ul {
117
  list-style-type: disc;
118
  }
119
  /* line 114, ../sass/styles.scss */
120
- #wpmdb-sidebar .poll li {
121
  margin-left: 1.5em;
122
  color: #666;
123
  }
124
  /* line 119, ../sass/styles.scss */
125
- #wpmdb-sidebar .poll p {
126
  margin: 0;
127
  }
128
  /* line 123, ../sass/styles.scss */
129
- #wpmdb-sidebar .poll .error {
 
 
 
 
130
  color: red;
131
  font-weight: bold;
132
  margin-bottom: 1em;
133
  }
134
- /* line 129, ../sass/styles.scss */
135
- #wpmdb-sidebar .poll .thanks {
136
  color: #333;
 
 
137
  }
138
- /* line 133, ../sass/styles.scss */
139
- #wpmdb-sidebar .poll .field {
140
  margin-bottom: 1em;
141
  }
142
- /* line 136, ../sass/styles.scss */
143
- #wpmdb-sidebar .poll .field p {
144
  margin-bottom: 0.3em;
145
  }
146
- /* line 140, ../sass/styles.scss */
147
- #wpmdb-sidebar .poll .field .willing-copy {
148
  font-weight: bold;
149
  font-size: 14px;
150
  line-height: 1.4em;
151
  margin-bottom: 1em;
152
  }
153
- /* line 148, ../sass/styles.scss */
154
- #wpmdb-sidebar .poll .field.how-much input {
155
  width: 50px;
156
  }
157
- /* line 154, ../sass/styles.scss */
158
- #wpmdb-sidebar .poll .field.notify-me input {
159
  position: absolute;
160
  }
161
- /* line 158, ../sass/styles.scss */
162
- #wpmdb-sidebar .poll .field.notify-me label {
163
  display: block;
164
  padding-left: 20px;
165
  }
166
- /* line 166, ../sass/styles.scss */
167
- #wpmdb-sidebar .poll .field.comments textarea {
168
  width: 230px;
169
  height: 3em;
170
  }
171
- /* line 171, ../sass/styles.scss */
172
- #wpmdb-sidebar .poll .field.comments textarea.has-content, #wpmdb-sidebar .poll .field.comments textarea:focus {
173
  height: 5em;
174
  }
 
 
 
 
99
  margin: 0;
100
  }
101
  /* line 97, ../sass/styles.scss */
102
+ #wpmdb-sidebar .subscribe {
103
  padding-bottom: 20px;
104
  margin-bottom: 20px;
105
  border-bottom: 1px solid #ccc;
106
  }
107
  /* line 102, ../sass/styles.scss */
108
+ #wpmdb-sidebar .subscribe h2 {
109
  padding: 0;
110
  margin: 0;
111
  margin-bottom: 0.5em;
113
  font-size: 20px;
114
  }
115
  /* line 110, ../sass/styles.scss */
116
+ #wpmdb-sidebar .subscribe ul {
117
  list-style-type: disc;
118
  }
119
  /* line 114, ../sass/styles.scss */
120
+ #wpmdb-sidebar .subscribe li {
121
  margin-left: 1.5em;
122
  color: #666;
123
  }
124
  /* line 119, ../sass/styles.scss */
125
+ #wpmdb-sidebar .subscribe p {
126
  margin: 0;
127
  }
128
  /* line 123, ../sass/styles.scss */
129
+ #wpmdb-sidebar .subscribe p.interesting {
130
+ margin-bottom: 1em;
131
+ }
132
+ /* line 127, ../sass/styles.scss */
133
+ #wpmdb-sidebar .subscribe .error {
134
  color: red;
135
  font-weight: bold;
136
  margin-bottom: 1em;
137
  }
138
+ /* line 133, ../sass/styles.scss */
139
+ #wpmdb-sidebar .subscribe .thanks {
140
  color: #333;
141
+ font-weight: bold;
142
+ font-size: 14px;
143
  }
144
+ /* line 139, ../sass/styles.scss */
145
+ #wpmdb-sidebar .subscribe .field {
146
  margin-bottom: 1em;
147
  }
148
+ /* line 142, ../sass/styles.scss */
149
+ #wpmdb-sidebar .subscribe .field p {
150
  margin-bottom: 0.3em;
151
  }
152
+ /* line 146, ../sass/styles.scss */
153
+ #wpmdb-sidebar .subscribe .field .willing-copy {
154
  font-weight: bold;
155
  font-size: 14px;
156
  line-height: 1.4em;
157
  margin-bottom: 1em;
158
  }
159
+ /* line 154, ../sass/styles.scss */
160
+ #wpmdb-sidebar .subscribe .field.how-much input {
161
  width: 50px;
162
  }
163
+ /* line 160, ../sass/styles.scss */
164
+ #wpmdb-sidebar .subscribe .field.notify-me input {
165
  position: absolute;
166
  }
167
+ /* line 164, ../sass/styles.scss */
168
+ #wpmdb-sidebar .subscribe .field.notify-me label {
169
  display: block;
170
  padding-left: 20px;
171
  }
172
+ /* line 172, ../sass/styles.scss */
173
+ #wpmdb-sidebar .subscribe .field.comments textarea {
174
  width: 230px;
175
  height: 3em;
176
  }
177
+ /* line 177, ../sass/styles.scss */
178
+ #wpmdb-sidebar .subscribe .field.comments textarea.has-content, #wpmdb-sidebar .subscribe .field.comments textarea:focus {
179
  height: 5em;
180
  }
181
+ /* line 183, ../sass/styles.scss */
182
+ #wpmdb-sidebar .subscribe .field.submit-button {
183
+ margin-bottom: 0;
184
+ }
asset/js/script.js CHANGED
@@ -18,14 +18,12 @@
18
  var $sidebar = $(this);
19
 
20
  $('form', $sidebar).submit(function() {
21
- if (!$('input[name=notify-me]', $sidebar).attr('checked')) {
22
- $('input[name=notify-email]', $sidebar).val('');
23
- }
24
-
25
  var $form = $(this),
26
  data = $(this).serializeArray();
27
 
28
- data.push({name: 'action', value: 'poll_submission'});
 
 
29
 
30
  $.post( ajaxurl, data, function(result) {
31
  if (result) {
@@ -34,35 +32,13 @@
34
  $('.error', $sidebar).fadeIn();
35
  }
36
  else {
37
- $form.html('<p class="thanks">Thanks for your input.</p>').fadeIn();
38
  document.location.hash = '#top';
39
  }
40
  });
41
  return false;
42
  });
43
 
44
- $('input[name=willing-pay]', $sidebar).change(function() {
45
- var $yes_questions = $('.yes-questions', $sidebar);
46
- if ('Yes' == $(this).val()) {
47
- $yes_questions.show();
48
- }
49
- else {
50
- $yes_questions.hide();
51
- }
52
-
53
- $('.field.comments', $sidebar).show();
54
- });
55
-
56
- $('input[name=notify-me]', $sidebar).click(function() {
57
- var $notify_email = $('.notify-email', $sidebar);
58
- if ($(this).attr('checked')) {
59
- $notify_email.show();
60
- }
61
- else {
62
- $notify_email.hide();
63
- }
64
- });
65
-
66
  $('.field.comments textarea', $sidebar).blur(function() {
67
  if ($(this).val()) {
68
  $(this).addClass('has-content');
@@ -70,7 +46,7 @@
70
  else {
71
  $(this).removeClass('has-content');
72
  }
73
- })
74
  });
75
  });
76
 
18
  var $sidebar = $(this);
19
 
20
  $('form', $sidebar).submit(function() {
 
 
 
 
21
  var $form = $(this),
22
  data = $(this).serializeArray();
23
 
24
+ $('.button', $form).attr('disabled', 'true');
25
+
26
+ data.push({name: 'action', value: 'subscribe_submission'});
27
 
28
  $.post( ajaxurl, data, function(result) {
29
  if (result) {
32
  $('.error', $sidebar).fadeIn();
33
  }
34
  else {
35
+ $form.html('<p class="thanks">Thanks for subscribing. We promise to protect your email from weasels.</p>').fadeIn();
36
  document.location.hash = '#top';
37
  }
38
  });
39
  return false;
40
  });
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  $('.field.comments textarea', $sidebar).blur(function() {
43
  if ($(this).val()) {
44
  $(this).addClass('has-content');
46
  else {
47
  $(this).removeClass('has-content');
48
  }
49
+ });
50
  });
51
  });
52
 
asset/sass/styles.scss CHANGED
@@ -94,7 +94,7 @@ p.submit {
94
  }
95
  }
96
 
97
- .poll {
98
  padding-bottom: 20px;
99
  margin-bottom: 20px;
100
  border-bottom: 1px solid #ccc;
@@ -120,6 +120,10 @@ p.submit {
120
  margin: 0;
121
  }
122
 
 
 
 
 
123
  .error {
124
  color: red;
125
  font-weight: bold;
@@ -128,6 +132,8 @@ p.submit {
128
 
129
  .thanks {
130
  color: #333;
 
 
131
  }
132
 
133
  .field {
@@ -173,6 +179,10 @@ p.submit {
173
  }
174
  }
175
  }
 
 
 
 
176
  }
177
  }
178
  }
94
  }
95
  }
96
 
97
+ .subscribe {
98
  padding-bottom: 20px;
99
  margin-bottom: 20px;
100
  border-bottom: 1px solid #ccc;
120
  margin: 0;
121
  }
122
 
123
+ p.interesting {
124
+ margin-bottom: 1em;
125
+ }
126
+
127
  .error {
128
  color: red;
129
  font-weight: bold;
132
 
133
  .thanks {
134
  color: #333;
135
+ font-weight: bold;
136
+ font-size: 14px;
137
  }
138
 
139
  .field {
179
  }
180
  }
181
  }
182
+
183
+ &.submit-button {
184
+ margin-bottom: 0;
185
+ }
186
  }
187
  }
188
  }
readme.txt CHANGED
@@ -3,20 +3,22 @@ Contributors: bradt
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5VPMGLLK94XJC
4
  Tags: database, migrate, backup, mysql
5
  Requires at least: 2.0.3
6
- Tested up to: 3.4.2
7
- Stable tag: 0.4.2
8
  License: GPLv2
9
 
10
  Exports your database, does a find and replace on URLs and file paths, then allows you to save it to your computer.
11
 
12
  == Description ==
13
 
14
- WP Migrate DB exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer. It is perfect for developers who develop locally and need to to move their Wordpress site to a staging or production server.
15
 
16
  It even takes into account serialized data and updates the string length values.
17
 
18
  Example: <code>s:5:"hello"</code> becomes <code>s:11:"hello world"</code>
19
 
 
 
20
  == Installation ==
21
 
22
  1. Use WordPress' built-in installer
@@ -29,6 +31,11 @@ Example: <code>s:5:"hello"</code> becomes <code>s:11:"hello world"</code>
29
 
30
  == Changelog ==
31
 
 
 
 
 
 
32
  = 0.4.2 - 2012-09-13 =
33
  * Moved screenshots to /assets folder and updated them to support retina
34
  * Added sidebar including author profile and survey to gauge interest for a pro version
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5VPMGLLK94XJC
4
  Tags: database, migrate, backup, mysql
5
  Requires at least: 2.0.3
6
+ Tested up to: 3.5
7
+ Stable tag: 0.4.3
8
  License: GPLv2
9
 
10
  Exports your database, does a find and replace on URLs and file paths, then allows you to save it to your computer.
11
 
12
  == Description ==
13
 
14
+ WP Migrate DB exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer. It is perfect for developers who develop locally and need to move their Wordpress site to a staging or production server.
15
 
16
  It even takes into account serialized data and updates the string length values.
17
 
18
  Example: <code>s:5:"hello"</code> becomes <code>s:11:"hello world"</code>
19
 
20
+ [**Contribute on Github**](https://github.com/bradt/wp-migrate-db)
21
+
22
  == Installation ==
23
 
24
  1. Use WordPress' built-in installer
31
 
32
  == Changelog ==
33
 
34
+ = 0.4.3 - 2012-12-18 =
35
+ * Fixed deprecated error notices when debug mode is on
36
+ * Bug fix: [Exports views as tables](https://github.com/bradt/wp-migrate-db/issues/3)
37
+ * Compatibility tested with WordPress 3.5
38
+
39
  = 0.4.2 - 2012-09-13 =
40
  * Moved screenshots to /assets folder and updated them to support retina
41
  * Added sidebar including author profile and survey to gauge interest for a pro version
wp-migrate-db.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP-Migrate-DB
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-migrate-db/
5
  Description: Exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer.
6
  Author: Brad Touesnard
7
- Version: 0.4.2
8
  Author URI: http://bradt.ca/
9
  */
10
 
@@ -58,13 +58,13 @@ class WP_Migrate_DB {
58
  $this->replaced['nonserialized']['count'] = 0;
59
 
60
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
61
- add_action( 'wp_ajax_poll_submission', array( $this, 'poll_submission' ) );
62
 
63
  $this->handle_request();
64
  }
65
 
66
- function poll_submission() {
67
- $response = wp_remote_post( 'http://bradt.ca/wpmdb-poll.php', array(
68
  'timeout' => 60,
69
  'body' => $_POST
70
  ));
@@ -192,14 +192,14 @@ class WP_Migrate_DB {
192
  $form_values = $_POST;
193
  }
194
  else {
195
- $form_values['old_url'] = get_bloginfo('siteurl');
196
 
197
  $form_values['old_path'] = dirname(__FILE__);
198
  $form_values['old_path'] = str_replace(DS . 'wp-migrate-db', '', $form_values['old_path']);
199
  $form_values['old_path'] = realpath($form_values['old_path'] . '/../..');
200
 
201
- if (get_bloginfo('siteurl') != get_bloginfo('wpurl')) {
202
- $wp_dir = str_replace(get_bloginfo('siteurl'), '', get_bloginfo('wpurl'));
203
  $wp_dir = str_replace('/', DS, $wp_dir);
204
  $form_values['old_path'] = str_replace($wp_dir, '', $form_values['old_path']);
205
  }
@@ -370,56 +370,49 @@ class WP_Migrate_DB {
370
  </div>
371
  </div>
372
 
373
- <form method="post" action="http://bradt.ca/wpmdb-poll.php" class="poll">
374
- <h2>PRO Version?</h2>
375
  <p>
376
- What if there was a PRO version of this plugin that included the following?
377
  </p>
378
 
379
  <ul>
380
  <li>
381
- One click to transmit the data to the migrated
382
- site and import it. No downloading, no uploading,
383
- no command line, no phpMyAdmin.
384
  </li>
385
  <li>
386
- Automatically keep your local dev database
387
- in-sync with the live production database.
 
 
 
388
  <li>
389
- 1 year of updates and priority email support.
 
 
 
 
 
 
 
390
  </li>
391
  </ul>
392
 
393
- <div class="field">
394
- <p class="willing-copy">Is that something you'd be willing to pay for?</p>
395
- <label><input type="radio" name="willing-pay" value="Yes" /> Yes</label>
396
- &nbsp;&nbsp;&nbsp;&nbsp;
397
- <label><input type="radio" name="willing-pay" value="No" /> No</label>
398
- </div>
399
-
400
- <div class="yes-questions" style="display: none;">
401
 
402
- <div class="field how-much">
403
- <p>How much would you pay?</p>
404
- $ <input type="text" name="how-much" /> USD
405
- </div>
406
 
407
- <div class="field notify-me">
408
- <input type="checkbox" name="notify-me" value="Yes" id="notify-me" />
409
- <label for="notify-me">
410
- Send me an email if this thing ever gets off the ground.
411
- </label>
412
- </div>
413
-
414
- <div class="field notify-email" style="display: none;">
415
- <p>Your Email</p>
416
- <?php $user = wp_get_current_user(); ?>
417
- <input type="email" name="notify-email" value="<?php echo esc_attr( $user->user_email ); ?>" />
418
- </div>
419
 
 
 
 
420
  </div>
421
 
422
- <div class="field comments" style="display: none;">
423
  <p>Comments (optional)</p>
424
  <textarea name="comments"></textarea>
425
  </div>
@@ -664,8 +657,7 @@ class WP_Migrate_DB {
664
  function db_backup() {
665
  global $table_prefix, $wpdb;
666
 
667
- $tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
668
- $tables = array_map(create_function('$a', 'return $a[0];'), $tables);
669
 
670
  /*
671
  if (is_writable($this->backup_dir)) {
@@ -680,6 +672,8 @@ class WP_Migrate_DB {
680
  }*/
681
 
682
  foreach ($tables as $table) {
 
 
683
  // Increase script execution time-limit to 15 min for every table.
684
  if ( !ini_get('safe_mode')) @set_time_limit(15*60);
685
  // Create the SQL statements
4
  Plugin URI: http://wordpress.org/extend/plugins/wp-migrate-db/
5
  Description: Exports your database as a MySQL data dump (much like phpMyAdmin), does a find and replace on URLs and file paths, then allows you to save it to your computer.
6
  Author: Brad Touesnard
7
+ Version: 0.4.3
8
  Author URI: http://bradt.ca/
9
  */
10
 
58
  $this->replaced['nonserialized']['count'] = 0;
59
 
60
  add_action( 'admin_menu', array( $this, 'admin_menu' ) );
61
+ add_action( 'wp_ajax_subscribe_submission', array( $this, 'subscribe_submission' ) );
62
 
63
  $this->handle_request();
64
  }
65
 
66
+ function subscribe_submission() {
67
+ $response = wp_remote_post( 'http://bradt.ca/wpmdb-subscribe.php', array(
68
  'timeout' => 60,
69
  'body' => $_POST
70
  ));
192
  $form_values = $_POST;
193
  }
194
  else {
195
+ $form_values['old_url'] = get_bloginfo('url');
196
 
197
  $form_values['old_path'] = dirname(__FILE__);
198
  $form_values['old_path'] = str_replace(DS . 'wp-migrate-db', '', $form_values['old_path']);
199
  $form_values['old_path'] = realpath($form_values['old_path'] . '/../..');
200
 
201
+ if (get_bloginfo('url') != get_bloginfo('wpurl')) {
202
+ $wp_dir = str_replace(get_bloginfo('url'), '', get_bloginfo('wpurl'));
203
  $wp_dir = str_replace('/', DS, $wp_dir);
204
  $form_values['old_path'] = str_replace($wp_dir, '', $form_values['old_path']);
205
  }
370
  </div>
371
  </div>
372
 
373
+ <form method="post" action="http://bradt.ca/wpmdb-subscribe.php" class="subscribe">
374
+ <h2>Pro Version</h2>
375
  <p>
376
+ We're working on a PRO version of this plugin that will include...
377
  </p>
378
 
379
  <ul>
380
  <li>
381
+ Pull production/staging db down and replace local db
 
 
382
  </li>
383
  <li>
384
+ Push local db up and replace production/staging db
385
+ </li>
386
+ <li>
387
+ Select tables to export
388
+ </li>
389
  <li>
390
+ Unlimited find &amp; replaces (currently you can
391
+ only do 2)
392
+ </li>
393
+ <li>
394
+ Compatibility with multi-site
395
+ </li>
396
+ <li>
397
+ Priority email support
398
  </li>
399
  </ul>
400
 
401
+ <?php $user = wp_get_current_user(); ?>
 
 
 
 
 
 
 
402
 
403
+ <p class="interesting">Interested? Send us your email and we'll let you know when a beta is available.</p>
 
 
 
404
 
405
+ <div class="field notify-email">
406
+ <p>Your Email</p>
407
+ <input type="email" name="notify-email" value="<?php echo esc_attr( $user->user_email ); ?>" />
408
+ </div>
 
 
 
 
 
 
 
 
409
 
410
+ <div class="field notify-email">
411
+ <p>Your Name (optional)</p>
412
+ <input type="text" name="notify-name" value="<?php echo trim( esc_attr( $user->first_name ) . ' ' . esc_attr( $user->last_name ) ); ?>" />
413
  </div>
414
 
415
+ <div class="field comments">
416
  <p>Comments (optional)</p>
417
  <textarea name="comments"></textarea>
418
  </div>
657
  function db_backup() {
658
  global $table_prefix, $wpdb;
659
 
660
+ $tables = $wpdb->get_results("SHOW FULL TABLES", ARRAY_N);
 
661
 
662
  /*
663
  if (is_writable($this->backup_dir)) {
672
  }*/
673
 
674
  foreach ($tables as $table) {
675
+ if ( 'VIEW' == $table[1] ) continue;
676
+ $table = $table[0];
677
  // Increase script execution time-limit to 15 min for every table.
678
  if ( !ini_get('safe_mode')) @set_time_limit(15*60);
679
  // Create the SQL statements