Go Live Update URLS - Version 2.2.2

Version Description

Download this release

Release Info

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

Code changes from version 2.2.1 to 2.2.2

go-live-update-urls.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://lipeimagination.info/
5
Description: This Plugin Updates all the URLs in the database to point to the new URL when making your site live or changing domains.
6
Author: Mat Lipe
7
Author URI: http://lipeimagination/
8
- Version: 2.2.1
9
*/
10
11
define( 'GLUU_VIEWS_DIR', plugin_dir_path(__FILE__) . 'views/' );
5
Description: This Plugin Updates all the URLs in the database to point to the new URL when making your site live or changing domains.
6
Author: Mat Lipe
7
Author URI: http://lipeimagination/
8
+ Version: 2.2.2
9
*/
10
11
define( 'GLUU_VIEWS_DIR', plugin_dir_path(__FILE__) . 'views/' );
lib/GoLiveUpdateUrls.php CHANGED
@@ -5,7 +5,7 @@
5
* @since 2.2
6
*
7
*
8
- * @updated 3.26.13
9
*
10
* @TODO Cleanup the Names and formatting
11
*/
@@ -145,7 +145,7 @@ class GoLiveUpdateUrls{
145
* Updates the datbase
146
*
147
* @uses the oldurl and newurl set above
148
- * @since 2.2
149
*
150
* @filters apply_filters( 'gluu-seralized-tables', $this->seralized_tables ); - effects makeCheckBoxes as well
151
*/
@@ -161,7 +161,7 @@ function makeTheUpdates(){
161
}
162
163
// If the new domain is the old one with a new subdomain like www
164
- if( strpos($newurl, $oldurl) != false) {
165
list( $subdomain ) = explode( '.', $newurl );
166
$this->double_subdomain = $subdomain . '.' . $newurl; //Create a match to what the broken one will be
167
}
@@ -185,9 +185,10 @@ function makeTheUpdates(){
185
$update_query = "UPDATE ".$v." SET ".$t->COLUMN_NAME." = replace(".$t->COLUMN_NAME.", '".$oldurl."','".$newurl."')";
186
//Run the query
187
$wpdb->query($update_query);
188
189
//Fix the dub dubs if this was the old domain with a new sub
190
- if( isset( $this->double_subdomain ) ){
191
$update_query = "UPDATE ".$v." SET ".$t->COLUMN_NAME." = replace(".$t->COLUMN_NAME.", '".$this->double_subdomain."','".$newurl."')";
192
//Run the query
193
$wpdb->query($update_query);
@@ -213,7 +214,7 @@ function makeTheUpdates(){
213
* @param string $table the table to go through
214
* @param string $column to column in the table to go through
215
*
216
- * @since 3.26.13
217
*
218
*/
219
function UpdateSeralizedTable( $table, $column = false ){
@@ -225,8 +226,11 @@ function makeTheUpdates(){
225
$rows = $wpdb->get_results("SELECT $primary_key_column, $column FROM $table WHERE $column LIKE 'a:%' OR $column LIKE 'O:%'");
226
227
foreach( $rows as $row ){
228
$data = @unserialize($row->{$column});
229
- if( $data === 'b:0' || $data === false ) continue;
230
231
$clean = $this->replaceTree($data, $this->oldurl, $this->newurl);
232
//If we switch to a submain we have to run this again to remove the doubles
@@ -234,7 +238,8 @@ function makeTheUpdates(){
234
$clean = $this->replaceTree($clean, $this->double_subdomain, $this->newurl);
235
}
236
237
- $wpdb->query($wpdb->prepare( "UPDATE $table SET $column= %s WHERE $primary_key_column= %s ", serialize($clean), $row->{$primary_key_column} ) );
238
}
239
}
240
5
* @since 2.2
6
*
7
*
8
+ * @updated 4.8.13
9
*
10
* @TODO Cleanup the Names and formatting
11
*/
145
* Updates the datbase
146
*
147
* @uses the oldurl and newurl set above
148
+ * @since 4.8.13
149
*
150
* @filters apply_filters( 'gluu-seralized-tables', $this->seralized_tables ); - effects makeCheckBoxes as well
151
*/
161
}
162
163
// If the new domain is the old one with a new subdomain like www
164
+ if( strpos($newurl, $oldurl) !== false) {
165
list( $subdomain ) = explode( '.', $newurl );
166
$this->double_subdomain = $subdomain . '.' . $newurl; //Create a match to what the broken one will be
167
}
185
$update_query = "UPDATE ".$v." SET ".$t->COLUMN_NAME." = replace(".$t->COLUMN_NAME.", '".$oldurl."','".$newurl."')";
186
//Run the query
187
$wpdb->query($update_query);
188
+
189
190
//Fix the dub dubs if this was the old domain with a new sub
191
+ if( $this->double_subdomain ){
192
$update_query = "UPDATE ".$v." SET ".$t->COLUMN_NAME." = replace(".$t->COLUMN_NAME.", '".$this->double_subdomain."','".$newurl."')";
193
//Run the query
194
$wpdb->query($update_query);
214
* @param string $table the table to go through
215
* @param string $column to column in the table to go through
216
*
217
+ * @since 4.8.13
218
*
219
*/
220
function UpdateSeralizedTable( $table, $column = false ){
226
$rows = $wpdb->get_results("SELECT $primary_key_column, $column FROM $table WHERE $column LIKE 'a:%' OR $column LIKE 'O:%'");
227
228
foreach( $rows as $row ){
229
+ if( !is_serialized($row->{$column}) ) continue;
230
+
231
+ if( strpos($row->{$column}, $this->oldurl) === false ) continue;
232
+
233
$data = @unserialize($row->{$column});
234
235
$clean = $this->replaceTree($data, $this->oldurl, $this->newurl);
236
//If we switch to a submain we have to run this again to remove the doubles
238
$clean = $this->replaceTree($clean, $this->double_subdomain, $this->newurl);
239
}
240
241
+ $wpdb->query($wpdb->prepare( "UPDATE $table SET $column=%s WHERE $primary_key_column=%s", @serialize($clean), $row->{$primary_key_column} ) );
242
+
243
}
244
}
245
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypa
4
Tags: Go Live, Urls, Domain Changes
5
Requires at least: 3.1
6
Tested up to: 3.5.1
7
- Stable tag: 2.2.1
8
9
== Description ==
10
4
Tags: Go Live, Urls, Domain Changes
5
Requires at least: 3.1
6
Tested up to: 3.5.1
7
+ Stable tag: 2.2.2
8
9
== Description ==
10