Version Description
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Go Live Update URLS |
Version | 3.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.5.4 to 3.0.1
- go-live-update-urls.php +11 -5
- languages/gluu.pot +86 -0
- languages/go-live-update-urls.pot +86 -0
- lib/GoLiveUpdateUrls.php +84 -88
- readme.txt +18 -15
- views/admin-tools-page.php +5 -5
go-live-update-urls.php
CHANGED
@@ -1,19 +1,25 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Go Live Update URLS
|
4 |
-
Plugin URI:
|
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:
|
8 |
-
Version:
|
|
|
9 |
*/
|
10 |
-
|
11 |
-
define( 'GLUU_VERSION', "2.5.4" );
|
12 |
|
13 |
define( 'GLUU_VIEWS_DIR', plugin_dir_path(__FILE__) . 'views/' );
|
14 |
define( 'GLUU_URL_VIEWS_DIR', plugins_url('go-live-update-urls').'/views/' );
|
15 |
|
16 |
require('lib/GoLiveUpdateUrls.php');
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
$GoLiveUpdateUrls = new GoLiveUpdateUrls();
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Go Live Update URLS
|
4 |
+
Plugin URI: https://matlipe.com/go-live-update-urls/
|
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: https://matlipe.com/
|
8 |
+
Version: 3.0.1
|
9 |
+
Text Domain: go-live-update-urls
|
10 |
*/
|
11 |
+
define( 'GLUU_VERSION', "3.0.1" );
|
|
|
12 |
|
13 |
define( 'GLUU_VIEWS_DIR', plugin_dir_path(__FILE__) . 'views/' );
|
14 |
define( 'GLUU_URL_VIEWS_DIR', plugins_url('go-live-update-urls').'/views/' );
|
15 |
|
16 |
require('lib/GoLiveUpdateUrls.php');
|
17 |
|
18 |
+
#-- Translate
|
19 |
+
add_action('plugins_loaded', 'gluu_translate' );
|
20 |
+
function gluu_translate(){
|
21 |
+
load_plugin_textdomain( 'go-live-update-urls', false, 'go-live-update-urls/languages' );
|
22 |
+
}
|
23 |
+
|
24 |
|
25 |
$GoLiveUpdateUrls = new GoLiveUpdateUrls();
|
languages/gluu.pot
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#, fuzzy
|
2 |
+
msgid ""
|
3 |
+
msgstr ""
|
4 |
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
+
"Project-Id-Version: Go Live Update URLS\n"
|
6 |
+
"POT-Creation-Date: 2015-08-14 17:00-0400\n"
|
7 |
+
"PO-Revision-Date: 2015-08-14 17:00-0400\n"
|
8 |
+
"Last-Translator: \n"
|
9 |
+
"Language-Team: \n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.8.4\n"
|
14 |
+
"X-Poedit-Basepath: ..\n"
|
15 |
+
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
18 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
19 |
+
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
+
|
23 |
+
#: lib/GoLiveUpdateUrls.php:79
|
24 |
+
msgid "Ouch! That hurt! You should not be here!"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: lib/GoLiveUpdateUrls.php:102
|
28 |
+
msgid "URLs have been updated."
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: lib/GoLiveUpdateUrls.php:113
|
32 |
+
msgid "You must fill out both boxes to make the update!."
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: lib/GoLiveUpdateUrls.php:134
|
36 |
+
msgid "Want a smarter, easier to use plugin with better support?"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: lib/GoLiveUpdateUrls.php:137
|
40 |
+
msgid "Go Pro!"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: views/admin-tools-page.php:15
|
44 |
+
msgid ""
|
45 |
+
"This will replace all occurrences \"in the entire database\" of the old URL "
|
46 |
+
"with the New URL."
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: views/admin-tools-page.php:20
|
50 |
+
#, php-format
|
51 |
+
msgid ""
|
52 |
+
"Please Uncheck any Tables which may contain serialized data. The only tables "
|
53 |
+
"which are currently serialized data safe when using this plugin are %s"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: views/admin-tools-page.php:29
|
57 |
+
msgid ""
|
58 |
+
"Like any other database updating tool, you should always perform a backup "
|
59 |
+
"before running."
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: views/admin-tools-page.php:36
|
63 |
+
msgid "Uncheck any tables that you would not like to update."
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#. Plugin Name of the plugin/theme
|
67 |
+
msgid "Go Live Update URLS"
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
#. Plugin URI of the plugin/theme
|
71 |
+
msgid "http://matlipe.com/go-live-update-urls/"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#. Description of the plugin/theme
|
75 |
+
msgid ""
|
76 |
+
"This Plugin Updates all the URLs in the database to point to the new URL "
|
77 |
+
"when making your site live or changing domains."
|
78 |
+
msgstr ""
|
79 |
+
|
80 |
+
#. Author of the plugin/theme
|
81 |
+
msgid "Mat Lipe"
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#. Author URI of the plugin/theme
|
85 |
+
msgid "http://matlipe.com/"
|
86 |
+
msgstr ""
|
languages/go-live-update-urls.pot
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#, fuzzy
|
2 |
+
msgid ""
|
3 |
+
msgstr ""
|
4 |
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
+
"Project-Id-Version: Go Live Update URLS\n"
|
6 |
+
"POT-Creation-Date: 2015-10-21 14:55-0400\n"
|
7 |
+
"PO-Revision-Date: 2015-10-21 14:55-0400\n"
|
8 |
+
"Last-Translator: \n"
|
9 |
+
"Language-Team: \n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.8.6\n"
|
14 |
+
"X-Poedit-Basepath: ..\n"
|
15 |
+
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
|
18 |
+
"esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
|
19 |
+
"_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
+
|
23 |
+
#: lib/GoLiveUpdateUrls.php:83
|
24 |
+
msgid "Ouch! That hurt! You should not be here!"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: lib/GoLiveUpdateUrls.php:106
|
28 |
+
msgid "URLs have been updated."
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: lib/GoLiveUpdateUrls.php:117
|
32 |
+
msgid "You must fill out both boxes to make the update!."
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: lib/GoLiveUpdateUrls.php:138
|
36 |
+
msgid "Want a smarter, easier to use plugin with better support?"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: lib/GoLiveUpdateUrls.php:141
|
40 |
+
msgid "Go Pro!"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: views/admin-tools-page.php:15
|
44 |
+
msgid ""
|
45 |
+
"This will replace all occurrences \"in the entire database\" of the old URL "
|
46 |
+
"with the New URL."
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: views/admin-tools-page.php:20
|
50 |
+
#, php-format
|
51 |
+
msgid ""
|
52 |
+
"Please un-check any tables which may contain serialized data. The only "
|
53 |
+
"tables which are currently serialized data safe when using this plugin are %s"
|
54 |
+
msgstr ""
|
55 |
+
|
56 |
+
#: views/admin-tools-page.php:29
|
57 |
+
msgid ""
|
58 |
+
"Like any other database updating tool, you should always perform a backup "
|
59 |
+
"before running."
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: views/admin-tools-page.php:36
|
63 |
+
msgid "Un-check any tables that you would not like to update."
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#. Plugin Name of the plugin/theme
|
67 |
+
msgid "Go Live Update URLS"
|
68 |
+
msgstr ""
|
69 |
+
|
70 |
+
#. Plugin URI of the plugin/theme
|
71 |
+
msgid "https://matlipe.com/go-live-update-urls/"
|
72 |
+
msgstr ""
|
73 |
+
|
74 |
+
#. Description of the plugin/theme
|
75 |
+
msgid ""
|
76 |
+
"This Plugin Updates all the URLs in the database to point to the new URL "
|
77 |
+
"when making your site live or changing domains."
|
78 |
+
msgstr ""
|
79 |
+
|
80 |
+
#. Author of the plugin/theme
|
81 |
+
msgid "Mat Lipe"
|
82 |
+
msgstr ""
|
83 |
+
|
84 |
+
#. Author URI of the plugin/theme
|
85 |
+
msgid "https://matlipe.com/"
|
86 |
+
msgstr ""
|
lib/GoLiveUpdateUrls.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* @author Mat Lipe
|
6 |
* @since 2.2
|
7 |
*
|
8 |
-
* @TODO split into
|
9 |
* Once get some funding
|
10 |
*/
|
11 |
class GoLiveUpdateUrls {
|
@@ -24,7 +24,7 @@ class GoLiveUpdateUrls {
|
|
24 |
*
|
25 |
* @var array
|
26 |
*/
|
27 |
-
public
|
28 |
|
29 |
/**
|
30 |
* tables
|
@@ -68,15 +68,19 @@ class GoLiveUpdateUrls {
|
|
68 |
$wpdb->sitemeta => 'meta_value' //site meta since 2.5.0
|
69 |
);
|
70 |
|
|
|
|
|
|
|
|
|
|
|
71 |
}
|
72 |
|
73 |
|
74 |
public function maybe_run_updates(){
|
75 |
-
|
76 |
check_admin_referer( plugin_basename( __FILE__ ), 'gluu-manage-options' );
|
77 |
|
78 |
if( !wp_verify_nonce( $_POST[ 'gluu-manage-options' ], plugin_basename( __FILE__ ) ) ){
|
79 |
-
wp_die( __('Ouch! That hurt! You should not be here!', '
|
80 |
}
|
81 |
|
82 |
$this->oldurl = trim( strip_tags( $_POST[ 'oldurl' ] ) );
|
@@ -86,7 +90,7 @@ class GoLiveUpdateUrls {
|
|
86 |
|
87 |
do_action( 'gluu-before-make-update', $this );
|
88 |
|
89 |
-
if( $this->makeTheUpdates(
|
90 |
add_action( 'admin_notices', array( $this, 'success' ) );
|
91 |
} else {
|
92 |
add_action( 'admin_notices', array( $this, 'epic_fail' ) );
|
@@ -99,7 +103,7 @@ class GoLiveUpdateUrls {
|
|
99 |
?>
|
100 |
<div id="message" class="updated fade">
|
101 |
<p>
|
102 |
-
<strong><?php _e( 'URLs have been updated.', '
|
103 |
</p>
|
104 |
</div>
|
105 |
<?php
|
@@ -110,7 +114,7 @@ class GoLiveUpdateUrls {
|
|
110 |
?>
|
111 |
<div id="message" class="error fade">
|
112 |
<p>
|
113 |
-
<strong><?php _e( 'You must fill out both boxes to make the update!.', '
|
114 |
</p>
|
115 |
</div>
|
116 |
<?php
|
@@ -129,12 +133,12 @@ class GoLiveUpdateUrls {
|
|
129 |
return;
|
130 |
}
|
131 |
?>
|
132 |
-
<div id="message" class="
|
133 |
<p>
|
134 |
-
<?php _e( 'Want a smarter, easier to use plugin with better support?', '
|
135 |
<br>
|
136 |
<a target="blank" href="http://matlipe.com/product/go-live-update-urls-pro/">
|
137 |
-
<?php _e( 'Go Pro!', '
|
138 |
</a>
|
139 |
</p>
|
140 |
</div>
|
@@ -143,7 +147,7 @@ class GoLiveUpdateUrls {
|
|
143 |
|
144 |
|
145 |
/**
|
146 |
-
* Retrieve filtered list of
|
147 |
*
|
148 |
* @since 2.4.0
|
149 |
*
|
@@ -200,7 +204,7 @@ class GoLiveUpdateUrls {
|
|
200 |
|
201 |
|
202 |
/**
|
203 |
-
* Allows for
|
204 |
*
|
205 |
* @since 2.0
|
206 |
*
|
@@ -271,16 +275,15 @@ class GoLiveUpdateUrls {
|
|
271 |
$god_query = "SELECT TABLE_NAME FROM information_schema.TABLES where TABLE_SCHEMA='" . $wpdb->dbname . "' AND TABLE_NAME LIKE '" . $wpdb->prefix . "%'";
|
272 |
|
273 |
//Done this way because like wp_% will return all other tables as well such as wp_2
|
|
|
274 |
$not_like = null;
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
}
|
283 |
-
}
|
284 |
|
285 |
return $wpdb->get_results( $god_query );
|
286 |
}
|
@@ -290,76 +293,69 @@ class GoLiveUpdateUrls {
|
|
290 |
* Updates the datbase
|
291 |
*
|
292 |
* @uses the oldurl and newurl set above
|
293 |
-
* @since 10.22.13
|
294 |
*
|
295 |
|
296 |
*/
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
}
|
358 |
-
}
|
359 |
-
}
|
360 |
-
|
361 |
-
return true;
|
362 |
-
}
|
363 |
|
364 |
|
365 |
/**
|
5 |
* @author Mat Lipe
|
6 |
* @since 2.2
|
7 |
*
|
8 |
+
* @TODO split into multiple classes and cleanup
|
9 |
* Once get some funding
|
10 |
*/
|
11 |
class GoLiveUpdateUrls {
|
24 |
*
|
25 |
* @var array
|
26 |
*/
|
27 |
+
public $seralized_tables = array();
|
28 |
|
29 |
/**
|
30 |
* tables
|
68 |
$wpdb->sitemeta => 'meta_value' //site meta since 2.5.0
|
69 |
);
|
70 |
|
71 |
+
//we are not going to update user meta if we are not on main blog
|
72 |
+
if( is_multisite() && $wpdb->blogid != 1 ){
|
73 |
+
unset( $this->seralized_tables[ $wpdb->usermeta ] );
|
74 |
+
}
|
75 |
+
|
76 |
}
|
77 |
|
78 |
|
79 |
public function maybe_run_updates(){
|
|
|
80 |
check_admin_referer( plugin_basename( __FILE__ ), 'gluu-manage-options' );
|
81 |
|
82 |
if( !wp_verify_nonce( $_POST[ 'gluu-manage-options' ], plugin_basename( __FILE__ ) ) ){
|
83 |
+
wp_die( __('Ouch! That hurt! You should not be here!', 'go-live-update-urls' ) );
|
84 |
}
|
85 |
|
86 |
$this->oldurl = trim( strip_tags( $_POST[ 'oldurl' ] ) );
|
90 |
|
91 |
do_action( 'gluu-before-make-update', $this );
|
92 |
|
93 |
+
if( $this->makeTheUpdates() ){
|
94 |
add_action( 'admin_notices', array( $this, 'success' ) );
|
95 |
} else {
|
96 |
add_action( 'admin_notices', array( $this, 'epic_fail' ) );
|
103 |
?>
|
104 |
<div id="message" class="updated fade">
|
105 |
<p>
|
106 |
+
<strong><?php _e( 'URLs have been updated.', 'go-live-update-urls' ); ?></strong>
|
107 |
</p>
|
108 |
</div>
|
109 |
<?php
|
114 |
?>
|
115 |
<div id="message" class="error fade">
|
116 |
<p>
|
117 |
+
<strong><?php _e( 'You must fill out both boxes to make the update!.', 'go-live-update-urls' ); ?></strong>
|
118 |
</p>
|
119 |
</div>
|
120 |
<?php
|
133 |
return;
|
134 |
}
|
135 |
?>
|
136 |
+
<div id="message" class="notice updated">
|
137 |
<p>
|
138 |
+
<?php _e( 'Want a smarter, easier to use plugin with better support?', 'go-live-update-urls' ); ?>
|
139 |
<br>
|
140 |
<a target="blank" href="http://matlipe.com/product/go-live-update-urls-pro/">
|
141 |
+
<?php _e( 'Go Pro!', 'go-live-update-urls' ); ?>
|
142 |
</a>
|
143 |
</p>
|
144 |
</div>
|
147 |
|
148 |
|
149 |
/**
|
150 |
+
* Retrieve filtered list of serialized safe database tables
|
151 |
*
|
152 |
* @since 2.4.0
|
153 |
*
|
204 |
|
205 |
|
206 |
/**
|
207 |
+
* Allows for Overwriting files in the child theme
|
208 |
*
|
209 |
* @since 2.0
|
210 |
*
|
275 |
$god_query = "SELECT TABLE_NAME FROM information_schema.TABLES where TABLE_SCHEMA='" . $wpdb->dbname . "' AND TABLE_NAME LIKE '" . $wpdb->prefix . "%'";
|
276 |
|
277 |
//Done this way because like wp_% will return all other tables as well such as wp_2
|
278 |
+
//so we exclude all the possibles e.g. wp_2, wp_3, wp_4 up to 9
|
279 |
$not_like = null;
|
280 |
+
if( is_multisite() && $wpdb->blogid == 1 ){
|
281 |
+
for( $i = 1; $i <= 9; $i ++ ){
|
282 |
+
$not_like .= "'" . $wpdb->prefix . $i . "',";
|
283 |
+
}
|
284 |
+
$not_like = substr( $not_like, 0, - 1 );
|
285 |
+
$god_query .= ' AND SUBSTRING(TABLE_NAME,1,4) NOT IN (' . $not_like . ')';
|
286 |
+
}
|
|
|
|
|
287 |
|
288 |
return $wpdb->get_results( $god_query );
|
289 |
}
|
293 |
* Updates the datbase
|
294 |
*
|
295 |
* @uses the oldurl and newurl set above
|
|
|
296 |
*
|
297 |
|
298 |
*/
|
299 |
+
function makeTheUpdates(){
|
300 |
+
global $wpdb;
|
301 |
+
|
302 |
+
@set_time_limit( 0 );
|
303 |
+
@ini_set( 'memory_limit', '256M' );
|
304 |
+
@ini_set( 'max_input_time', '-1' );
|
305 |
+
|
306 |
+
if( empty( $this->oldurl ) || empty( $this->newurl ) ){
|
307 |
+
return false;
|
308 |
+
}
|
309 |
+
|
310 |
+
// If the new domain is the old one with a new sub-domain like www
|
311 |
+
if( strpos( $this->newurl, $this->oldurl ) !== false ){
|
312 |
+
list( $subdomain ) = explode( '.', $this->newurl );
|
313 |
+
$this->double_subdomain = $subdomain . '.' . $this->newurl;
|
314 |
+
}
|
315 |
+
|
316 |
+
$serialized_tables = $this->getSerializedTables();
|
317 |
+
|
318 |
+
//Go through each table sent to be updated
|
319 |
+
foreach( array_keys( $this->tables ) as $table ){
|
320 |
+
if( in_array( $table, array_keys( $serialized_tables ) ) ){
|
321 |
+
if( is_array( $serialized_tables[ $table ] ) ){
|
322 |
+
foreach( $serialized_tables[ $table ] as $column ){
|
323 |
+
$this->UpdateSeralizedTable( $table, $column );
|
324 |
+
}
|
325 |
+
} else {
|
326 |
+
$this->UpdateSeralizedTable( $table, $serialized_tables[ $table ] );
|
327 |
+
}
|
328 |
+
}
|
329 |
+
|
330 |
+
if( $table != 'submit' && $table != 'oldurl' && $table != 'newurl' ){
|
331 |
+
|
332 |
+
$column_query = "SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='" . $wpdb->dbname . "' AND TABLE_NAME='" . $table . "'";
|
333 |
+
$columns = $wpdb->get_col( $column_query );
|
334 |
+
|
335 |
+
foreach( $columns as $_column ){
|
336 |
+
$update_query = "UPDATE " . $table . " SET " . $_column . " = replace(" . $_column . ", %s, %s)";
|
337 |
+
$wpdb->query( $wpdb->prepare( $update_query, array( $this->oldurl, $this->newurl ) ) );
|
338 |
+
|
339 |
+
//Fix the dub dubs if this was the old domain with a new sub
|
340 |
+
if( $this->double_subdomain ){
|
341 |
+
$wpdb->query( $wpdb->prepare( $update_query, array(
|
342 |
+
$this->double_subdomain,
|
343 |
+
$this->newurl
|
344 |
+
) ) );
|
345 |
+
//Fix the emails breaking by being appended the new subdomain
|
346 |
+
$wpdb->query( $wpdb->prepare( $update_query, array(
|
347 |
+
"@" . $this->newurl,
|
348 |
+
"@" . $this->oldurl
|
349 |
+
) ) );
|
350 |
+
}
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
wp_cache_flush();
|
356 |
+
|
357 |
+
return true;
|
358 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
|
360 |
|
361 |
/**
|
readme.txt
CHANGED
@@ -3,19 +3,18 @@ Contributors: Mat Lipe
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40lipeimagination%2einfo&lc=US&item_name=Go%20Live%20Update%20Urls&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
|
4 |
Tags: Go Live, Urls, Domain Changes
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag:
|
8 |
|
9 |
== Description ==
|
10 |
|
11 |
Goes through entire site and replaces all instances of and old url with a new one. Used to change the domain of a site.
|
12 |
|
13 |
<h3>Want a smarter, easier to use plugin with better support?</h3>
|
14 |
-
<strong><big><a href="
|
15 |
|
16 |
|
17 |
-
|
18 |
-
Works on both multisite and single site installs.
|
19 |
|
20 |
Some of the features this plugin offers:
|
21 |
|
@@ -62,23 +61,27 @@ Under the Tools menu in the dashboard there will be a "Go Live" link.
|
|
62 |
|
63 |
= Why does updating the domain break some plugins? =
|
64 |
|
65 |
-
Some plugins will store the data in the database serialized which does not allow for easy updating of the data. You may
|
66 |
|
67 |
= How do I know which tables I should not update? =
|
68 |
|
69 |
-
Most tables will be just fine to update. You may make a backup of your database, run this on all tables and if you run into trouble, restore your database,
|
70 |
-
|
71 |
|
72 |
|
73 |
== Screenshots ==
|
74 |
|
75 |
-
1. Screenshot of a typical settings page.
|
76 |
|
77 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
= 2.4 =
|
80 |
-
* Added
|
81 |
-
* Added an
|
82 |
* Enhanced Security
|
83 |
|
84 |
= 2.3 =
|
@@ -89,7 +92,7 @@ Most tables will be just fine to update. You may make a backup of your database,
|
|
89 |
* Added a filter for additional serialized safe tables
|
90 |
|
91 |
= 2.0 =
|
92 |
-
* Made updating the options
|
93 |
* Add extending ability of views and css *
|
94 |
* Moved the Admin page to the Tools Section *
|
95 |
* Improved the structure to allow for future changes *
|
@@ -112,17 +115,17 @@ Most tables will be just fine to update. You may make a backup of your database,
|
|
112 |
== Upgrade Notice ==
|
113 |
|
114 |
= 2.4 =
|
115 |
-
This Version works properly on
|
116 |
Enhanced Security - you should probably update
|
117 |
|
118 |
= 1.5 -
|
119 |
-
This Version will automatically keep email addresses intact when switch to a
|
120 |
|
121 |
= 1.3 =
|
122 |
This Version will allow you to switch to www without having to run it twice
|
123 |
|
124 |
= 1.2.1 =
|
125 |
-
This Version will
|
126 |
|
127 |
= 1.2 =
|
128 |
This Version will add the wp_options to the available tables and uncheck the table by default.
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40lipeimagination%2einfo&lc=US&item_name=Go%20Live%20Update%20Urls&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
|
4 |
Tags: Go Live, Urls, Domain Changes
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 4.3.1
|
7 |
+
Stable tag: 3.0.1
|
8 |
|
9 |
== Description ==
|
10 |
|
11 |
Goes through entire site and replaces all instances of and old url with a new one. Used to change the domain of a site.
|
12 |
|
13 |
<h3>Want a smarter, easier to use plugin with better support?</h3>
|
14 |
+
<strong><big><a href="https://matlipe.com/product/go-live-update-urls-pro/">Go Pro!</a></big></strong>
|
15 |
|
16 |
|
17 |
+
Works on both multi-site and single site installs.
|
|
|
18 |
|
19 |
Some of the features this plugin offers:
|
20 |
|
61 |
|
62 |
= Why does updating the domain break some plugins? =
|
63 |
|
64 |
+
Some plugins will store the data in the database serialized which does not allow for easy updating of the data. You may un-check tables used by such plugins to avoid breakage and then update the urls manually for those plugins. Currently the options, postmeta, usermeta, commentmeta, and sitemeta tables are serialization safe.
|
65 |
|
66 |
= How do I know which tables I should not update? =
|
67 |
|
68 |
+
Most tables will be just fine to update. You may make a backup of your database, run this on all tables and if you run into trouble, restore your database, un-check tables in sections, and rerun this until you find the culprit. If you find you are running into issues often with custom table you may want to check out the Pro version of this plugin which works with any table.
|
|
|
69 |
|
70 |
|
71 |
== Screenshots ==
|
72 |
|
73 |
+
1. Screenshot of a typical settings page. The verbiage will change slightly depending on your database structure
|
74 |
|
75 |
== Changelog ==
|
76 |
+
= 3.0.0 =
|
77 |
+
* Greatly improve security
|
78 |
+
* Improve code organization
|
79 |
+
* Remove misleading UI messages
|
80 |
+
* Clears cache when finished
|
81 |
|
82 |
= 2.4 =
|
83 |
+
* Added multi-site support
|
84 |
+
* Added an un-check all tables button
|
85 |
* Enhanced Security
|
86 |
|
87 |
= 2.3 =
|
92 |
* Added a filter for additional serialized safe tables
|
93 |
|
94 |
= 2.0 =
|
95 |
+
* Made updating the options table serialized safe *
|
96 |
* Add extending ability of views and css *
|
97 |
* Moved the Admin page to the Tools Section *
|
98 |
* Improved the structure to allow for future changes *
|
115 |
== Upgrade Notice ==
|
116 |
|
117 |
= 2.4 =
|
118 |
+
This Version works properly on mulit-site
|
119 |
Enhanced Security - you should probably update
|
120 |
|
121 |
= 1.5 -
|
122 |
+
This Version will automatically keep email addresses intact when switch to a sub-domain like www
|
123 |
|
124 |
= 1.3 =
|
125 |
This Version will allow you to switch to www without having to run it twice
|
126 |
|
127 |
= 1.2.1 =
|
128 |
+
This Version will un-check your options table by default for the wp_options as well as other table prefixes.
|
129 |
|
130 |
= 1.2 =
|
131 |
This Version will add the wp_options to the available tables and uncheck the table by default.
|
views/admin-tools-page.php
CHANGED
@@ -12,12 +12,12 @@
|
|
12 |
<div id="gluu" class="wrap">
|
13 |
<h2>Go Live Update Urls</h2>
|
14 |
|
15 |
-
<h4><?php _e( 'This will replace all occurrences "in the entire database" of the old URL with the New URL.', '
|
16 |
|
17 |
-
<div class="
|
18 |
<p>
|
19 |
<?php
|
20 |
-
$message = sprintf( __( "Please
|
21 |
|
22 |
echo apply_filters( 'gluu-top-message', $message, $this->getSerializedTables() );
|
23 |
?>
|
@@ -26,14 +26,14 @@
|
|
26 |
|
27 |
<strong>
|
28 |
<em style="color:red">
|
29 |
-
<?php _e( "Like any other database updating tool, you should always perform a backup before running.", '
|
30 |
</em>
|
31 |
</strong>
|
32 |
|
33 |
|
34 |
<h4>
|
35 |
<?php
|
36 |
-
echo apply_filters( 'gluu-uncheck-message', __( '
|
37 |
?>
|
38 |
</h4>
|
39 |
|
12 |
<div id="gluu" class="wrap">
|
13 |
<h2>Go Live Update Urls</h2>
|
14 |
|
15 |
+
<h4><?php _e( 'This will replace all occurrences "in the entire database" of the old URL with the New URL.', 'go-live-update-urls' ); ?></h4>
|
16 |
|
17 |
+
<div class="error fade">
|
18 |
<p>
|
19 |
<?php
|
20 |
+
$message = sprintf( __( "Please un-check any tables which may contain serialized data. The only tables which are currently serialized data safe when using this plugin are %s", 'go-live-update-urls' ), "(" . implode( ', ', array_keys( $this->getSerializedTables() ) ) . ")" );
|
21 |
|
22 |
echo apply_filters( 'gluu-top-message', $message, $this->getSerializedTables() );
|
23 |
?>
|
26 |
|
27 |
<strong>
|
28 |
<em style="color:red">
|
29 |
+
<?php _e( "Like any other database updating tool, you should always perform a backup before running.", 'go-live-update-urls' ); ?>
|
30 |
</em>
|
31 |
</strong>
|
32 |
|
33 |
|
34 |
<h4>
|
35 |
<?php
|
36 |
+
echo apply_filters( 'gluu-uncheck-message', __( 'Un-check any tables that you would not like to update.', 'go-live-update-urls' ) );
|
37 |
?>
|
38 |
</h4>
|
39 |
|