Version Description
- Entirely new code structure.
- Removed all deprecated code and filters.
- Improved filter and action names.
- Improved performance.
Download this release
Release Info
Developer | Mat Lipe |
Plugin | Go Live Update URLS |
Version | 6.0.0 |
Comparing to | |
See all releases |
Code changes from version 5.3.0 to 6.0.0
- deprecated/Go_Live_Update_Urls_Database.php +31 -0
- go-live-update-urls.php +52 -19
- languages/go-live-update-urls-de_DE.mo +0 -0
- languages/go-live-update-urls-de_DE.po +57 -25
- languages/go-live-update-urls-es_ES.mo +0 -0
- languages/go-live-update-urls-es_ES.po +56 -24
- languages/go-live-update-urls-fr_FR.mo +0 -0
- languages/go-live-update-urls-fr_FR.po +56 -25
- languages/go-live-update-urls.pot +30 -22
- readme.txt +19 -15
- src/Admin.php +309 -0
- src/Core.php +21 -126
- src/Database.php +25 -41
- src/Serialized.php +50 -52
- src/Traits/Singleton.php +45 -0
- src/Updaters/Repo.php +12 -33
- src/Updaters/Updaters_Abstract.php +110 -0
- src/Updaters/Url_Encoded.php +25 -9
deprecated/Go_Live_Update_Urls_Database.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use Go_Live_Update_Urls\Database;
|
4 |
+
|
5 |
+
|
6 |
+
//phpcs:disable
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @deprecated Here to prevent fatal when using old PRO version.
|
10 |
+
*/
|
11 |
+
class Go_Live_Update_Urls_Database extends Database {
|
12 |
+
/**
|
13 |
+
* Go_Live_Update_Urls_Database constructor.
|
14 |
+
*/
|
15 |
+
public function __construct() {
|
16 |
+
_deprecated_constructor( __CLASS__, '6.0.0', esc_html( Database::class ) );
|
17 |
+
}
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @deprecated
|
22 |
+
*/
|
23 |
+
public static function instance() {
|
24 |
+
_deprecated_function( __METHOD__, '6.0.0', esc_html( Database::class ) );
|
25 |
+
if ( ! is_a( static::$instance, __CLASS__ ) ) {
|
26 |
+
static::$instance = new static();
|
27 |
+
}
|
28 |
+
return static::$instance;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
//phpcs:enable
|
go-live-update-urls.php
CHANGED
@@ -5,13 +5,24 @@
|
|
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: OnPoint Plugins
|
7 |
* Author URI: https://onpointplugins.com/
|
8 |
-
* Version:
|
9 |
* Text Domain: go-live-update-urls
|
10 |
*
|
11 |
* @package go-live-update-urls
|
12 |
*/
|
13 |
|
14 |
-
define( 'GO_LIVE_UPDATE_URLS_VERSION', '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
/**
|
17 |
* Load the plugin
|
@@ -19,12 +30,20 @@ define( 'GO_LIVE_UPDATE_URLS_VERSION', '5.3.0' );
|
|
19 |
* @return void
|
20 |
*/
|
21 |
function go_live_update_urls_load() {
|
|
|
|
|
22 |
load_plugin_textdomain( 'go-live-update-urls', false, 'go-live-update-urls/languages' );
|
23 |
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
|
|
|
|
|
28 |
/**
|
29 |
* Autoload classes from PSR4 src directory
|
30 |
* Mirrored after Composer dump-autoload for performance
|
@@ -36,24 +55,38 @@ function go_live_update_urls_load() {
|
|
36 |
* @return void
|
37 |
*/
|
38 |
function go_live_update_urls_autoload( $class ) {
|
39 |
-
$classes =
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
'Go_Live_Update_Urls__Updaters__Repo' => 'Updaters/Repo.php',
|
50 |
-
'Go_Live_Update_Urls__Updaters__Url_Encoded' => 'Updaters/Url_Encoded.php',
|
51 |
-
);
|
52 |
if ( isset( $classes[ $class ] ) ) {
|
53 |
-
require
|
54 |
}
|
55 |
}
|
56 |
|
57 |
spl_autoload_register( 'go_live_update_urls_autoload' );
|
58 |
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: OnPoint Plugins
|
7 |
* Author URI: https://onpointplugins.com/
|
8 |
+
* Version: 6.0.0
|
9 |
* Text Domain: go-live-update-urls
|
10 |
*
|
11 |
* @package go-live-update-urls
|
12 |
*/
|
13 |
|
14 |
+
define( 'GO_LIVE_UPDATE_URLS_VERSION', '6.0.0' );
|
15 |
+
define( 'GO_LIVE_UPDATE_URLS_REQUIRED_PRO_VERSION', '6.0.0' );
|
16 |
+
define( 'GO_LIVE_UPDATE_URLS_URL', plugin_dir_url( __FILE__ ) );
|
17 |
+
|
18 |
+
use Go_Live_Update_Urls\Admin;
|
19 |
+
use Go_Live_Update_Urls\Core;
|
20 |
+
use Go_Live_Update_Urls\Database;
|
21 |
+
use Go_Live_Update_Urls\Serialized;
|
22 |
+
use Go_Live_Update_Urls\Updaters\Repo;
|
23 |
+
use Go_Live_Update_Urls\Traits\Singleton;
|
24 |
+
use Go_Live_Update_Urls\Updaters\Updaters_Abstract;
|
25 |
+
use Go_Live_Update_Urls\Updaters\Url_Encoded;
|
26 |
|
27 |
/**
|
28 |
* Load the plugin
|
30 |
* @return void
|
31 |
*/
|
32 |
function go_live_update_urls_load() {
|
33 |
+
require __DIR__ . '/deprecated/Go_Live_Update_Urls_Database.php';
|
34 |
+
|
35 |
load_plugin_textdomain( 'go-live-update-urls', false, 'go-live-update-urls/languages' );
|
36 |
|
37 |
+
Admin::init();
|
38 |
+
Core::init();
|
39 |
+
|
40 |
+
if ( defined( 'GO_LIVE_UPDATE_URLS_PRO_VERSION' ) && version_compare( GO_LIVE_UPDATE_URLS_REQUIRED_PRO_VERSION, GO_LIVE_UPDATE_URLS_PRO_VERSION, '>' ) ) {
|
41 |
+
add_action( 'admin_notices', 'go_live_update_urls_pro_plugin_notice' );
|
42 |
+
}
|
43 |
}
|
44 |
|
45 |
+
add_action( 'plugins_loaded', 'go_live_update_urls_load' );
|
46 |
+
|
47 |
/**
|
48 |
* Autoload classes from PSR4 src directory
|
49 |
* Mirrored after Composer dump-autoload for performance
|
55 |
* @return void
|
56 |
*/
|
57 |
function go_live_update_urls_autoload( $class ) {
|
58 |
+
$classes = [
|
59 |
+
Admin::class => 'Admin.php',
|
60 |
+
Core::class => 'Core.php',
|
61 |
+
Database::class => 'Database.php',
|
62 |
+
Repo::class => 'Updaters/Repo.php',
|
63 |
+
Serialized::class => 'Serialized.php',
|
64 |
+
Singleton::class => 'Traits/Singleton.php',
|
65 |
+
Updaters_Abstract::class => 'Updaters/Updaters_Abstract.php',
|
66 |
+
Url_Encoded::class => 'Updaters/Url_Encoded.php',
|
67 |
+
];
|
|
|
|
|
|
|
68 |
if ( isset( $classes[ $class ] ) ) {
|
69 |
+
require __DIR__ . '/src/' . $classes[ $class ];
|
70 |
}
|
71 |
}
|
72 |
|
73 |
spl_autoload_register( 'go_live_update_urls_autoload' );
|
74 |
|
75 |
+
/**
|
76 |
+
* Display a warning if we don't have the required PRO version installed
|
77 |
+
*
|
78 |
+
* @return void
|
79 |
+
*/
|
80 |
+
function go_live_update_urls_pro_plugin_notice() {
|
81 |
+
?>
|
82 |
+
<div id="message" class="error">
|
83 |
+
<p>
|
84 |
+
<?php
|
85 |
+
/* translators: {%1$s}[<a>]{%2$s}[</a>] https://wordpress.org/plugins/go-live-update-urls/ */ //phpcs:disable
|
86 |
+
printf( esc_html_x( 'Go Live Update Urls requires %1$sGo Live Update Urls PRO %3$s+%2$s. Please update or deactivate the PRO version.', '{<a>}{</a>}', 'go-live-update-urls' ), '<a target="_blank" href="https://onpointplugins.com/product/go-live-update-urls-pro/">', '</a>', esc_attr( GO_LIVE_UPDATE_URLS_REQUIRED_PRO_VERSION ) );
|
87 |
+
?>
|
88 |
+
</p>
|
89 |
+
</div>
|
90 |
+
<?php
|
91 |
+
}
|
92 |
+
|
languages/go-live-update-urls-de_DE.mo
CHANGED
Binary file
|
languages/go-live-update-urls-de_DE.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Go Live Update URLS\n"
|
4 |
-
"POT-Creation-Date:
|
5 |
-
"PO-Revision-Date:
|
6 |
"Last-Translator: Mat Lipe <support@onpointplugins.com>\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: de_DE\n"
|
@@ -10,7 +10,7 @@ msgstr ""
|
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
-
"X-Generator: Poedit 2.
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
@@ -20,28 +20,34 @@ msgstr ""
|
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
msgid "Ouch! That hurt! You should not be here!"
|
25 |
msgstr "Autsch! Das tut weh! Du solltest nicht hier sein!"
|
26 |
|
27 |
-
#: src/
|
28 |
msgid "The URLS in the checked tables have been updated."
|
29 |
msgstr "Die URLs in den überprüften Tabellen wurden aktualisiert."
|
30 |
|
31 |
-
#: src/
|
32 |
msgid "You must fill out both URLs and select tables to update URLs!"
|
33 |
msgstr "Sie müssen beide URLs ausfüllen, um das Update durchzuführen!"
|
34 |
|
35 |
-
#: src/Admin_Page.php:147
|
36 |
-
msgid "Serialized"
|
37 |
-
msgstr "Seriell"
|
38 |
-
|
39 |
#. Plugin Name of the plugin/theme
|
40 |
-
#:
|
41 |
msgid "Go Live Update Urls"
|
42 |
msgstr "Go Live Update Urls"
|
43 |
|
44 |
-
#:
|
45 |
#, php-format
|
46 |
msgctxt "{<strong>} {</strong>}"
|
47 |
msgid ""
|
@@ -51,7 +57,7 @@ msgstr ""
|
|
51 |
"Dadurch werden alle Vorkommen%1$sin der gesamten Datenbank%2$s der alten URL "
|
52 |
"durch die neue URL ersetzt."
|
53 |
|
54 |
-
#:
|
55 |
msgid ""
|
56 |
"Like any other database updating tool, you should always perform a backup "
|
57 |
"before running."
|
@@ -59,21 +65,21 @@ msgstr ""
|
|
59 |
"Wie jedes andere Datenbankaktualisierungstool sollten Sie vor dem Ausführen "
|
60 |
"immer eine Sicherung durchführen."
|
61 |
|
62 |
-
#:
|
63 |
msgid "WordPress Core Tables"
|
64 |
msgstr "Kerntabellen"
|
65 |
|
66 |
-
#:
|
67 |
msgid "These tables are safe to update with the basic version of this plugin."
|
68 |
msgstr ""
|
69 |
"Diese Tabellen können mit der Basisversion dieses Plugins sicher "
|
70 |
"aktualisiert werden."
|
71 |
|
72 |
-
#:
|
73 |
msgid "Tables Created By Plugins"
|
74 |
msgstr "Tabellen erstellt von Plugins"
|
75 |
|
76 |
-
#:
|
77 |
#, php-format
|
78 |
msgctxt "{<br />}{<a>}{</a>}"
|
79 |
msgid ""
|
@@ -84,30 +90,35 @@ msgstr ""
|
|
84 |
"dieses Plugins zu aktualisieren. %1$sUm Tabellen zu unterstützen, die von "
|
85 |
"Plugins erstellt wurden, verwenden Sie%2$sPro Version%3$s."
|
86 |
|
87 |
-
#:
|
88 |
msgid "Old URL"
|
89 |
msgstr "Alte URL"
|
90 |
|
91 |
-
#:
|
92 |
msgid "New URL"
|
93 |
msgstr "Neue URL"
|
94 |
|
95 |
-
#:
|
96 |
msgid "Only the checked tables will be updated."
|
97 |
msgstr "Nur die überprüften Tabellen werden aktualisiert."
|
98 |
|
99 |
-
#:
|
100 |
#, php-format
|
101 |
msgctxt "{<a>}{</a>}"
|
102 |
-
msgid "
|
103 |
msgstr ""
|
104 |
-
"
|
105 |
-
"
|
106 |
|
107 |
-
#:
|
108 |
msgid "Update URLs"
|
109 |
msgstr "URLs aktualisieren"
|
110 |
|
|
|
|
|
|
|
|
|
|
|
111 |
#. Plugin URI of the plugin/theme
|
112 |
msgid "https://onpointplugins.com/go-live-update-urls/"
|
113 |
msgstr "https://onpointplugins.com/go-live-update-urls/"
|
@@ -128,6 +139,27 @@ msgstr "OnPoint Plugins"
|
|
128 |
msgid "https://onpointplugins.com/"
|
129 |
msgstr "https://onpointplugins.com/"
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
#~ msgid "Go Live Update URLS"
|
132 |
#~ msgstr "Go Live Update URLS"
|
133 |
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Go Live Update URLS\n"
|
4 |
+
"POT-Creation-Date: 2020-06-10 12:20-0600\n"
|
5 |
+
"PO-Revision-Date: 2020-06-10 12:21-0600\n"
|
6 |
"Last-Translator: Mat Lipe <support@onpointplugins.com>\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: de_DE\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
+
"X-Generator: Poedit 2.3.1\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
+
#: go-live-update-urls.php:86
|
24 |
+
#, php-format
|
25 |
+
msgctxt "{<a>}{</a>}"
|
26 |
+
msgid ""
|
27 |
+
"Go Live Update Urls requires %1$sGo Live Update Urls PRO %3$s+%2$s. Please "
|
28 |
+
"update or deactivate the PRO version."
|
29 |
+
msgstr ""
|
30 |
+
"Go Live Update Urls erfordert %1$sGo Live Update Urls PRO %3$s+%2$s. Bitte "
|
31 |
+
"aktualisieren oder deaktivieren Sie die PRO-Version."
|
32 |
+
|
33 |
+
#: src/Admin.php:44
|
34 |
msgid "Ouch! That hurt! You should not be here!"
|
35 |
msgstr "Autsch! Das tut weh! Du solltest nicht hier sein!"
|
36 |
|
37 |
+
#: src/Admin.php:78
|
38 |
msgid "The URLS in the checked tables have been updated."
|
39 |
msgstr "Die URLs in den überprüften Tabellen wurden aktualisiert."
|
40 |
|
41 |
+
#: src/Admin.php:97
|
42 |
msgid "You must fill out both URLs and select tables to update URLs!"
|
43 |
msgstr "Sie müssen beide URLs ausfüllen, um das Update durchzuführen!"
|
44 |
|
|
|
|
|
|
|
|
|
45 |
#. Plugin Name of the plugin/theme
|
46 |
+
#: src/Admin.php:130
|
47 |
msgid "Go Live Update Urls"
|
48 |
msgstr "Go Live Update Urls"
|
49 |
|
50 |
+
#: src/Admin.php:140
|
51 |
#, php-format
|
52 |
msgctxt "{<strong>} {</strong>}"
|
53 |
msgid ""
|
57 |
"Dadurch werden alle Vorkommen%1$sin der gesamten Datenbank%2$s der alten URL "
|
58 |
"durch die neue URL ersetzt."
|
59 |
|
60 |
+
#: src/Admin.php:146
|
61 |
msgid ""
|
62 |
"Like any other database updating tool, you should always perform a backup "
|
63 |
"before running."
|
65 |
"Wie jedes andere Datenbankaktualisierungstool sollten Sie vor dem Ausführen "
|
66 |
"immer eine Sicherung durchführen."
|
67 |
|
68 |
+
#: src/Admin.php:165
|
69 |
msgid "WordPress Core Tables"
|
70 |
msgstr "Kerntabellen"
|
71 |
|
72 |
+
#: src/Admin.php:169
|
73 |
msgid "These tables are safe to update with the basic version of this plugin."
|
74 |
msgstr ""
|
75 |
"Diese Tabellen können mit der Basisversion dieses Plugins sicher "
|
76 |
"aktualisiert werden."
|
77 |
|
78 |
+
#: src/Admin.php:190
|
79 |
msgid "Tables Created By Plugins"
|
80 |
msgstr "Tabellen erstellt von Plugins"
|
81 |
|
82 |
+
#: src/Admin.php:196
|
83 |
#, php-format
|
84 |
msgctxt "{<br />}{<a>}{</a>}"
|
85 |
msgid ""
|
90 |
"dieses Plugins zu aktualisieren. %1$sUm Tabellen zu unterstützen, die von "
|
91 |
"Plugins erstellt wurden, verwenden Sie%2$sPro Version%3$s."
|
92 |
|
93 |
+
#: src/Admin.php:221 src/Admin.php:231
|
94 |
msgid "Old URL"
|
95 |
msgstr "Alte URL"
|
96 |
|
97 |
+
#: src/Admin.php:237 src/Admin.php:247
|
98 |
msgid "New URL"
|
99 |
msgstr "Neue URL"
|
100 |
|
101 |
+
#: src/Admin.php:253
|
102 |
msgid "Only the checked tables will be updated."
|
103 |
msgstr "Nur die überprüften Tabellen werden aktualisiert."
|
104 |
|
105 |
+
#: src/Admin.php:263
|
106 |
#, php-format
|
107 |
msgctxt "{<a>}{</a>}"
|
108 |
+
msgid "Use the %1$sPRO version%2$s to test the updates before making them."
|
109 |
msgstr ""
|
110 |
+
"Verwenden Sie die %1$sPRO-Version%2$s, um die Aktualisierungen zu testen, "
|
111 |
+
"bevor Sie sie vornehmen."
|
112 |
|
113 |
+
#: src/Admin.php:270
|
114 |
msgid "Update URLs"
|
115 |
msgstr "URLs aktualisieren"
|
116 |
|
117 |
+
#: src/Updaters/Updaters_Abstract.php:90
|
118 |
+
msgid "You must implement apply_rule_to_url with an override"
|
119 |
+
msgstr ""
|
120 |
+
"Sie müssen apply_rule_to_url mit einer Außerkraftsetzung implementieren"
|
121 |
+
|
122 |
#. Plugin URI of the plugin/theme
|
123 |
msgid "https://onpointplugins.com/go-live-update-urls/"
|
124 |
msgstr "https://onpointplugins.com/go-live-update-urls/"
|
139 |
msgid "https://onpointplugins.com/"
|
140 |
msgstr "https://onpointplugins.com/"
|
141 |
|
142 |
+
#~ msgid ""
|
143 |
+
#~ "OnPoint Plugins Author URI: https://onpointplugins.com/ Version: 5.3.0 "
|
144 |
+
#~ "Text Domain:"
|
145 |
+
#~ msgstr ""
|
146 |
+
#~ "OnPoint Plugins Author URI: https://onpointplugins.com/ Version: 5.3.0 "
|
147 |
+
#~ "Text Domain:"
|
148 |
+
|
149 |
+
#~ msgid "https://onpointplugins.com/ Version: 5.3.0 Text Domain:"
|
150 |
+
#~ msgstr "https://onpointplugins.com/ Version: 5.3.0 Text Domain:"
|
151 |
+
|
152 |
+
#~ msgid "Serialized"
|
153 |
+
#~ msgstr "Seriell"
|
154 |
+
|
155 |
+
#, php-format
|
156 |
+
#~ msgctxt "{<a>}{</a>}"
|
157 |
+
#~ msgid ""
|
158 |
+
#~ "To test this change before running it, use %1$sPro Version 2.0.0+%2$s."
|
159 |
+
#~ msgstr ""
|
160 |
+
#~ "Um diese Änderung vor dem Ausführen zu testen, verwenden Sie%1$sPro "
|
161 |
+
#~ "Version 2.0.0 +%2$s."
|
162 |
+
|
163 |
#~ msgid "Go Live Update URLS"
|
164 |
#~ msgstr "Go Live Update URLS"
|
165 |
|
languages/go-live-update-urls-es_ES.mo
CHANGED
Binary file
|
languages/go-live-update-urls-es_ES.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Go Live Update Urls\n"
|
4 |
-
"POT-Creation-Date:
|
5 |
-
"PO-Revision-Date:
|
6 |
"Last-Translator: Mat Lipe <support@onpointplugins.com>\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: es_ES\n"
|
@@ -10,7 +10,7 @@ msgstr ""
|
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
-
"X-Generator: Poedit 2.
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
@@ -20,28 +20,34 @@ msgstr ""
|
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
msgid "Ouch! That hurt! You should not be here!"
|
25 |
msgstr "¡Ay! ¡Eso duele! ¡No deberías estar aquí!"
|
26 |
|
27 |
-
#: src/
|
28 |
msgid "The URLS in the checked tables have been updated."
|
29 |
msgstr "Las URL en las tablas comprobadas se han actualizado."
|
30 |
|
31 |
-
#: src/
|
32 |
msgid "You must fill out both URLs and select tables to update URLs!"
|
33 |
msgstr "¡Debe completar ambas URL para hacer la actualización !"
|
34 |
|
35 |
-
#: src/Admin_Page.php:147
|
36 |
-
msgid "Serialized"
|
37 |
-
msgstr "Serializado"
|
38 |
-
|
39 |
#. Plugin Name of the plugin/theme
|
40 |
-
#:
|
41 |
msgid "Go Live Update Urls"
|
42 |
msgstr "Go Live Update Urls"
|
43 |
|
44 |
-
#:
|
45 |
#, php-format
|
46 |
msgctxt "{<strong>} {</strong>}"
|
47 |
msgid ""
|
@@ -51,7 +57,7 @@ msgstr ""
|
|
51 |
"Esto reemplazará todas las ocurrencias%1$ sin toda la base de datos%2$ s de "
|
52 |
"la URL anterior con la Nueva URL."
|
53 |
|
54 |
-
#:
|
55 |
msgid ""
|
56 |
"Like any other database updating tool, you should always perform a backup "
|
57 |
"before running."
|
@@ -59,21 +65,21 @@ msgstr ""
|
|
59 |
"Al igual que cualquier otra herramienta de actualización de base de datos, "
|
60 |
"siempre debe realizar una copia de seguridad antes de ejecutar."
|
61 |
|
62 |
-
#:
|
63 |
msgid "WordPress Core Tables"
|
64 |
msgstr "Tablas centrales"
|
65 |
|
66 |
-
#:
|
67 |
msgid "These tables are safe to update with the basic version of this plugin."
|
68 |
msgstr ""
|
69 |
"Estas tablas son seguras para actualizarse con la versión básica de este "
|
70 |
"complemento."
|
71 |
|
72 |
-
#:
|
73 |
msgid "Tables Created By Plugins"
|
74 |
msgstr "Tablas creadas por complementos"
|
75 |
|
76 |
-
#:
|
77 |
#, php-format
|
78 |
msgctxt "{<br />}{<a>}{</a>}"
|
79 |
msgid ""
|
@@ -84,29 +90,34 @@ msgstr ""
|
|
84 |
"básica de este complemento. %1$sPara soportar tablas creadas por plugins use"
|
85 |
"%2$sPro Version%3$s."
|
86 |
|
87 |
-
#:
|
88 |
msgid "Old URL"
|
89 |
msgstr "URL antigua"
|
90 |
|
91 |
-
#:
|
92 |
msgid "New URL"
|
93 |
msgstr "Nueva URL"
|
94 |
|
95 |
-
#:
|
96 |
msgid "Only the checked tables will be updated."
|
97 |
msgstr "Solo las tablas comprobadas serán actualizadas."
|
98 |
|
99 |
-
#:
|
100 |
#, php-format
|
101 |
msgctxt "{<a>}{</a>}"
|
102 |
-
msgid "
|
103 |
msgstr ""
|
104 |
-
"
|
|
|
105 |
|
106 |
-
#:
|
107 |
msgid "Update URLs"
|
108 |
msgstr "Actualizar URL"
|
109 |
|
|
|
|
|
|
|
|
|
110 |
#. Plugin URI of the plugin/theme
|
111 |
msgid "https://onpointplugins.com/go-live-update-urls/"
|
112 |
msgstr "https://onpointplugins.com/go-live-update-urls/"
|
@@ -126,3 +137,24 @@ msgstr "OnPoint Plugins"
|
|
126 |
#. Author URI of the plugin/theme
|
127 |
msgid "https://onpointplugins.com/"
|
128 |
msgstr "https://onpointplugins.com/"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Go Live Update Urls\n"
|
4 |
+
"POT-Creation-Date: 2020-06-10 12:21-0600\n"
|
5 |
+
"PO-Revision-Date: 2020-06-10 12:21-0600\n"
|
6 |
"Last-Translator: Mat Lipe <support@onpointplugins.com>\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: es_ES\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
13 |
+
"X-Generator: Poedit 2.3.1\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
+
#: go-live-update-urls.php:86
|
24 |
+
#, php-format
|
25 |
+
msgctxt "{<a>}{</a>}"
|
26 |
+
msgid ""
|
27 |
+
"Go Live Update Urls requires %1$sGo Live Update Urls PRO %3$s+%2$s. Please "
|
28 |
+
"update or deactivate the PRO version."
|
29 |
+
msgstr ""
|
30 |
+
"Go Live Update Urls requiere %1$sGo Live Update Urls PRO %3$s+%2$s. "
|
31 |
+
"Actualice o desactive la versión PRO."
|
32 |
+
|
33 |
+
#: src/Admin.php:44
|
34 |
msgid "Ouch! That hurt! You should not be here!"
|
35 |
msgstr "¡Ay! ¡Eso duele! ¡No deberías estar aquí!"
|
36 |
|
37 |
+
#: src/Admin.php:78
|
38 |
msgid "The URLS in the checked tables have been updated."
|
39 |
msgstr "Las URL en las tablas comprobadas se han actualizado."
|
40 |
|
41 |
+
#: src/Admin.php:97
|
42 |
msgid "You must fill out both URLs and select tables to update URLs!"
|
43 |
msgstr "¡Debe completar ambas URL para hacer la actualización !"
|
44 |
|
|
|
|
|
|
|
|
|
45 |
#. Plugin Name of the plugin/theme
|
46 |
+
#: src/Admin.php:130
|
47 |
msgid "Go Live Update Urls"
|
48 |
msgstr "Go Live Update Urls"
|
49 |
|
50 |
+
#: src/Admin.php:140
|
51 |
#, php-format
|
52 |
msgctxt "{<strong>} {</strong>}"
|
53 |
msgid ""
|
57 |
"Esto reemplazará todas las ocurrencias%1$ sin toda la base de datos%2$ s de "
|
58 |
"la URL anterior con la Nueva URL."
|
59 |
|
60 |
+
#: src/Admin.php:146
|
61 |
msgid ""
|
62 |
"Like any other database updating tool, you should always perform a backup "
|
63 |
"before running."
|
65 |
"Al igual que cualquier otra herramienta de actualización de base de datos, "
|
66 |
"siempre debe realizar una copia de seguridad antes de ejecutar."
|
67 |
|
68 |
+
#: src/Admin.php:165
|
69 |
msgid "WordPress Core Tables"
|
70 |
msgstr "Tablas centrales"
|
71 |
|
72 |
+
#: src/Admin.php:169
|
73 |
msgid "These tables are safe to update with the basic version of this plugin."
|
74 |
msgstr ""
|
75 |
"Estas tablas son seguras para actualizarse con la versión básica de este "
|
76 |
"complemento."
|
77 |
|
78 |
+
#: src/Admin.php:190
|
79 |
msgid "Tables Created By Plugins"
|
80 |
msgstr "Tablas creadas por complementos"
|
81 |
|
82 |
+
#: src/Admin.php:196
|
83 |
#, php-format
|
84 |
msgctxt "{<br />}{<a>}{</a>}"
|
85 |
msgid ""
|
90 |
"básica de este complemento. %1$sPara soportar tablas creadas por plugins use"
|
91 |
"%2$sPro Version%3$s."
|
92 |
|
93 |
+
#: src/Admin.php:221 src/Admin.php:231
|
94 |
msgid "Old URL"
|
95 |
msgstr "URL antigua"
|
96 |
|
97 |
+
#: src/Admin.php:237 src/Admin.php:247
|
98 |
msgid "New URL"
|
99 |
msgstr "Nueva URL"
|
100 |
|
101 |
+
#: src/Admin.php:253
|
102 |
msgid "Only the checked tables will be updated."
|
103 |
msgstr "Solo las tablas comprobadas serán actualizadas."
|
104 |
|
105 |
+
#: src/Admin.php:263
|
106 |
#, php-format
|
107 |
msgctxt "{<a>}{</a>}"
|
108 |
+
msgid "Use the %1$sPRO version%2$s to test the updates before making them."
|
109 |
msgstr ""
|
110 |
+
"Utilice la versión %1$sPRO%2$s para probar las actualizaciones antes de "
|
111 |
+
"realizarlas."
|
112 |
|
113 |
+
#: src/Admin.php:270
|
114 |
msgid "Update URLs"
|
115 |
msgstr "Actualizar URL"
|
116 |
|
117 |
+
#: src/Updaters/Updaters_Abstract.php:90
|
118 |
+
msgid "You must implement apply_rule_to_url with an override"
|
119 |
+
msgstr "Debe implementar apply_rule_to_url con una invalidación"
|
120 |
+
|
121 |
#. Plugin URI of the plugin/theme
|
122 |
msgid "https://onpointplugins.com/go-live-update-urls/"
|
123 |
msgstr "https://onpointplugins.com/go-live-update-urls/"
|
137 |
#. Author URI of the plugin/theme
|
138 |
msgid "https://onpointplugins.com/"
|
139 |
msgstr "https://onpointplugins.com/"
|
140 |
+
|
141 |
+
#~ msgid ""
|
142 |
+
#~ "OnPoint Plugins Author URI: https://onpointplugins.com/ Version: 5.3.0 "
|
143 |
+
#~ "Text Domain:"
|
144 |
+
#~ msgstr ""
|
145 |
+
#~ "OnPoint Plugins Author URI: https://onpointplugins.com/ Version: 5.3.0 "
|
146 |
+
#~ "Text Domain:"
|
147 |
+
|
148 |
+
#~ msgid "https://onpointplugins.com/ Version: 5.3.0 Text Domain:"
|
149 |
+
#~ msgstr "https://onpointplugins.com/ Version: 5.3.0 Text Domain:"
|
150 |
+
|
151 |
+
#~ msgid "Serialized"
|
152 |
+
#~ msgstr "Serializado"
|
153 |
+
|
154 |
+
#, php-format
|
155 |
+
#~ msgctxt "{<a>}{</a>}"
|
156 |
+
#~ msgid ""
|
157 |
+
#~ "To test this change before running it, use %1$sPro Version 2.0.0+%2$s."
|
158 |
+
#~ msgstr ""
|
159 |
+
#~ "Para probar este cambio antes de ejecutarlo, use%1$sPro Versión 2.0.0+"
|
160 |
+
#~ "%2$s."
|
languages/go-live-update-urls-fr_FR.mo
CHANGED
Binary file
|
languages/go-live-update-urls-fr_FR.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Go Live Update Urls\n"
|
4 |
-
"POT-Creation-Date:
|
5 |
-
"PO-Revision-Date:
|
6 |
"Last-Translator: Mat Lipe <support@onpointplugins.com>\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: fr_FR\n"
|
@@ -10,7 +10,7 @@ msgstr ""
|
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
13 |
-
"X-Generator: Poedit 2.
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
@@ -20,28 +20,34 @@ msgstr ""
|
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
msgid "Ouch! That hurt! You should not be here!"
|
25 |
msgstr "Aie! Ça fait mal! Tu ne devrais pas être ici!"
|
26 |
|
27 |
-
#: src/
|
28 |
msgid "The URLS in the checked tables have been updated."
|
29 |
msgstr "Les URL dans les tables vérifiées ont été mises à jour."
|
30 |
|
31 |
-
#: src/
|
32 |
msgid "You must fill out both URLs and select tables to update URLs!"
|
33 |
msgstr "Vous devez remplir les deux URL pour effectuer la mise à jour!"
|
34 |
|
35 |
-
#: src/Admin_Page.php:147
|
36 |
-
msgid "Serialized"
|
37 |
-
msgstr "Serial"
|
38 |
-
|
39 |
#. Plugin Name of the plugin/theme
|
40 |
-
#:
|
41 |
msgid "Go Live Update Urls"
|
42 |
msgstr "Go Live Update Urls"
|
43 |
|
44 |
-
#:
|
45 |
#, php-format
|
46 |
msgctxt "{<strong>} {</strong>}"
|
47 |
msgid ""
|
@@ -51,7 +57,7 @@ msgstr ""
|
|
51 |
"Cela remplacera toutes les occurrences%1$sin de la base de données entière"
|
52 |
"%2$s de l'ancienne URL avec la nouvelle URL."
|
53 |
|
54 |
-
#:
|
55 |
msgid ""
|
56 |
"Like any other database updating tool, you should always perform a backup "
|
57 |
"before running."
|
@@ -59,21 +65,21 @@ msgstr ""
|
|
59 |
"Comme tout autre outil de mise à jour de base de données, vous devez "
|
60 |
"toujours effectuer une sauvegarde avant de l'exécuter."
|
61 |
|
62 |
-
#:
|
63 |
msgid "WordPress Core Tables"
|
64 |
msgstr "Tables de base"
|
65 |
|
66 |
-
#:
|
67 |
msgid "These tables are safe to update with the basic version of this plugin."
|
68 |
msgstr ""
|
69 |
"Ces tables peuvent être mises à jour en toute sécurité avec la version de "
|
70 |
"base de ce plugin."
|
71 |
|
72 |
-
#:
|
73 |
msgid "Tables Created By Plugins"
|
74 |
msgstr "Tables créées par des plugins"
|
75 |
|
76 |
-
#:
|
77 |
#, php-format
|
78 |
msgctxt "{<br />}{<a>}{</a>}"
|
79 |
msgid ""
|
@@ -84,30 +90,34 @@ msgstr ""
|
|
84 |
"de base de ce plugin. %1$sPour prendre en charge les tables créées par les "
|
85 |
"plugins, utilisez la version%2$sPro%3$s."
|
86 |
|
87 |
-
#:
|
88 |
msgid "Old URL"
|
89 |
msgstr "Ancienne URL"
|
90 |
|
91 |
-
#:
|
92 |
msgid "New URL"
|
93 |
msgstr "Nouvelle URL"
|
94 |
|
95 |
-
#:
|
96 |
msgid "Only the checked tables will be updated."
|
97 |
msgstr "Seules les tables vérifiées seront mises à jour."
|
98 |
|
99 |
-
#:
|
100 |
#, php-format
|
101 |
msgctxt "{<a>}{</a>}"
|
102 |
-
msgid "
|
103 |
msgstr ""
|
104 |
-
"
|
105 |
-
"
|
106 |
|
107 |
-
#:
|
108 |
msgid "Update URLs"
|
109 |
msgstr "Mettre à jour les URL"
|
110 |
|
|
|
|
|
|
|
|
|
111 |
#. Plugin URI of the plugin/theme
|
112 |
msgid "https://onpointplugins.com/go-live-update-urls/"
|
113 |
msgstr "https://onpointplugins.com/go-live-update-urls/"
|
@@ -128,3 +138,24 @@ msgstr "OnPoint Plugins"
|
|
128 |
#. Author URI of the plugin/theme
|
129 |
msgid "https://onpointplugins.com/"
|
130 |
msgstr "https://onpointplugins.com/"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Go Live Update Urls\n"
|
4 |
+
"POT-Creation-Date: 2020-06-10 12:21-0600\n"
|
5 |
+
"PO-Revision-Date: 2020-06-10 12:21-0600\n"
|
6 |
"Last-Translator: Mat Lipe <support@onpointplugins.com>\n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: fr_FR\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
13 |
+
"X-Generator: Poedit 2.3.1\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
+
#: go-live-update-urls.php:86
|
24 |
+
#, php-format
|
25 |
+
msgctxt "{<a>}{</a>}"
|
26 |
+
msgid ""
|
27 |
+
"Go Live Update Urls requires %1$sGo Live Update Urls PRO %3$s+%2$s. Please "
|
28 |
+
"update or deactivate the PRO version."
|
29 |
+
msgstr ""
|
30 |
+
"Go Live Update Urls nécessite %1$sGo Live Update Urls PRO %3$s -%2$s. "
|
31 |
+
"Veuillez mettre à jour ou désactiver la version PRO."
|
32 |
+
|
33 |
+
#: src/Admin.php:44
|
34 |
msgid "Ouch! That hurt! You should not be here!"
|
35 |
msgstr "Aie! Ça fait mal! Tu ne devrais pas être ici!"
|
36 |
|
37 |
+
#: src/Admin.php:78
|
38 |
msgid "The URLS in the checked tables have been updated."
|
39 |
msgstr "Les URL dans les tables vérifiées ont été mises à jour."
|
40 |
|
41 |
+
#: src/Admin.php:97
|
42 |
msgid "You must fill out both URLs and select tables to update URLs!"
|
43 |
msgstr "Vous devez remplir les deux URL pour effectuer la mise à jour!"
|
44 |
|
|
|
|
|
|
|
|
|
45 |
#. Plugin Name of the plugin/theme
|
46 |
+
#: src/Admin.php:130
|
47 |
msgid "Go Live Update Urls"
|
48 |
msgstr "Go Live Update Urls"
|
49 |
|
50 |
+
#: src/Admin.php:140
|
51 |
#, php-format
|
52 |
msgctxt "{<strong>} {</strong>}"
|
53 |
msgid ""
|
57 |
"Cela remplacera toutes les occurrences%1$sin de la base de données entière"
|
58 |
"%2$s de l'ancienne URL avec la nouvelle URL."
|
59 |
|
60 |
+
#: src/Admin.php:146
|
61 |
msgid ""
|
62 |
"Like any other database updating tool, you should always perform a backup "
|
63 |
"before running."
|
65 |
"Comme tout autre outil de mise à jour de base de données, vous devez "
|
66 |
"toujours effectuer une sauvegarde avant de l'exécuter."
|
67 |
|
68 |
+
#: src/Admin.php:165
|
69 |
msgid "WordPress Core Tables"
|
70 |
msgstr "Tables de base"
|
71 |
|
72 |
+
#: src/Admin.php:169
|
73 |
msgid "These tables are safe to update with the basic version of this plugin."
|
74 |
msgstr ""
|
75 |
"Ces tables peuvent être mises à jour en toute sécurité avec la version de "
|
76 |
"base de ce plugin."
|
77 |
|
78 |
+
#: src/Admin.php:190
|
79 |
msgid "Tables Created By Plugins"
|
80 |
msgstr "Tables créées par des plugins"
|
81 |
|
82 |
+
#: src/Admin.php:196
|
83 |
#, php-format
|
84 |
msgctxt "{<br />}{<a>}{</a>}"
|
85 |
msgid ""
|
90 |
"de base de ce plugin. %1$sPour prendre en charge les tables créées par les "
|
91 |
"plugins, utilisez la version%2$sPro%3$s."
|
92 |
|
93 |
+
#: src/Admin.php:221 src/Admin.php:231
|
94 |
msgid "Old URL"
|
95 |
msgstr "Ancienne URL"
|
96 |
|
97 |
+
#: src/Admin.php:237 src/Admin.php:247
|
98 |
msgid "New URL"
|
99 |
msgstr "Nouvelle URL"
|
100 |
|
101 |
+
#: src/Admin.php:253
|
102 |
msgid "Only the checked tables will be updated."
|
103 |
msgstr "Seules les tables vérifiées seront mises à jour."
|
104 |
|
105 |
+
#: src/Admin.php:263
|
106 |
#, php-format
|
107 |
msgctxt "{<a>}{</a>}"
|
108 |
+
msgid "Use the %1$sPRO version%2$s to test the updates before making them."
|
109 |
msgstr ""
|
110 |
+
"Utilisez la version %1$sPRO%2$s pour tester les mises à jour avant de les "
|
111 |
+
"faire."
|
112 |
|
113 |
+
#: src/Admin.php:270
|
114 |
msgid "Update URLs"
|
115 |
msgstr "Mettre à jour les URL"
|
116 |
|
117 |
+
#: src/Updaters/Updaters_Abstract.php:90
|
118 |
+
msgid "You must implement apply_rule_to_url with an override"
|
119 |
+
msgstr "Vous devez mettre en œuvre apply_rule_to_url avec un remplacement"
|
120 |
+
|
121 |
#. Plugin URI of the plugin/theme
|
122 |
msgid "https://onpointplugins.com/go-live-update-urls/"
|
123 |
msgstr "https://onpointplugins.com/go-live-update-urls/"
|
138 |
#. Author URI of the plugin/theme
|
139 |
msgid "https://onpointplugins.com/"
|
140 |
msgstr "https://onpointplugins.com/"
|
141 |
+
|
142 |
+
#~ msgid ""
|
143 |
+
#~ "OnPoint Plugins Author URI: https://onpointplugins.com/ Version: 5.3.0 "
|
144 |
+
#~ "Text Domain:"
|
145 |
+
#~ msgstr ""
|
146 |
+
#~ "OnPoint Plugins Author URI: https://onpointplugins.com/ Version: 5.3.0 "
|
147 |
+
#~ "Text Domain:"
|
148 |
+
|
149 |
+
#~ msgid "https://onpointplugins.com/ Version: 5.3.0 Text Domain:"
|
150 |
+
#~ msgstr "https://onpointplugins.com/ Version: 5.3.0 Text Domain:"
|
151 |
+
|
152 |
+
#~ msgid "Serialized"
|
153 |
+
#~ msgstr "Serial"
|
154 |
+
|
155 |
+
#, php-format
|
156 |
+
#~ msgctxt "{<a>}{</a>}"
|
157 |
+
#~ msgid ""
|
158 |
+
#~ "To test this change before running it, use %1$sPro Version 2.0.0+%2$s."
|
159 |
+
#~ msgstr ""
|
160 |
+
#~ "Pour tester cette modification avant de l'exécuter, utilisez%1$sPro "
|
161 |
+
#~ "Version 2.0.0 +%2$s."
|
languages/go-live-update-urls.pot
CHANGED
@@ -3,14 +3,14 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: Go Live Update URLS\n"
|
6 |
-
"POT-Creation-Date:
|
7 |
"PO-Revision-Date: 2016-05-15 10:47-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 2.
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
@@ -20,28 +20,32 @@ msgstr ""
|
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
msgid "Ouch! That hurt! You should not be here!"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: src/
|
28 |
msgid "The URLS in the checked tables have been updated."
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: src/
|
32 |
msgid "You must fill out both URLs and select tables to update URLs!"
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: src/Admin_Page.php:147
|
36 |
-
msgid "Serialized"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
#. Plugin Name of the plugin/theme
|
40 |
-
#:
|
41 |
msgid "Go Live Update Urls"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#:
|
45 |
#, php-format
|
46 |
msgctxt "{<strong>} {</strong>}"
|
47 |
msgid ""
|
@@ -49,25 +53,25 @@ msgid ""
|
|
49 |
"URL with the New URL."
|
50 |
msgstr ""
|
51 |
|
52 |
-
#:
|
53 |
msgid ""
|
54 |
"Like any other database updating tool, you should always perform a backup "
|
55 |
"before running."
|
56 |
msgstr ""
|
57 |
|
58 |
-
#:
|
59 |
msgid "WordPress Core Tables"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#:
|
63 |
msgid "These tables are safe to update with the basic version of this plugin."
|
64 |
msgstr ""
|
65 |
|
66 |
-
#:
|
67 |
msgid "Tables Created By Plugins"
|
68 |
msgstr ""
|
69 |
|
70 |
-
#:
|
71 |
#, php-format
|
72 |
msgctxt "{<br />}{<a>}{</a>}"
|
73 |
msgid ""
|
@@ -76,28 +80,32 @@ msgid ""
|
|
76 |
"%3$s."
|
77 |
msgstr ""
|
78 |
|
79 |
-
#:
|
80 |
msgid "Old URL"
|
81 |
msgstr ""
|
82 |
|
83 |
-
#:
|
84 |
msgid "New URL"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#:
|
88 |
msgid "Only the checked tables will be updated."
|
89 |
msgstr ""
|
90 |
|
91 |
-
#:
|
92 |
#, php-format
|
93 |
msgctxt "{<a>}{</a>}"
|
94 |
-
msgid "
|
95 |
msgstr ""
|
96 |
|
97 |
-
#:
|
98 |
msgid "Update URLs"
|
99 |
msgstr ""
|
100 |
|
|
|
|
|
|
|
|
|
101 |
#. Plugin URI of the plugin/theme
|
102 |
msgid "https://onpointplugins.com/go-live-update-urls/"
|
103 |
msgstr ""
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: Go Live Update URLS\n"
|
6 |
+
"POT-Creation-Date: 2020-06-10 12:20-0600\n"
|
7 |
"PO-Revision-Date: 2016-05-15 10:47-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 2.3.1\n"
|
14 |
"X-Poedit-Basepath: ..\n"
|
15 |
"X-Poedit-WPHeader: go-live-update-urls.php\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
20 |
"X-Poedit-SearchPath-0: .\n"
|
21 |
"X-Poedit-SearchPathExcluded-0: *.js\n"
|
22 |
|
23 |
+
#: go-live-update-urls.php:86
|
24 |
+
#, php-format
|
25 |
+
msgctxt "{<a>}{</a>}"
|
26 |
+
msgid ""
|
27 |
+
"Go Live Update Urls requires %1$sGo Live Update Urls PRO %3$s+%2$s. Please "
|
28 |
+
"update or deactivate the PRO version."
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: src/Admin.php:44
|
32 |
msgid "Ouch! That hurt! You should not be here!"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: src/Admin.php:78
|
36 |
msgid "The URLS in the checked tables have been updated."
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: src/Admin.php:97
|
40 |
msgid "You must fill out both URLs and select tables to update URLs!"
|
41 |
msgstr ""
|
42 |
|
|
|
|
|
|
|
|
|
43 |
#. Plugin Name of the plugin/theme
|
44 |
+
#: src/Admin.php:130
|
45 |
msgid "Go Live Update Urls"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: src/Admin.php:140
|
49 |
#, php-format
|
50 |
msgctxt "{<strong>} {</strong>}"
|
51 |
msgid ""
|
53 |
"URL with the New URL."
|
54 |
msgstr ""
|
55 |
|
56 |
+
#: src/Admin.php:146
|
57 |
msgid ""
|
58 |
"Like any other database updating tool, you should always perform a backup "
|
59 |
"before running."
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: src/Admin.php:165
|
63 |
msgid "WordPress Core Tables"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: src/Admin.php:169
|
67 |
msgid "These tables are safe to update with the basic version of this plugin."
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: src/Admin.php:190
|
71 |
msgid "Tables Created By Plugins"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: src/Admin.php:196
|
75 |
#, php-format
|
76 |
msgctxt "{<br />}{<a>}{</a>}"
|
77 |
msgid ""
|
80 |
"%3$s."
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: src/Admin.php:221 src/Admin.php:231
|
84 |
msgid "Old URL"
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: src/Admin.php:237 src/Admin.php:247
|
88 |
msgid "New URL"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: src/Admin.php:253
|
92 |
msgid "Only the checked tables will be updated."
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: src/Admin.php:263
|
96 |
#, php-format
|
97 |
msgctxt "{<a>}{</a>}"
|
98 |
+
msgid "Use the %1$sPRO version%2$s to test the updates before making them."
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: src/Admin.php:270
|
102 |
msgid "Update URLs"
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: src/Updaters/Updaters_Abstract.php:90
|
106 |
+
msgid "You must implement apply_rule_to_url with an override"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
#. Plugin URI of the plugin/theme
|
110 |
msgid "https://onpointplugins.com/go-live-update-urls/"
|
111 |
msgstr ""
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
===
|
2 |
Contributors: Mat Lipe, onpointplugins
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40onpointplugins%2ecom&lc=US&item_name=Go%20Live%20Update%20Urls&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
|
4 |
Tags: urls, launching, site changes, tools, domain, domains, domain changes, url changes
|
5 |
Requires at least: 4.8.0
|
6 |
Tested up to: 5.4.1
|
7 |
Requires PHP: 5.6.0
|
8 |
-
Stable tag:
|
9 |
|
10 |
== Description ==
|
11 |
|
@@ -34,17 +34,18 @@ Goes through entire site and replaces all instances of an old url with a new one
|
|
34 |
* And much more
|
35 |
|
36 |
<h4>Pro Features</h4>
|
37 |
-
* Updates database tables created by plugins without fear of
|
38 |
* Database tables are organized into simple intuitive sections.
|
39 |
* Updates serialized data across any table.
|
|
|
40 |
* Improved admin page.
|
41 |
* Ability to test URL changes before running them.
|
42 |
-
* URL testing report is provided for peace of mind.
|
43 |
-
*
|
44 |
-
*
|
45 |
-
* Predictive URLs automatically fill in the
|
46 |
-
* Ability to choose between a full table
|
47 |
-
* WP-CLI support for updating URLs from the command line.
|
48 |
* Priority Support with access to members only support area.
|
49 |
|
50 |
<h4>Currently ships with the following languages</h4>
|
@@ -71,12 +72,6 @@ Manual Installation
|
|
71 |
|
72 |
== Frequently Asked Questions ==
|
73 |
|
74 |
-
= Not all URLs are updating? =
|
75 |
-
|
76 |
-
The most common issue when running this plugin is putting a `/` at the end of the domain. For example `http://domain.com/`. Some sites have the domain stored within the database without the trailing `/` and will not update everything in this way.
|
77 |
-
|
78 |
-
If you are seeing some but not all URLs updating when running the plugin, give it a try without the `/`. For example `http://domain.com`.
|
79 |
-
|
80 |
= Where do you use this plugin? =
|
81 |
|
82 |
Under the Tools menu in the dashboard there will be a "Go Live" link.
|
@@ -95,6 +90,12 @@ If you wish to try to update tables mentioned as not safe anyway, you may make a
|
|
95 |
1. Typical settings page. The verbiage will change slightly depending on your database structure
|
96 |
|
97 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
= 5.3.0 =
|
99 |
* Display error message when no tables are selected during update.
|
100 |
* Fix bug when updating columns which are name the same as MySQL commands.
|
@@ -150,6 +151,9 @@ If you wish to try to update tables mentioned as not safe anyway, you may make a
|
|
150 |
|
151 |
|
152 |
== Upgrade Notice ==
|
|
|
|
|
|
|
153 |
= 5.0.6 =
|
154 |
Fixes bug with submit button in a small number of browsers
|
155 |
|
1 |
+
=== Plugin Name ===
|
2 |
Contributors: Mat Lipe, onpointplugins
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=paypal%40onpointplugins%2ecom&lc=US&item_name=Go%20Live%20Update%20Urls&no_note=0¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest
|
4 |
Tags: urls, launching, site changes, tools, domain, domains, domain changes, url changes
|
5 |
Requires at least: 4.8.0
|
6 |
Tested up to: 5.4.1
|
7 |
Requires PHP: 5.6.0
|
8 |
+
Stable tag: 6.0.0
|
9 |
|
10 |
== Description ==
|
11 |
|
34 |
* And much more
|
35 |
|
36 |
<h4>Pro Features</h4>
|
37 |
+
* Updates database tables created by plugins without fear of breaking.
|
38 |
* Database tables are organized into simple intuitive sections.
|
39 |
* Updates serialized data across any table.
|
40 |
+
* Updates JSON data across any table.
|
41 |
* Improved admin page.
|
42 |
* Ability to test URL changes before running them.
|
43 |
+
* URL testing report is provided for peace of mind.
|
44 |
+
* Option to fix common mistakes automatically when entering a URL.
|
45 |
+
* iew and use history of your site's address.
|
46 |
+
* Predictive URLs automatically fill in the "Old URL" and "New URL.".
|
47 |
+
* Ability to choose between a full table or sections.
|
48 |
+
* WP-CLI support for updating URLs from the command line.
|
49 |
* Priority Support with access to members only support area.
|
50 |
|
51 |
<h4>Currently ships with the following languages</h4>
|
72 |
|
73 |
== Frequently Asked Questions ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
= Where do you use this plugin? =
|
76 |
|
77 |
Under the Tools menu in the dashboard there will be a "Go Live" link.
|
90 |
1. Typical settings page. The verbiage will change slightly depending on your database structure
|
91 |
|
92 |
== Changelog ==
|
93 |
+
= 6.0.0 =
|
94 |
+
* Entirely new code structure.
|
95 |
+
* Removed all deprecated code and filters.
|
96 |
+
* Improved filter and action names.
|
97 |
+
* Improved performance.
|
98 |
+
|
99 |
= 5.3.0 =
|
100 |
* Display error message when no tables are selected during update.
|
101 |
* Fix bug when updating columns which are name the same as MySQL commands.
|
151 |
|
152 |
|
153 |
== Upgrade Notice ==
|
154 |
+
= 6.0.0 =
|
155 |
+
Major version update. Not backward compatible with version 5 filters or code. Please remove any custom filters or extensions before updating.
|
156 |
+
|
157 |
= 5.0.6 =
|
158 |
Fixes bug with submit button in a small number of browsers
|
159 |
|
src/Admin.php
ADDED
@@ -0,0 +1,309 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Go_Live_Update_Urls;
|
4 |
+
|
5 |
+
use Go_Live_Update_Urls\Traits\Singleton;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Tools Page in WordPress Admin.
|
9 |
+
*
|
10 |
+
* @author OnPoint Plugins
|
11 |
+
* @since 6.0.0
|
12 |
+
*/
|
13 |
+
class Admin {
|
14 |
+
use Singleton;
|
15 |
+
|
16 |
+
const OLD_URL = 'old_url';
|
17 |
+
const NEW_URL = 'new_url';
|
18 |
+
const NONCE = 'go-live-update-urls/nonce/update-tables';
|
19 |
+
const TABLE_INPUT_NAME = 'go-live-update-urls/input/database-table';
|
20 |
+
const SUBMIT = 'go-live-update-urls/input/submit';
|
21 |
+
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add actions.
|
25 |
+
*/
|
26 |
+
protected function hook() {
|
27 |
+
if ( ! empty( $_POST[ self::SUBMIT ] ) ) { //phpcs:ignore
|
28 |
+
add_action( 'init', [ $this, 'validate_update_submission' ] );
|
29 |
+
}
|
30 |
+
|
31 |
+
add_action( 'admin_menu', [ $this, 'register_admin_page' ] );
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Validate and trigger an update submission
|
37 |
+
*
|
38 |
+
* @since 5.0.0
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
+
public function validate_update_submission() {
|
43 |
+
if ( ! isset( $_POST[ self::NONCE ] ) || ! wp_verify_nonce( $_POST[ self::NONCE ], self::NONCE ) ) {
|
44 |
+
wp_die( esc_html__( 'Ouch! That hurt! You should not be here!', 'go-live-update-urls' ) );
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( empty( $_POST[ self::OLD_URL ] ) || empty( $_POST[ self::NEW_URL ] ) ) {
|
48 |
+
$this->failure_message();
|
49 |
+
return;
|
50 |
+
}
|
51 |
+
|
52 |
+
$old_url = trim( sanitize_text_field( \wp_unslash( $_POST[ self::OLD_URL ] ) ) );
|
53 |
+
$new_url = trim( sanitize_text_field( \wp_unslash( $_POST[ self::NEW_URL ] ) ) );
|
54 |
+
if ( empty( $old_url ) || empty( $new_url ) || empty( $_POST[ self::TABLE_INPUT_NAME ] ) ) {
|
55 |
+
$this->failure_message();
|
56 |
+
return;
|
57 |
+
}
|
58 |
+
|
59 |
+
$tables = array_map( 'sanitize_text_field', \wp_unslash( $_POST[ self::TABLE_INPUT_NAME ] ) );
|
60 |
+
|
61 |
+
do_action( 'go-live-update-urls/admin-page/before-update', $old_url, $new_url, $tables );
|
62 |
+
|
63 |
+
if ( Database::instance()->update_the_database( $old_url, $new_url, $tables ) ) {
|
64 |
+
add_action( 'admin_notices', [ $this, 'success' ] );
|
65 |
+
add_filter( 'go-live-update-urls/views/admin-tools-page/disable-description', '__return_true' );
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Render a success message as admin banner.
|
72 |
+
*/
|
73 |
+
public function success() {
|
74 |
+
?>
|
75 |
+
<div id="message" class="updated fade">
|
76 |
+
<p>
|
77 |
+
<strong>
|
78 |
+
<?php echo esc_html( apply_filters( 'go-live-update-urls/admin/success', __( 'The URLS in the checked tables have been updated.', 'go-live-update-urls' ) ) ); ?>
|
79 |
+
</strong>
|
80 |
+
</p>
|
81 |
+
</div>
|
82 |
+
<?php
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Display a message if any fields were not filed out.
|
88 |
+
*
|
89 |
+
* @return void
|
90 |
+
*/
|
91 |
+
public function failure_message() {
|
92 |
+
add_action( 'admin_notices', function () {
|
93 |
+
?>
|
94 |
+
<div id="message" class="error fade">
|
95 |
+
<p>
|
96 |
+
<strong>
|
97 |
+
<?php esc_html_e( 'You must fill out both URLs and select tables to update URLs!', 'go-live-update-urls' ); ?>
|
98 |
+
</strong>
|
99 |
+
</p>
|
100 |
+
</div>
|
101 |
+
<?php
|
102 |
+
} );
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Menu Under Tools Menu
|
108 |
+
*
|
109 |
+
* @since 5.0.0
|
110 |
+
*/
|
111 |
+
public function register_admin_page() {
|
112 |
+
add_management_page( 'go-live-update-urls-setting', 'Go Live', 'manage_options', 'go-live-update-urls-settings', [
|
113 |
+
$this,
|
114 |
+
'admin_page',
|
115 |
+
] );
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Output the Admin Page for using this plugin
|
121 |
+
*
|
122 |
+
* @since 5.0.0
|
123 |
+
*/
|
124 |
+
public function admin_page() {
|
125 |
+
wp_enqueue_script( 'go-live-update-urls-admin-page', GO_LIVE_UPDATE_URLS_URL . 'resources/js/admin-page.js', [ 'jquery' ], GO_LIVE_UPDATE_URLS_VERSION, true );
|
126 |
+
|
127 |
+
?>
|
128 |
+
<div id="go-live-update-urls/admin-page" class="wrap">
|
129 |
+
<h2>
|
130 |
+
<?php esc_html_e( 'Go Live Update Urls', 'go-live-update-urls' ); ?>
|
131 |
+
</h2>
|
132 |
+
|
133 |
+
<?php
|
134 |
+
if ( ! apply_filters( 'go-live-update-urls/views/admin-tools-page/disable-description', false ) ) {
|
135 |
+
?>
|
136 |
+
|
137 |
+
<p class="description">
|
138 |
+
<?php
|
139 |
+
/* translators: <strong></strong> */
|
140 |
+
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>' );
|
141 |
+
?>
|
142 |
+
</p>
|
143 |
+
|
144 |
+
<strong>
|
145 |
+
<em style="color:red">
|
146 |
+
<?php esc_html_e( 'Like any other database updating tool, you should always perform a backup before running.', 'go-live-update-urls' ); ?>
|
147 |
+
</em>
|
148 |
+
</strong>
|
149 |
+
<br /><br />
|
150 |
+
<hr />
|
151 |
+
|
152 |
+
<?php
|
153 |
+
}
|
154 |
+
?>
|
155 |
+
|
156 |
+
<form method="post" class="go-live-update-urls/admin/checkbox-form">
|
157 |
+
<?php
|
158 |
+
wp_nonce_field( self::NONCE, self::NONCE );
|
159 |
+
|
160 |
+
do_action( 'go-live-update-urls-pro/admin/before-checkboxes', Database::instance() );
|
161 |
+
|
162 |
+
if ( apply_filters( 'go-live-update-urls-pro/admin/use-default-checkboxes', true ) ) {
|
163 |
+
?>
|
164 |
+
<h2>
|
165 |
+
<?php esc_html_e( 'WordPress Core Tables', 'go-live-update-urls' ); ?>
|
166 |
+
</h2>
|
167 |
+
<p class="description" style="color:green">
|
168 |
+
<strong>
|
169 |
+
<?php esc_attr_e( 'These tables are safe to update with the basic version of this plugin.', 'go-live-update-urls' ); ?>
|
170 |
+
</strong>
|
171 |
+
</p>
|
172 |
+
<p>
|
173 |
+
<input
|
174 |
+
type="checkbox"
|
175 |
+
class="go-live-update-urls/checkboxes/check-all"
|
176 |
+
data-list="wp-core"
|
177 |
+
data-js="go-live-update-urls/checkboxes/check-all"
|
178 |
+
checked
|
179 |
+
/>
|
180 |
+
</p>
|
181 |
+
<hr />
|
182 |
+
<?php
|
183 |
+
$this->render_check_boxes( Database::instance()->get_core_tables(), 'wp-core' );
|
184 |
+
$custom_tables = Database::instance()->get_custom_plugin_tables();
|
185 |
+
if ( ! empty( $custom_tables ) ) {
|
186 |
+
?>
|
187 |
+
<hr />
|
188 |
+
|
189 |
+
<h2>
|
190 |
+
<?php esc_html_e( 'Tables Created By Plugins', 'go-live-update-urls' ); ?>
|
191 |
+
</h2>
|
192 |
+
<p class="description" style="color:red">
|
193 |
+
<strong>
|
194 |
+
<?php
|
195 |
+
/* translators: <br /> <a> </a> */
|
196 |
+
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://onpointplugins.com/product/go-live-update-urls-pro/" target="_blank">', '</a>' );
|
197 |
+
?>
|
198 |
+
</strong>
|
199 |
+
</p>
|
200 |
+
<p>
|
201 |
+
<input
|
202 |
+
type="checkbox"
|
203 |
+
class="go-live-update-urls/checkboxes/check-all"
|
204 |
+
data-list="custom-plugins"
|
205 |
+
data-js="go-live-update-urls/checkboxes/check-all" />
|
206 |
+
</p>
|
207 |
+
<hr />
|
208 |
+
<?php
|
209 |
+
$this->render_check_boxes( $custom_tables, 'custom-plugins', false );
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
+
do_action( 'go-live-update-urls-pro/admin/after-checkboxes', Database::instance() );
|
214 |
+
|
215 |
+
?>
|
216 |
+
<hr />
|
217 |
+
<table class="form-table" data-js="go-live-update-urls/admin/url-fields">
|
218 |
+
<tr>
|
219 |
+
<th scope="row" style="width:150px;">
|
220 |
+
<label for="old_url">
|
221 |
+
<?php esc_html_e( 'Old URL', 'go-live-update-urls' ); ?>
|
222 |
+
</label>
|
223 |
+
</th>
|
224 |
+
<td>
|
225 |
+
<input
|
226 |
+
name="<?php echo esc_attr( self::OLD_URL ); ?>"
|
227 |
+
type="text"
|
228 |
+
id="old_url"
|
229 |
+
value=""
|
230 |
+
style="width:300px;"
|
231 |
+
title="<?php esc_attr_e( 'Old URL', 'go-live-update-urls' ); ?>" />
|
232 |
+
</td>
|
233 |
+
</tr>
|
234 |
+
<tr>
|
235 |
+
<th scope="row" style="width:150px;">
|
236 |
+
<label for="new_url">
|
237 |
+
<?php esc_attr_e( 'New URL', 'go-live-update-urls' ); ?>
|
238 |
+
</label>
|
239 |
+
</th>
|
240 |
+
<td>
|
241 |
+
<input
|
242 |
+
name="<?php echo esc_attr( self::NEW_URL ); ?>"
|
243 |
+
type="text"
|
244 |
+
id="new_url"
|
245 |
+
value=""
|
246 |
+
style="width:300px;"
|
247 |
+
title="<?php esc_attr_e( 'New URL', 'go-live-update-urls' ); ?>" />
|
248 |
+
</td>
|
249 |
+
</tr>
|
250 |
+
</table>
|
251 |
+
<p class="description" data-js="go-live-update-urls/admin/only-checked-tables">
|
252 |
+
<strong>
|
253 |
+
<?php esc_html_e( 'Only the checked tables will be updated.', 'go-live-update-urls' ); ?>
|
254 |
+
</strong>
|
255 |
+
</p>
|
256 |
+
<?php
|
257 |
+
if ( apply_filters( 'go-live-update-urls-pro/admin/use-default-checkboxes', true ) ) {
|
258 |
+
?>
|
259 |
+
<p class="description" style="color:#23282d">
|
260 |
+
<strong>
|
261 |
+
<?php
|
262 |
+
/* translators: <a></a> */
|
263 |
+
printf( esc_html_x( 'Use the %1$sPRO version%2$s to test the updates before making them.', '{<a>}{</a>}', 'go-live-update-urls' ), '<a href="https://onpointplugins.com/product/go-live-update-urls-pro/" target="_blank">', '</a>' );
|
264 |
+
?>
|
265 |
+
</strong>
|
266 |
+
</p>
|
267 |
+
<?php
|
268 |
+
}
|
269 |
+
?>
|
270 |
+
<?php submit_button( __( 'Update URLs', 'go-live-update-urls' ), 'primary', self::SUBMIT ); ?>
|
271 |
+
</form>
|
272 |
+
</div>
|
273 |
+
<?php
|
274 |
+
}
|
275 |
+
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Creates a list of checkboxes for each table
|
279 |
+
*
|
280 |
+
* @param array $tables - List of all tables.
|
281 |
+
* @param string $list - Used by js to separate lists.
|
282 |
+
* @param bool $checked - Should all checkboxes be checked.
|
283 |
+
*
|
284 |
+
* @since 5.0.0
|
285 |
+
*
|
286 |
+
* @return void
|
287 |
+
*/
|
288 |
+
public function render_check_boxes( $tables, $list, $checked = true ) {
|
289 |
+
?>
|
290 |
+
<ul
|
291 |
+
class="go-live-update-urls/checkboxes go-live-update-urls/checkboxes/<?php echo esc_attr( $list ); ?>"
|
292 |
+
data-list="<?php echo esc_attr( $list ); ?>">
|
293 |
+
<?php
|
294 |
+
|
295 |
+
foreach ( $tables as $_table ) {
|
296 |
+
?>
|
297 |
+
<li>
|
298 |
+
<?php
|
299 |
+
printf( '<input name="%s[]" type="checkbox" value="%s" %s/> %s', esc_attr( self::TABLE_INPUT_NAME ), esc_attr( $_table ), checked( $checked, true, false ), esc_html( $_table ) );
|
300 |
+
?>
|
301 |
+
</li>
|
302 |
+
<?php
|
303 |
+
}
|
304 |
+
|
305 |
+
?>
|
306 |
+
</ul>
|
307 |
+
<?php
|
308 |
+
}
|
309 |
+
}
|
src/Core.php
CHANGED
@@ -1,22 +1,30 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
3 |
/**
|
4 |
-
*
|
5 |
*
|
6 |
* @author OnPoint Plugins
|
7 |
-
* @since
|
8 |
-
*
|
9 |
*/
|
10 |
-
class
|
|
|
|
|
11 |
const MEMORY_LIMIT = '256M';
|
12 |
|
13 |
|
|
|
|
|
|
|
14 |
protected function hook() {
|
15 |
-
add_action( 'go-live-update-urls/database/before-update',
|
16 |
-
add_filter( 'go-live-update-urls/database/memory-limit_memory_limit',
|
17 |
$this,
|
18 |
'raise_memory_limit',
|
19 |
-
|
20 |
}
|
21 |
|
22 |
|
@@ -25,13 +33,13 @@ class Go_Live_Update_Urls_Core {
|
|
25 |
* 2. Set input time to unlimited
|
26 |
* 3. Set memory limit to context which will use our filter
|
27 |
*
|
28 |
-
* @see
|
29 |
*
|
30 |
* @return void
|
31 |
*/
|
32 |
public function raise_resource_limits() {
|
33 |
-
@set_time_limit( 0 );
|
34 |
-
@ini_set( 'max_input_time', '-1' );
|
35 |
|
36 |
wp_raise_memory_limit( 'go-live-update-urls/database/memory-limit' );
|
37 |
}
|
@@ -44,7 +52,6 @@ class Go_Live_Update_Urls_Core {
|
|
44 |
*
|
45 |
* @uses wp_raise_memory_limit();
|
46 |
*
|
47 |
-
*
|
48 |
* @return string
|
49 |
*/
|
50 |
public function raise_memory_limit() {
|
@@ -57,131 +64,19 @@ class Go_Live_Update_Urls_Core {
|
|
57 |
*
|
58 |
* Mostly used for unit testing and future WP-CLI command
|
59 |
*
|
60 |
-
* @param string $old_url
|
61 |
-
* @param string $new_url
|
62 |
*
|
63 |
* @since 5.0.1
|
64 |
*
|
65 |
* @return bool
|
66 |
*/
|
67 |
public function update( $old_url, $new_url ) {
|
68 |
-
$db
|
69 |
$tables = $db->get_all_table_names();
|
70 |
|
71 |
do_action( 'go-live-update-urls/core/before-update', $old_url, $new_url, $tables );
|
72 |
|
73 |
return $db->update_the_database( $old_url, $new_url, $tables );
|
74 |
}
|
75 |
-
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Get a view file from the theme first then this plugin
|
79 |
-
*
|
80 |
-
* @since 5.0.0
|
81 |
-
*
|
82 |
-
* @param string $file
|
83 |
-
*
|
84 |
-
* @return string
|
85 |
-
*/
|
86 |
-
public function get_view_file( $file ) {
|
87 |
-
$theme_file = locate_template( array( 'go-live-update-urls/' . $file ) );
|
88 |
-
if ( empty( $theme_file ) ) {
|
89 |
-
$theme_file = self::plugin_path( 'views/' . $file );
|
90 |
-
}
|
91 |
-
|
92 |
-
return $theme_file;
|
93 |
-
|
94 |
-
}
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
/**************** static ****************************/
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Used along with self::plugin_path() to return path to this plugins files
|
102 |
-
*
|
103 |
-
* @var string
|
104 |
-
*/
|
105 |
-
private static $plugin_path = false;
|
106 |
-
|
107 |
-
/**
|
108 |
-
* To keep track of this plugins root dir
|
109 |
-
* Used along with self::plugin_url() to return url to plugin files
|
110 |
-
*
|
111 |
-
* @var string
|
112 |
-
*/
|
113 |
-
private static $plugin_url;
|
114 |
-
|
115 |
-
|
116 |
-
/**
|
117 |
-
* Retrieve the path this plugins dir
|
118 |
-
*
|
119 |
-
* @param string [$append] - optional path file or name to add
|
120 |
-
*
|
121 |
-
* @return string
|
122 |
-
*/
|
123 |
-
public static function plugin_path( $append = '' ) {
|
124 |
-
|
125 |
-
if ( ! self::$plugin_path ) {
|
126 |
-
self::$plugin_path = trailingslashit( dirname( dirname( __FILE__ ) ) );
|
127 |
-
}
|
128 |
-
|
129 |
-
return self::$plugin_path . $append;
|
130 |
-
}
|
131 |
-
|
132 |
-
|
133 |
-
/**
|
134 |
-
* Retrieve the url this plugins dir
|
135 |
-
*
|
136 |
-
* @param string [$append] - optional path file or name to add
|
137 |
-
*
|
138 |
-
* @return string
|
139 |
-
*/
|
140 |
-
public static function plugin_url( $append = '' ) {
|
141 |
-
|
142 |
-
if ( ! self::$plugin_url ) {
|
143 |
-
self::$plugin_url = trailingslashit( plugins_url( basename( self::plugin_path() ), dirname( dirname( __FILE__ ) ) ) );
|
144 |
-
}
|
145 |
-
|
146 |
-
return self::$plugin_url . $append;
|
147 |
-
}
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
//********** SINGLETON **********/
|
152 |
-
|
153 |
-
|
154 |
-
/**
|
155 |
-
* Instance of this class for use as singleton
|
156 |
-
*
|
157 |
-
* @var self
|
158 |
-
*/
|
159 |
-
protected static $instance;
|
160 |
-
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Create the instance of the class
|
164 |
-
*
|
165 |
-
* @static
|
166 |
-
* @return void
|
167 |
-
*/
|
168 |
-
public static function init() {
|
169 |
-
self::instance()->hook();
|
170 |
-
}
|
171 |
-
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Get (and instantiate, if necessary) the instance of the
|
175 |
-
* class
|
176 |
-
*
|
177 |
-
* @static
|
178 |
-
* @return self
|
179 |
-
*/
|
180 |
-
public static function instance() {
|
181 |
-
if ( ! is_a( self::$instance, __CLASS__ ) ) {
|
182 |
-
self::$instance = new self();
|
183 |
-
}
|
184 |
-
|
185 |
-
return self::$instance;
|
186 |
-
}
|
187 |
}
|
1 |
<?php
|
2 |
|
3 |
+
namespace Go_Live_Update_Urls;
|
4 |
+
|
5 |
+
use Go_Live_Update_Urls\Traits\Singleton;
|
6 |
+
|
7 |
/**
|
8 |
+
* Core functionality for the plugin.
|
9 |
*
|
10 |
* @author OnPoint Plugins
|
11 |
+
* @since 6.0.0
|
|
|
12 |
*/
|
13 |
+
class Core {
|
14 |
+
use Singleton;
|
15 |
+
|
16 |
const MEMORY_LIMIT = '256M';
|
17 |
|
18 |
|
19 |
+
/**
|
20 |
+
* Actions and filters.
|
21 |
+
*/
|
22 |
protected function hook() {
|
23 |
+
add_action( 'go-live-update-urls/database/before-update', [ $this, 'raise_resource_limits' ], 0, 0 );
|
24 |
+
add_filter( 'go-live-update-urls/database/memory-limit_memory_limit', [
|
25 |
$this,
|
26 |
'raise_memory_limit',
|
27 |
+
], 0, 0 );
|
28 |
}
|
29 |
|
30 |
|
33 |
* 2. Set input time to unlimited
|
34 |
* 3. Set memory limit to context which will use our filter
|
35 |
*
|
36 |
+
* @see Core::raise_memory_limit();
|
37 |
*
|
38 |
* @return void
|
39 |
*/
|
40 |
public function raise_resource_limits() {
|
41 |
+
@set_time_limit( 0 ); //phpcs:ignore
|
42 |
+
@ini_set( 'max_input_time', '-1' ); //phpcs:ignore
|
43 |
|
44 |
wp_raise_memory_limit( 'go-live-update-urls/database/memory-limit' );
|
45 |
}
|
52 |
*
|
53 |
* @uses wp_raise_memory_limit();
|
54 |
*
|
|
|
55 |
* @return string
|
56 |
*/
|
57 |
public function raise_memory_limit() {
|
64 |
*
|
65 |
* Mostly used for unit testing and future WP-CLI command
|
66 |
*
|
67 |
+
* @param string $old_url - The old URL.
|
68 |
+
* @param string $new_url - The new URL.
|
69 |
*
|
70 |
* @since 5.0.1
|
71 |
*
|
72 |
* @return bool
|
73 |
*/
|
74 |
public function update( $old_url, $new_url ) {
|
75 |
+
$db = Database::instance();
|
76 |
$tables = $db->get_all_table_names();
|
77 |
|
78 |
do_action( 'go-live-update-urls/core/before-update', $old_url, $new_url, $tables );
|
79 |
|
80 |
return $db->update_the_database( $old_url, $new_url, $tables );
|
81 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
src/Database.php
CHANGED
@@ -1,10 +1,20 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/**
|
3 |
-
*
|
4 |
*
|
5 |
* @author OnPoint Plugins
|
|
|
6 |
*/
|
7 |
-
class
|
|
|
|
|
8 |
/**
|
9 |
* Get list of tables we treat as serialized when updating
|
10 |
*
|
@@ -32,7 +42,7 @@ class Go_Live_Update_Urls_Database {
|
|
32 |
}
|
33 |
}
|
34 |
|
35 |
-
return apply_filters( 'go-live-update-urls
|
36 |
}
|
37 |
|
38 |
|
@@ -49,7 +59,7 @@ class Go_Live_Update_Urls_Database {
|
|
49 |
unset( $all_tables[ $_table ] );
|
50 |
}
|
51 |
|
52 |
-
return apply_filters( '
|
53 |
}
|
54 |
|
55 |
|
@@ -91,7 +101,7 @@ class Go_Live_Update_Urls_Database {
|
|
91 |
}
|
92 |
}
|
93 |
|
94 |
-
return apply_filters( '
|
95 |
}
|
96 |
|
97 |
|
@@ -128,8 +138,6 @@ class Go_Live_Update_Urls_Database {
|
|
128 |
* @param string $new_url - the new URL.
|
129 |
* @param array $tables - the tables we are going to update.
|
130 |
*
|
131 |
-
* @todo split this functionality into its own OOP class
|
132 |
-
*
|
133 |
* @since 5.0.0
|
134 |
*
|
135 |
* @return bool
|
@@ -138,7 +146,7 @@ class Go_Live_Update_Urls_Database {
|
|
138 |
global $wpdb;
|
139 |
do_action( 'go-live-update-urls/database/before-update', $old_url, $new_url, $tables, $this );
|
140 |
$tables = apply_filters( 'go-live-update-urls/database/update-tables', $tables, $this );
|
141 |
-
$updaters = (array)
|
142 |
|
143 |
// If the new domain is the old one with a new sub-domain like www.
|
144 |
if ( strpos( $new_url, $old_url ) !== false ) {
|
@@ -146,10 +154,10 @@ class Go_Live_Update_Urls_Database {
|
|
146 |
$double_subdomain = $subdomain . '.' . $new_url;
|
147 |
}
|
148 |
|
149 |
-
$serialized = new
|
150 |
$serialized->update_all_serialized_tables( $tables );
|
151 |
if ( ! empty( $double_subdomain ) ) {
|
152 |
-
$serialized = new
|
153 |
$serialized->update_all_serialized_tables( $tables );
|
154 |
}
|
155 |
|
@@ -158,11 +166,11 @@ class Go_Live_Update_Urls_Database {
|
|
158 |
foreach ( (array) $tables as $table ) {
|
159 |
$columns = $wpdb->get_col( $wpdb->prepare( $get_columns_query, $table ) );
|
160 |
foreach ( $columns as $_column ) {
|
161 |
-
$this->update_column( $table, $_column, $old_url, $new_url);
|
162 |
|
163 |
foreach ( $updaters as $_updater_class ) {
|
164 |
if ( class_exists( $_updater_class ) ) {
|
165 |
-
/* @var
|
166 |
$_updater = $_updater_class::factory( $table, $_column, $old_url, $new_url );
|
167 |
$_updater->update_data();
|
168 |
if ( ! empty( $double_subdomain ) ) {
|
@@ -172,11 +180,11 @@ class Go_Live_Update_Urls_Database {
|
|
172 |
}
|
173 |
}
|
174 |
|
175 |
-
// Fix the
|
176 |
if ( ! empty( $double_subdomain ) ) {
|
177 |
-
$this->update_column( $table, $_column, $double_subdomain, $new_url);
|
178 |
// Fix the emails breaking by being appended the new subdomain.
|
179 |
-
$this->update_column( $table, $_column, '@' . $new_url, '@' . $old_url);
|
180 |
}
|
181 |
}
|
182 |
}
|
@@ -192,8 +200,8 @@ class Go_Live_Update_Urls_Database {
|
|
192 |
/**
|
193 |
* Update an individual table's column.
|
194 |
*
|
195 |
-
* @param string $table
|
196 |
-
* @param string $column
|
197 |
* @param string $old_url Old URL.
|
198 |
* @param string $new_url New URL.
|
199 |
*
|
@@ -207,28 +215,4 @@ class Go_Live_Update_Urls_Database {
|
|
207 |
$update_query = 'UPDATE ' . $table . ' SET `' . $column . '` = replace(`' . $column . '`, %s, %s)';
|
208 |
$wpdb->query( $wpdb->prepare( $update_query, [ $old_url, $new_url ] ) );
|
209 |
}
|
210 |
-
|
211 |
-
// ********** SINGLETON **********/
|
212 |
-
|
213 |
-
/**
|
214 |
-
* Instance of this class for use as singleton
|
215 |
-
*
|
216 |
-
* @var self
|
217 |
-
*/
|
218 |
-
protected static $instance;
|
219 |
-
|
220 |
-
/**
|
221 |
-
* Get (and instantiate, if necessary) the instance of the
|
222 |
-
* class
|
223 |
-
*
|
224 |
-
* @static
|
225 |
-
* @return self
|
226 |
-
*/
|
227 |
-
public static function instance() {
|
228 |
-
if ( ! is_a( self::$instance, __CLASS__ ) ) {
|
229 |
-
self::$instance = new self();
|
230 |
-
}
|
231 |
-
|
232 |
-
return self::$instance;
|
233 |
-
}
|
234 |
}
|
1 |
<?php
|
2 |
+
|
3 |
+
namespace Go_Live_Update_Urls;
|
4 |
+
|
5 |
+
use Go_Live_Update_Urls\Traits\Singleton;
|
6 |
+
use Go_Live_Update_Urls\Updaters\Repo;
|
7 |
+
use Go_Live_Update_Urls\Updaters\Updaters_Abstract;
|
8 |
+
|
9 |
/**
|
10 |
+
* Database manipulation.
|
11 |
*
|
12 |
* @author OnPoint Plugins
|
13 |
+
* @since 6.0.0
|
14 |
*/
|
15 |
+
class Database {
|
16 |
+
use Singleton;
|
17 |
+
|
18 |
/**
|
19 |
* Get list of tables we treat as serialized when updating
|
20 |
*
|
42 |
}
|
43 |
}
|
44 |
|
45 |
+
return apply_filters( 'go-live-update-urls/database/serialized-tables', $serialized_tables );
|
46 |
}
|
47 |
|
48 |
|
59 |
unset( $all_tables[ $_table ] );
|
60 |
}
|
61 |
|
62 |
+
return apply_filters( 'go-live-update-urls/database/plugin-tables', array_keys( $all_tables ) );
|
63 |
}
|
64 |
|
65 |
|
101 |
}
|
102 |
}
|
103 |
|
104 |
+
return apply_filters( 'go-live-update-urls/database/core-tables', $tables );
|
105 |
}
|
106 |
|
107 |
|
138 |
* @param string $new_url - the new URL.
|
139 |
* @param array $tables - the tables we are going to update.
|
140 |
*
|
|
|
|
|
141 |
* @since 5.0.0
|
142 |
*
|
143 |
* @return bool
|
146 |
global $wpdb;
|
147 |
do_action( 'go-live-update-urls/database/before-update', $old_url, $new_url, $tables, $this );
|
148 |
$tables = apply_filters( 'go-live-update-urls/database/update-tables', $tables, $this );
|
149 |
+
$updaters = (array) Repo::instance()->get_updaters();
|
150 |
|
151 |
// If the new domain is the old one with a new sub-domain like www.
|
152 |
if ( strpos( $new_url, $old_url ) !== false ) {
|
154 |
$double_subdomain = $subdomain . '.' . $new_url;
|
155 |
}
|
156 |
|
157 |
+
$serialized = new Serialized( $old_url, $new_url );
|
158 |
$serialized->update_all_serialized_tables( $tables );
|
159 |
if ( ! empty( $double_subdomain ) ) {
|
160 |
+
$serialized = new Serialized( $double_subdomain, $new_url );
|
161 |
$serialized->update_all_serialized_tables( $tables );
|
162 |
}
|
163 |
|
166 |
foreach ( (array) $tables as $table ) {
|
167 |
$columns = $wpdb->get_col( $wpdb->prepare( $get_columns_query, $table ) );
|
168 |
foreach ( $columns as $_column ) {
|
169 |
+
$this->update_column( $table, $_column, $old_url, $new_url );
|
170 |
|
171 |
foreach ( $updaters as $_updater_class ) {
|
172 |
if ( class_exists( $_updater_class ) ) {
|
173 |
+
/* @var Updaters_Abstract $_updater - Individual updater class */
|
174 |
$_updater = $_updater_class::factory( $table, $_column, $old_url, $new_url );
|
175 |
$_updater->update_data();
|
176 |
if ( ! empty( $double_subdomain ) ) {
|
180 |
}
|
181 |
}
|
182 |
|
183 |
+
// Fix the double up if this was the old domain with a new subdomain.
|
184 |
if ( ! empty( $double_subdomain ) ) {
|
185 |
+
$this->update_column( $table, $_column, $double_subdomain, $new_url );
|
186 |
// Fix the emails breaking by being appended the new subdomain.
|
187 |
+
$this->update_column( $table, $_column, '@' . $new_url, '@' . $old_url );
|
188 |
}
|
189 |
}
|
190 |
}
|
200 |
/**
|
201 |
* Update an individual table's column.
|
202 |
*
|
203 |
+
* @param string $table Table to update.
|
204 |
+
* @param string $column Column to update.
|
205 |
* @param string $old_url Old URL.
|
206 |
* @param string $new_url New URL.
|
207 |
*
|
215 |
$update_query = 'UPDATE ' . $table . ' SET `' . $column . '` = replace(`' . $column . '`, %s, %s)';
|
216 |
$wpdb->query( $wpdb->prepare( $update_query, [ $old_url, $new_url ] ) );
|
217 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
}
|
src/Serialized.php
CHANGED
@@ -1,16 +1,36 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
3 |
/**
|
|
|
|
|
4 |
* @author OnPoint Plugins
|
5 |
-
* @since
|
6 |
*/
|
7 |
-
class
|
8 |
-
|
|
|
|
|
|
|
|
|
9 |
protected $new;
|
|
|
|
|
|
|
|
|
|
|
10 |
protected $old;
|
11 |
-
protected $table;
|
12 |
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
public function __construct( $old, $new ) {
|
15 |
$this->new = $new;
|
16 |
$this->old = $old;
|
@@ -27,7 +47,7 @@ class Go_Live_Update_Urls_Serialized {
|
|
27 |
* @return void
|
28 |
*/
|
29 |
public function update_all_serialized_tables( array $tables ) {
|
30 |
-
$serialized_tables =
|
31 |
|
32 |
foreach ( $serialized_tables as $table => $columns ) {
|
33 |
if ( ! in_array( $table, $tables, true ) ) {
|
@@ -43,38 +63,39 @@ class Go_Live_Update_Urls_Serialized {
|
|
43 |
/**
|
44 |
* Query all serialized rows from a database table and update them one by one
|
45 |
*
|
46 |
-
* @param $table
|
47 |
-
* @param $column
|
48 |
*
|
49 |
* @return void
|
50 |
*/
|
51 |
protected function update_table( $table, $column ) {
|
52 |
global $wpdb;
|
53 |
-
$
|
|
|
|
|
54 |
if ( empty( $pk[0] ) ) {
|
55 |
-
$pk = $wpdb->get_results(
|
56 |
if ( empty( $pk[0] ) ) {
|
57 |
-
//
|
58 |
return;
|
59 |
}
|
60 |
}
|
61 |
-
|
62 |
$primary_key_column = $pk[0]->Column_name;
|
63 |
|
64 |
-
// Get all
|
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 |
}
|
72 |
|
|
|
73 |
$clean = $this->replace_tree( @unserialize( $row->{$column} ) );
|
74 |
$clean = @serialize( $clean );
|
|
|
75 |
|
76 |
-
$wpdb->query( $wpdb->prepare( "UPDATE {$table} SET {$column}=%s WHERE {$primary_key_column}=%s", $clean, $row->{$primary_key_column} ) );
|
77 |
-
|
78 |
}
|
79 |
}
|
80 |
|
@@ -82,9 +103,9 @@ class Go_Live_Update_Urls_Serialized {
|
|
82 |
/**
|
83 |
* Replaces all the occurrences of a string in a multi-dimensional array or Object
|
84 |
*
|
85 |
-
* @
|
86 |
*
|
87 |
-
* @
|
88 |
*
|
89 |
* @since 5.2.0
|
90 |
*
|
@@ -118,17 +139,16 @@ class Go_Live_Update_Urls_Serialized {
|
|
118 |
* Also replace occurrences of an old url formatted using
|
119 |
* all available updaters
|
120 |
*
|
121 |
-
* @param string $
|
122 |
*
|
123 |
* @return string
|
124 |
*/
|
125 |
-
protected function replace( $
|
126 |
-
foreach (
|
127 |
-
|
128 |
-
$data = str_replace( $_updater->apply_rule_to_url( $this->old ), $_updater->apply_rule_to_url( $this->new ), $data );
|
129 |
}
|
130 |
|
131 |
-
return trim( str_replace( $this->old, $this->new, $
|
132 |
}
|
133 |
|
134 |
|
@@ -137,21 +157,21 @@ class Go_Live_Update_Urls_Serialized {
|
|
137 |
* Check first for serialized data,
|
138 |
* Then check for occurrences of any urls formatted by an updater
|
139 |
*
|
140 |
-
* @param string $
|
141 |
*
|
142 |
* @return bool
|
143 |
*/
|
144 |
-
protected function has_data_to_update( $
|
145 |
-
if ( ! is_serialized( $
|
146 |
return false;
|
147 |
}
|
148 |
|
149 |
-
if ( strpos( $
|
150 |
return true;
|
151 |
}
|
152 |
|
153 |
-
foreach (
|
154 |
-
if ( strpos( $
|
155 |
return true;
|
156 |
}
|
157 |
}
|
@@ -159,26 +179,4 @@ class Go_Live_Update_Urls_Serialized {
|
|
159 |
return false;
|
160 |
}
|
161 |
|
162 |
-
|
163 |
-
/**
|
164 |
-
* Get an array of all available url updaters
|
165 |
-
*
|
166 |
-
* @todo The current updater architecture uses object with 4 arguments passed to the class
|
167 |
-
* Come up with a better architecture which gives us access to apply_url_to_url() without
|
168 |
-
* empty constructing an object.
|
169 |
-
*
|
170 |
-
* @return Go_Live_Update_Urls__Updaters__Abstract[]
|
171 |
-
*/
|
172 |
-
protected function get_updater_objects() {
|
173 |
-
static $updaters;
|
174 |
-
if ( null === $updaters ) {
|
175 |
-
$updaters = (array) Go_Live_Update_Urls__Updaters__Repo::instance()->get_updaters();
|
176 |
-
foreach ( $updaters as $k => $_class ) {
|
177 |
-
$updaters[ $k ] = new $_class( null, null, null, null );
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
return $updaters;
|
182 |
-
}
|
183 |
-
|
184 |
}
|
1 |
<?php
|
2 |
|
3 |
+
namespace Go_Live_Update_Urls;
|
4 |
+
|
5 |
+
use Go_Live_Update_Urls\Updaters\Repo;
|
6 |
+
|
7 |
/**
|
8 |
+
* Serialized data handling.
|
9 |
+
*
|
10 |
* @author OnPoint Plugins
|
11 |
+
* @since 6.0.0
|
12 |
*/
|
13 |
+
class Serialized {
|
14 |
+
/**
|
15 |
+
* New URL
|
16 |
+
*
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
protected $new;
|
20 |
+
/**
|
21 |
+
* Old URL
|
22 |
+
*
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
protected $old;
|
|
|
26 |
|
27 |
|
28 |
+
/**
|
29 |
+
* Serialized constructor.
|
30 |
+
*
|
31 |
+
* @param string $old - Old URL.
|
32 |
+
* @param string $new - New URL.
|
33 |
+
*/
|
34 |
public function __construct( $old, $new ) {
|
35 |
$this->new = $new;
|
36 |
$this->old = $old;
|
47 |
* @return void
|
48 |
*/
|
49 |
public function update_all_serialized_tables( array $tables ) {
|
50 |
+
$serialized_tables = Database::instance()->get_serialized_tables();
|
51 |
|
52 |
foreach ( $serialized_tables as $table => $columns ) {
|
53 |
if ( ! in_array( $table, $tables, true ) ) {
|
63 |
/**
|
64 |
* Query all serialized rows from a database table and update them one by one
|
65 |
*
|
66 |
+
* @param string $table - Database table.
|
67 |
+
* @param string $column - Database column.
|
68 |
*
|
69 |
* @return void
|
70 |
*/
|
71 |
protected function update_table( $table, $column ) {
|
72 |
global $wpdb;
|
73 |
+
$column = (string) esc_sql( $column );
|
74 |
+
$table = (string) esc_sql( $table );
|
75 |
+
$pk = $wpdb->get_results( 'SHOW KEYS FROM `' . $table . "` WHERE Key_name = 'PRIMARY'" );
|
76 |
if ( empty( $pk[0] ) ) {
|
77 |
+
$pk = $wpdb->get_results( 'SHOW KEYS FROM `' . $table . '`' );
|
78 |
if ( empty( $pk[0] ) ) {
|
79 |
+
// Fail.
|
80 |
return;
|
81 |
}
|
82 |
}
|
|
|
83 |
$primary_key_column = $pk[0]->Column_name;
|
84 |
|
85 |
+
// Get all serialized rows.
|
86 |
+
$rows = $wpdb->get_results( "SELECT $primary_key_column, {$column} FROM {$table} WHERE {$column} LIKE 'a:%' OR {$column} LIKE 'O:%'" ); //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
87 |
|
88 |
foreach ( $rows as $row ) {
|
|
|
89 |
if ( ! $this->has_data_to_update( $row->{$column} ) ) {
|
90 |
continue;
|
91 |
}
|
92 |
|
93 |
+
//phpcs:disable
|
94 |
$clean = $this->replace_tree( @unserialize( $row->{$column} ) );
|
95 |
$clean = @serialize( $clean );
|
96 |
+
//phpcs:enable
|
97 |
|
98 |
+
$wpdb->query( $wpdb->prepare( "UPDATE {$table} SET {$column}=%s WHERE {$primary_key_column}=%s", $clean, $row->{$primary_key_column} ) ); //phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
|
|
|
99 |
}
|
100 |
}
|
101 |
|
103 |
/**
|
104 |
* Replaces all the occurrences of a string in a multi-dimensional array or Object
|
105 |
*
|
106 |
+
* @param iterable|string $data - Data to change.
|
107 |
*
|
108 |
+
* @uses itself to call each level of the array
|
109 |
*
|
110 |
* @since 5.2.0
|
111 |
*
|
139 |
* Also replace occurrences of an old url formatted using
|
140 |
* all available updaters
|
141 |
*
|
142 |
+
* @param string $mysql_value - Original value from the database.
|
143 |
*
|
144 |
* @return string
|
145 |
*/
|
146 |
+
protected function replace( $mysql_value ) {
|
147 |
+
foreach ( Repo::instance()->get_updaters() as $_updater ) {
|
148 |
+
$mysql_value = str_replace( $_updater::apply_rule_to_url( $this->old ), $_updater::apply_rule_to_url( $this->new ), $mysql_value );
|
|
|
149 |
}
|
150 |
|
151 |
+
return trim( str_replace( $this->old, $this->new, $mysql_value ) );
|
152 |
}
|
153 |
|
154 |
|
157 |
* Check first for serialized data,
|
158 |
* Then check for occurrences of any urls formatted by an updater
|
159 |
*
|
160 |
+
* @param string $mysql_value - Original value from the database.
|
161 |
*
|
162 |
* @return bool
|
163 |
*/
|
164 |
+
protected function has_data_to_update( $mysql_value ) {
|
165 |
+
if ( ! is_serialized( $mysql_value ) ) {
|
166 |
return false;
|
167 |
}
|
168 |
|
169 |
+
if ( strpos( $mysql_value, $this->old ) !== false ) {
|
170 |
return true;
|
171 |
}
|
172 |
|
173 |
+
foreach ( Repo::instance()->get_updaters() as $_updater ) {
|
174 |
+
if ( strpos( $mysql_value, $_updater::apply_rule_to_url( $this->old ) ) !== false ) {
|
175 |
return true;
|
176 |
}
|
177 |
}
|
179 |
return false;
|
180 |
}
|
181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
}
|
src/Traits/Singleton.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Go_Live_Update_Urls\Traits;
|
4 |
+
|
5 |
+
trait Singleton {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Actions and filters which are called during `init`.
|
9 |
+
*/
|
10 |
+
protected function hook() {
|
11 |
+
}
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Instance of this class for use as singleton
|
15 |
+
*
|
16 |
+
* @var self
|
17 |
+
*/
|
18 |
+
protected static $instance;
|
19 |
+
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Create the instance of the class
|
23 |
+
*
|
24 |
+
* @static
|
25 |
+
* @return void
|
26 |
+
*/
|
27 |
+
public static function init() {
|
28 |
+
static::instance()->hook();
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Get (and instantiate, if necessary) the instance of the
|
34 |
+
* class
|
35 |
+
*
|
36 |
+
* @static
|
37 |
+
* @return self
|
38 |
+
*/
|
39 |
+
public static function instance() {
|
40 |
+
if ( ! is_a( static::$instance, __CLASS__ ) ) {
|
41 |
+
static::$instance = new static();
|
42 |
+
}
|
43 |
+
return static::$instance;
|
44 |
+
}
|
45 |
+
}
|
src/Updaters/Repo.php
CHANGED
@@ -1,57 +1,36 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
3 |
/**
|
4 |
* Repository for the Updater classes.
|
5 |
*
|
6 |
* @author OnPoint Plugins
|
7 |
-
* @since
|
8 |
*
|
9 |
* @package Go_Live_Update_Urls\Updates
|
10 |
*/
|
11 |
-
class
|
|
|
|
|
12 |
/**
|
13 |
* Get all registered updaters by classname
|
14 |
* This list will grow over time as things are converted over
|
15 |
*
|
16 |
* @filter go_live_update_urls_updaters
|
17 |
*
|
18 |
-
* @return
|
19 |
*/
|
20 |
public function get_updaters() {
|
21 |
-
$updaters
|
22 |
-
|
23 |
-
|
24 |
if ( ! is_array( $updaters ) ) {
|
25 |
return [];
|
26 |
}
|
27 |
|
28 |
return $updaters;
|
29 |
}
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
/********** SINGLETON **********/
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Instance of this class for use as singleton
|
37 |
-
*
|
38 |
-
* @var self
|
39 |
-
*/
|
40 |
-
protected static $instance;
|
41 |
-
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Get (and instantiate, if necessary) the instance of the
|
45 |
-
* class
|
46 |
-
*
|
47 |
-
* @static
|
48 |
-
* @return self
|
49 |
-
*/
|
50 |
-
public static function instance() {
|
51 |
-
if ( ! is_a( self::$instance, __CLASS__ ) ) {
|
52 |
-
self::$instance = new self();
|
53 |
-
}
|
54 |
-
|
55 |
-
return self::$instance;
|
56 |
-
}
|
57 |
}
|
1 |
<?php
|
2 |
|
3 |
+
namespace Go_Live_Update_Urls\Updaters;
|
4 |
+
|
5 |
+
use Go_Live_Update_Urls\Traits\Singleton;
|
6 |
+
|
7 |
/**
|
8 |
* Repository for the Updater classes.
|
9 |
*
|
10 |
* @author OnPoint Plugins
|
11 |
+
* @since 6.0.0
|
12 |
*
|
13 |
* @package Go_Live_Update_Urls\Updates
|
14 |
*/
|
15 |
+
class Repo {
|
16 |
+
use Singleton;
|
17 |
+
|
18 |
/**
|
19 |
* Get all registered updaters by classname
|
20 |
* This list will grow over time as things are converted over
|
21 |
*
|
22 |
* @filter go_live_update_urls_updaters
|
23 |
*
|
24 |
+
* @return Updaters_Abstract[]
|
25 |
*/
|
26 |
public function get_updaters() {
|
27 |
+
$updaters = apply_filters( 'go-live-update-urls/updaters/repo/updaters', [
|
28 |
+
'url-encoded' => Url_Encoded::class,
|
29 |
+
] );
|
30 |
if ( ! is_array( $updaters ) ) {
|
31 |
return [];
|
32 |
}
|
33 |
|
34 |
return $updaters;
|
35 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
src/Updaters/Updaters_Abstract.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Go_Live_Update_Urls\Updaters;
|
4 |
+
|
5 |
+
use Go_Live_Update_Urls\Database;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Base Abstract for any URL updating classes.
|
9 |
+
*
|
10 |
+
* @author OnPoint Plugins
|
11 |
+
* @since 6.0.0
|
12 |
+
*/
|
13 |
+
abstract class Updaters_Abstract {
|
14 |
+
/**
|
15 |
+
* The database table.
|
16 |
+
*
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
protected $table;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* The database column.
|
23 |
+
*
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
+
protected $column;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* The old URL.
|
30 |
+
*
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
protected $old;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The new URL.
|
37 |
+
*
|
38 |
+
* @var string
|
39 |
+
*/
|
40 |
+
protected $new;
|
41 |
+
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Updaters Constructor
|
45 |
+
*
|
46 |
+
* @param string $table Table to update.
|
47 |
+
* @param string $column Column to update.
|
48 |
+
* @param string $old_url Old URL.
|
49 |
+
* @param string $new_url New URL.
|
50 |
+
*/
|
51 |
+
public function __construct( $table, $column, $old_url, $new_url ) {
|
52 |
+
$this->table = $table;
|
53 |
+
$this->column = $column;
|
54 |
+
$this->old = $old_url;
|
55 |
+
$this->new = $new_url;
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
/**
|
60 |
+
* The method which is called to actually run the update
|
61 |
+
* using this updater.
|
62 |
+
*
|
63 |
+
* @return bool
|
64 |
+
*/
|
65 |
+
abstract public function update_data();
|
66 |
+
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Update this table and column.
|
70 |
+
*
|
71 |
+
* @param string $old_url Old URL.
|
72 |
+
* @param string $new_url New URL.
|
73 |
+
*
|
74 |
+
* @return void
|
75 |
+
*/
|
76 |
+
protected function update_column( $old_url, $new_url ) {
|
77 |
+
Database::instance()->update_column( $this->table, $this->column, $old_url, $new_url );
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
//phpcs:disable
|
82 |
+
/**
|
83 |
+
* Filter the new or old url based on this particular updater's logic.
|
84 |
+
*
|
85 |
+
* @param string $url - Either the old or new URL.
|
86 |
+
*
|
87 |
+
* @return string
|
88 |
+
*/
|
89 |
+
public static function apply_rule_to_url( $url ) {
|
90 |
+
throw new \RuntimeException( __( 'You must implement apply_rule_to_url with an override' ) );
|
91 |
+
}
|
92 |
+
//phpcs:enable
|
93 |
+
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Factory to get constructed class
|
97 |
+
*
|
98 |
+
* @param string $table Table to update.
|
99 |
+
* @param string $column Column to update.
|
100 |
+
* @param string $old_url Old URL.
|
101 |
+
* @param string $new_url New URL.
|
102 |
+
*
|
103 |
+
* @since 5.3.0
|
104 |
+
*
|
105 |
+
* @return static
|
106 |
+
*/
|
107 |
+
public static function factory( $table, $column, $old_url, $new_url ) {
|
108 |
+
return new static( $table, $column, $old_url, $new_url );
|
109 |
+
}
|
110 |
+
}
|
src/Updaters/Url_Encoded.php
CHANGED
@@ -1,29 +1,45 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
3 |
/**
|
4 |
-
*
|
5 |
*
|
6 |
-
*
|
7 |
-
*
|
|
|
8 |
*
|
|
|
|
|
9 |
*/
|
10 |
-
class
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
return rawurlencode( $url );
|
14 |
}
|
15 |
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
public function update_data() {
|
18 |
-
$old =
|
19 |
if ( $old === $this->old ) {
|
20 |
return false;
|
21 |
}
|
22 |
|
23 |
-
$this->update_column( $old,
|
24 |
|
25 |
return true;
|
26 |
}
|
27 |
|
28 |
-
|
29 |
}
|
1 |
<?php
|
2 |
|
3 |
+
namespace Go_Live_Update_Urls\Updaters;
|
4 |
+
|
5 |
/**
|
6 |
+
* URL Encoded
|
7 |
*
|
8 |
+
* Url encoded URLs have special characters in place of typically entered
|
9 |
+
* characters. This replaces standard characters with their encoded versions
|
10 |
+
* during updating.
|
11 |
*
|
12 |
+
* @author OnPoint Plugins
|
13 |
+
* @since 6.0.0
|
14 |
*/
|
15 |
+
class Url_Encoded extends Updaters_Abstract {
|
16 |
+
/**
|
17 |
+
* Encode the URL for search and replace.
|
18 |
+
*
|
19 |
+
* @param string $url - Provided URL.
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public static function apply_rule_to_url( $url ) {
|
24 |
return rawurlencode( $url );
|
25 |
}
|
26 |
|
27 |
|
28 |
+
/**
|
29 |
+
* Update the old encoded URL with the new encoded URL if the entered
|
30 |
+
* old URL is different than the encoded version.
|
31 |
+
*
|
32 |
+
* @return bool
|
33 |
+
*/
|
34 |
public function update_data() {
|
35 |
+
$old = self::apply_rule_to_url( $this->old );
|
36 |
if ( $old === $this->old ) {
|
37 |
return false;
|
38 |
}
|
39 |
|
40 |
+
$this->update_column( $old, self::apply_rule_to_url( $this->new ) );
|
41 |
|
42 |
return true;
|
43 |
}
|
44 |
|
|
|
45 |
}
|