Go Live Update URLS - Version 5.2.5

Version Description

Download this release

Release Info

Developer Mat Lipe
Plugin Icon 128x128 Go Live Update URLS
Version 5.2.5
Comparing to
See all releases

Code changes from version 5.2.4 to 5.2.5

go-live-update-urls.php CHANGED
@@ -5,13 +5,13 @@
5
  * Description: Updates all the URLs in the database to point to a new URL when making your site live or changing domains.
6
  * Author: Mat Lipe
7
  * Author URI: https://matlipe.com/
8
- * Version: 5.2.4
9
  * Text Domain: go-live-update-urls
10
  *
11
  * @package go-live-update-urls
12
  */
13
 
14
- define( 'GO_LIVE_UPDATE_URLS_VERSION', '5.2.4' );
15
 
16
  /**
17
  * Load the plugin
5
  * Description: Updates all the URLs in the database to point to a new URL when making your site live or changing domains.
6
  * Author: Mat Lipe
7
  * Author URI: https://matlipe.com/
8
+ * Version: 5.2.5
9
  * Text Domain: go-live-update-urls
10
  *
11
  * @package go-live-update-urls
12
  */
13
 
14
+ define( 'GO_LIVE_UPDATE_URLS_VERSION', '5.2.5' );
15
 
16
  /**
17
  * Load the plugin
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: Go Live, Urls, Domain Changes
5
  Requires at least: 4.6.0
6
  Tested up to: 5.0.3
7
  Requires PHP: 5.2.4
8
- Stable tag: 5.2.4
9
 
10
  == Description ==
11
 
@@ -13,7 +13,7 @@ Goes through entire site and replaces all instances of an old url with a new one
13
 
14
  <strong>Check out <a href="https://matlipe.com/product/go-live-update-urls-pro/" target="_blank">Go Live Update Urls Pro</a> for more features including priority support, the ability to test a URL before running, updating of tables created by plugins, and so much more!</strong>
15
 
16
- <blockquote><a href="https://matlipe.com/product/go-live-update-urls-pro/" target="_blank">Pro version 2.3.0</a> just dropped with lots of great new stuff!</blockquote>
17
 
18
 
19
  <h4>Features</h4>
@@ -44,6 +44,7 @@ Goes through entire site and replaces all instances of an old url with a new one
44
  * Optionally fix common mistakes when entering a URL automatically.
45
  * View and use history of your Site Address (URL).
46
  * Predictive URLs automatically fill in the OLD URL and NEW URL.
 
47
  * Access to members only support area.
48
 
49
  <h4>Currently ships with the following languages</h4>
5
  Requires at least: 4.6.0
6
  Tested up to: 5.0.3
7
  Requires PHP: 5.2.4
8
+ Stable tag: 5.2.5
9
 
10
  == Description ==
11
 
13
 
14
  <strong>Check out <a href="https://matlipe.com/product/go-live-update-urls-pro/" target="_blank">Go Live Update Urls Pro</a> for more features including priority support, the ability to test a URL before running, updating of tables created by plugins, and so much more!</strong>
15
 
16
+ <blockquote><a href="https://matlipe.com/product/go-live-update-urls-pro/" target="_blank">Pro version 2.4.0</a> is now available with the ability to choose between a full table list or sections!</blockquote>
17
 
18
 
19
  <h4>Features</h4>
44
  * Optionally fix common mistakes when entering a URL automatically.
45
  * View and use history of your Site Address (URL).
46
  * Predictive URLs automatically fill in the OLD URL and NEW URL.
47
+ * Ability to choose between a full table list and sections **NEW**
48
  * Access to members only support area.
49
 
50
  <h4>Currently ships with the following languages</h4>
src/Database.php CHANGED
@@ -23,7 +23,7 @@ class Go_Live_Update_Urls_Database {
23
  */
24
  public function get_serialized_tables() {
25
  global $wpdb;
26
- // default tables with serialized data
27
  $serialized_tables = array(
28
  $wpdb->options => 'option_value',
29
  $wpdb->postmeta => 'meta_value',
@@ -32,10 +32,10 @@ class Go_Live_Update_Urls_Database {
32
  $wpdb->usermeta => 'meta_value',
33
  );
34
 
35
- // we are not going to update user meta if we are not on main blog
36
  if ( is_multisite() ) {
37
  $serialized_tables[ $wpdb->sitemeta ] = 'meta_value';
38
- // WP 5.0.0+
39
  if ( isset( $wpdb->blogmeta ) ) {
40
  $serialized_tables[ $wpdb->blogmeta ] = 'meta_value';
41
  }
@@ -187,10 +187,10 @@ class Go_Live_Update_Urls_Database {
187
  }
188
 
189
  $serialized = new Go_Live_Update_Urls_Serialized( $this->old_url, $this->new_url );
190
- $serialized->update_all_serialized_tables();
191
  if ( $this->double_subdomain ) {
192
  $serialized = new Go_Live_Update_Urls_Serialized( $this->double_subdomain, $this->new_url );
193
- $serialized->update_all_serialized_tables();
194
  }
195
 
196
  // Go through each table sent to be updated.
23
  */
24
  public function get_serialized_tables() {
25
  global $wpdb;
26
+ // Default tables with serialized data.
27
  $serialized_tables = array(
28
  $wpdb->options => 'option_value',
29
  $wpdb->postmeta => 'meta_value',
32
  $wpdb->usermeta => 'meta_value',
33
  );
34
 
35
+ // We are not going to update site meta if we are not on main blog.
36
  if ( is_multisite() ) {
37
  $serialized_tables[ $wpdb->sitemeta ] = 'meta_value';
38
+ // WP 5.0.0+.
39
  if ( isset( $wpdb->blogmeta ) ) {
40
  $serialized_tables[ $wpdb->blogmeta ] = 'meta_value';
41
  }
187
  }
188
 
189
  $serialized = new Go_Live_Update_Urls_Serialized( $this->old_url, $this->new_url );
190
+ $serialized->update_all_serialized_tables( $tables );
191
  if ( $this->double_subdomain ) {
192
  $serialized = new Go_Live_Update_Urls_Serialized( $this->double_subdomain, $this->new_url );
193
+ $serialized->update_all_serialized_tables( $tables );
194
  }
195
 
196
  // Go through each table sent to be updated.
src/Serialized.php CHANGED
@@ -3,7 +3,6 @@
3
  /**
4
  * @author Mat Lipe
5
  * @since 5.2.0
6
- *
7
  */
8
  class Go_Live_Update_Urls_Serialized {
9
  protected $column;
@@ -21,12 +20,19 @@ class Go_Live_Update_Urls_Serialized {
21
  /**
22
  * Go through every registered serialized table and update them one by one
23
  *
 
 
 
 
24
  * @return void
25
  */
26
- public function update_all_serialized_tables() {
27
  $serialized_tables = Go_Live_Update_Urls_Database::instance()->get_serialized_tables();
28
 
29
  foreach ( $serialized_tables as $table => $columns ) {
 
 
 
30
  foreach ( (array) $columns as $_column ) {
31
  $this->update_table( $table, $_column );
32
  }
@@ -48,18 +54,18 @@ class Go_Live_Update_Urls_Serialized {
48
  if ( empty( $pk[0] ) ) {
49
  $pk = $wpdb->get_results( "SHOW KEYS FROM {$table}" );
50
  if ( empty( $pk[0] ) ) {
51
- //fail
52
  return;
53
  }
54
  }
55
 
56
  $primary_key_column = $pk[0]->Column_name;
57
 
58
- //Get all the Serialized Rows and Replace them properly
59
  $rows = $wpdb->get_results( "SELECT $primary_key_column, {$column} FROM {$table} WHERE {$column} LIKE 'a:%' OR {$column} LIKE 'O:%'" );
60
 
61
  foreach ( $rows as $row ) {
62
- //skip the overhead of updating things that have nothing to update
63
  if ( ! $this->has_data_to_update( $row->{$column} ) ) {
64
  continue;
65
  }
@@ -83,7 +89,6 @@ class Go_Live_Update_Urls_Serialized {
83
  * @since 5.2.0
84
  *
85
  * @return mixed
86
- *
87
  */
88
  public function replace_tree( $data ) {
89
  if ( is_string( $data ) ) {
3
  /**
4
  * @author Mat Lipe
5
  * @since 5.2.0
 
6
  */
7
  class Go_Live_Update_Urls_Serialized {
8
  protected $column;
20
  /**
21
  * Go through every registered serialized table and update them one by one
22
  *
23
+ * @param array $tables - The tables to update.
24
+ *
25
+ * @since 5.2.5 - Only update provided tables.
26
+ *
27
  * @return void
28
  */
29
+ public function update_all_serialized_tables( array $tables ) {
30
  $serialized_tables = Go_Live_Update_Urls_Database::instance()->get_serialized_tables();
31
 
32
  foreach ( $serialized_tables as $table => $columns ) {
33
+ if ( ! in_array( $table, $tables, true ) ) {
34
+ continue;
35
+ }
36
  foreach ( (array) $columns as $_column ) {
37
  $this->update_table( $table, $_column );
38
  }
54
  if ( empty( $pk[0] ) ) {
55
  $pk = $wpdb->get_results( "SHOW KEYS FROM {$table}" );
56
  if ( empty( $pk[0] ) ) {
57
+ // fail
58
  return;
59
  }
60
  }
61
 
62
  $primary_key_column = $pk[0]->Column_name;
63
 
64
+ // Get all the Serialized Rows and Replace them properly
65
  $rows = $wpdb->get_results( "SELECT $primary_key_column, {$column} FROM {$table} WHERE {$column} LIKE 'a:%' OR {$column} LIKE 'O:%'" );
66
 
67
  foreach ( $rows as $row ) {
68
+ // skip the overhead of updating things that have nothing to update
69
  if ( ! $this->has_data_to_update( $row->{$column} ) ) {
70
  continue;
71
  }
89
  * @since 5.2.0
90
  *
91
  * @return mixed
 
92
  */
93
  public function replace_tree( $data ) {
94
  if ( is_string( $data ) ) {
views/admin-tools-page.php CHANGED
@@ -2,9 +2,14 @@
2
  /**
3
  * Main Admin screen view
4
  *
5
- * @since 5.0.0
6
  *
7
- * @uses may be overridden in your theme by putting a copy of this file inside a go-live-update-urls folder
 
 
 
 
 
8
  */
9
 
10
  $db = Go_Live_Update_Urls_Database::instance();
@@ -19,7 +24,8 @@ $admin = Go_Live_Update_Urls_Admin_Page::instance();
19
  <p class="description">
20
  <?php
21
  /* translators: <strong></strong> */
22
- printf( esc_html_x( 'This will replace all occurrences %1$sin the entire database%2$s of the Old URL with the New URL.', '{<strong>} {</strong>}', 'go-live-update-urls' ), '<strong>', '</strong>' ); ?>
 
23
  </p>
24
 
25
  <strong>
@@ -27,6 +33,7 @@ $admin = Go_Live_Update_Urls_Admin_Page::instance();
27
  <?php esc_html_e( 'Like any other database updating tool, you should always perform a backup before running.', 'go-live-update-urls' ); ?>
28
  </em>
29
  </strong>
 
30
  <hr/>
31
 
32
  <form method="post" id="go-live-update-urls/checkbox-form">
@@ -53,9 +60,10 @@ $admin = Go_Live_Update_Urls_Admin_Page::instance();
53
  data-js="go-live-update-urls/checkboxes/check-all"
54
  checked
55
  />
56
- <hr />
57
  </p>
58
- <?php $admin->render_check_boxes( $db->get_core_tables(), 'wp-core' );
 
59
 
60
  $custom_tables = $db->get_custom_plugin_tables();
61
  if ( ! empty( $custom_tables ) ) {
@@ -69,7 +77,9 @@ $admin = Go_Live_Update_Urls_Admin_Page::instance();
69
  <strong>
70
  <?php
71
  /* translators: <br /> <a> </a> */
72
- printf( esc_html_x( 'These tables are probably NOT SAFE to update with the basic version of this plugin. %1$sTo support tables created by plugins use the %2$sPro Version%3$s.', '{<br />}{<a>}{</a>}', 'go-live-update-urls' ), '<br />', '<a href="https://matlipe.com/product/go-live-update-urls-pro/" target="_blank">', '</a>' ); ?></strong>
 
 
73
  </p>
74
  <p>
75
  <input
@@ -77,9 +87,10 @@ $admin = Go_Live_Update_Urls_Admin_Page::instance();
77
  class="go-live-update-urls/checkboxes/check-all"
78
  data-list="custom-plugins"
79
  data-js="go-live-update-urls/checkboxes/check-all"/>
80
- <hr />
81
  </p>
82
- <?php $admin->render_check_boxes( $custom_tables, 'custom-plugins', false );
 
83
  }
84
  }
85
 
@@ -121,7 +132,7 @@ $admin = Go_Live_Update_Urls_Admin_Page::instance();
121
  </td>
122
  </tr>
123
  </table>
124
- <p class="description">
125
  <strong>
126
  <?php
127
  echo esc_html( apply_filters( 'gluu-uncheck-message', __( 'Only the checked tables will be updated.', 'go-live-update-urls' ) ) );
@@ -135,7 +146,9 @@ $admin = Go_Live_Update_Urls_Admin_Page::instance();
135
  <strong>
136
  <?php
137
  /* translators: <a></a> */
138
- printf( esc_html_x( 'To test this change before running it, use %1$sPro Version 2.0.0+%2$s.', '{<a>}{</a>}', 'go-live-update-urls' ), '<a href="https://matlipe.com/product/go-live-update-urls-pro/" target="_blank">', '</a>' ); ?></strong>
 
 
139
  </p>
140
  <?php
141
  }
2
  /**
3
  * Main Admin screen view
4
  *
5
+ * Do not edit this file directly!
6
  *
7
+ * Create a directory named `go-live-update-urls` in your theme and copy this file
8
+ * into that directory. Then you may edit at will.
9
+ *
10
+ * @since 5.2.5
11
+ *
12
+ * @package go-live-update-urls
13
  */
14
 
15
  $db = Go_Live_Update_Urls_Database::instance();
24
  <p class="description">
25
  <?php
26
  /* translators: <strong></strong> */
27
+ printf( esc_html_x( 'This will replace all occurrences %1$sin the entire database%2$s of the Old URL with the New URL.', '{<strong>} {</strong>}', 'go-live-update-urls' ), '<strong>', '</strong>' );
28
+ ?>
29
  </p>
30
 
31
  <strong>
33
  <?php esc_html_e( 'Like any other database updating tool, you should always perform a backup before running.', 'go-live-update-urls' ); ?>
34
  </em>
35
  </strong>
36
+ <br/><br/>
37
  <hr/>
38
 
39
  <form method="post" id="go-live-update-urls/checkbox-form">
60
  data-js="go-live-update-urls/checkboxes/check-all"
61
  checked
62
  />
63
+ <hr/>
64
  </p>
65
+ <?php
66
+ $admin->render_check_boxes( $db->get_core_tables(), 'wp-core' );
67
 
68
  $custom_tables = $db->get_custom_plugin_tables();
69
  if ( ! empty( $custom_tables ) ) {
77
  <strong>
78
  <?php
79
  /* translators: <br /> <a> </a> */
80
+ printf( esc_html_x( 'These tables are probably NOT SAFE to update with the basic version of this plugin. %1$sTo support tables created by plugins use the %2$sPro Version%3$s.', '{<br />}{<a>}{</a>}', 'go-live-update-urls' ), '<br />', '<a href="https://matlipe.com/product/go-live-update-urls-pro/" target="_blank">', '</a>' );
81
+ ?>
82
+ </strong>
83
  </p>
84
  <p>
85
  <input
87
  class="go-live-update-urls/checkboxes/check-all"
88
  data-list="custom-plugins"
89
  data-js="go-live-update-urls/checkboxes/check-all"/>
90
+ <hr/>
91
  </p>
92
+ <?php
93
+ $admin->render_check_boxes( $custom_tables, 'custom-plugins', false );
94
  }
95
  }
96
 
132
  </td>
133
  </tr>
134
  </table>
135
+ <p class="description" id="go-live-update-urls/views/only-checked">
136
  <strong>
137
  <?php
138
  echo esc_html( apply_filters( 'gluu-uncheck-message', __( 'Only the checked tables will be updated.', 'go-live-update-urls' ) ) );
146
  <strong>
147
  <?php
148
  /* translators: <a></a> */
149
+ printf( esc_html_x( 'To test this change before running it, use %1$sPro Version 2.0.0+%2$s.', '{<a>}{</a>}', 'go-live-update-urls' ), '<a href="https://matlipe.com/product/go-live-update-urls-pro/" target="_blank">', '</a>' );
150
+ ?>
151
+ </strong>
152
  </p>
153
  <?php
154
  }