Version Description
- Add option to keep active theme, thanks to Ulrich Pogson
- Adhere to WordPress PHP coding syntax standards
- Delete the user session and recreate it
- Separate the backup_tables method into two new methods
- Reset only WP tales and not custom tables
- French language updates, thanks to Fx Benard
- Fix for undefined variable: backup_tables
Download this release
Release Info
Developer | mousesports |
Plugin | WordPress Database Reset |
Version | 2.3.2 |
Comparing to | |
See all releases |
Code changes from version 2.3.1 to 2.3.2
- css/wp-reset.css +1 -1
- languages/wp-reset-fr_FR.mo +0 -0
- languages/wp-reset-fr_FR.po +186 -46
- languages/wp-reset.pot +172 -0
- readme.txt +82 -73
- wp-reset.php +442 -400
css/wp-reset.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
#select-buttons {
|
2 |
-
width:
|
3 |
}
|
4 |
|
5 |
#select-all {
|
1 |
#select-buttons {
|
2 |
+
width: 270px;
|
3 |
}
|
4 |
|
5 |
#select-all {
|
languages/wp-reset-fr_FR.mo
CHANGED
Binary file
|
languages/wp-reset-fr_FR.po
CHANGED
@@ -1,82 +1,222 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date:
|
6 |
-
"PO-Revision-Date:
|
7 |
-
"Last-Translator:
|
8 |
"Language-Team: Chris Berthe <chrisberthe@gmail.com>\n"
|
|
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
13 |
"X-Poedit-Basepath: ../\n"
|
14 |
-
"X-
|
15 |
-
"X-Poedit-Country: FRANCE\n"
|
16 |
"X-Poedit-SearchPath-0: .\n"
|
17 |
|
18 |
-
#: wp-reset.php:
|
19 |
msgid "You entered the wrong value - please try again"
|
20 |
-
msgstr "
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
#: wp-reset.php:
|
23 |
msgid "The WordPress database has been reset successfully"
|
24 |
-
msgstr "La base de données WordPress a été réinitialisé avec succès"
|
25 |
|
26 |
-
#: wp-reset.php:
|
27 |
msgid "Database Reset"
|
28 |
-
msgstr "Réinitialisation base de données"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
#: wp-reset.php:
|
31 |
-
msgid "
|
32 |
-
msgstr "
|
33 |
|
34 |
-
#: wp-reset.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
msgid "Reset Database"
|
36 |
msgstr "Réinitialiser"
|
37 |
|
38 |
-
#: wp-reset.php:
|
39 |
msgid "Reactivate current plugins after reset?"
|
40 |
-
msgstr "Réactiver les
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
#: wp-reset.php:
|
43 |
-
|
44 |
-
|
45 |
-
msgstr "L'utilisateur <strong><u>admin</u></strong> par défaut n'a jamais été créé pour cette installation de WordPress. Alors <strong><u>%s</u></strong> sera plutôt recréé avec son mot de passe actuel."
|
46 |
|
47 |
-
#: wp-reset.php:
|
48 |
-
msgid "
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
#: wp-reset.php:
|
52 |
-
msgid "
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
-
#: wp-reset.php:
|
56 |
-
msgid "
|
57 |
-
msgstr "
|
58 |
|
59 |
-
#: wp-reset.php:
|
60 |
-
msgid "
|
61 |
-
msgstr "
|
62 |
|
63 |
-
#: wp-reset.php:
|
64 |
-
msgid "
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
|
67 |
-
#: wp-reset.php:
|
68 |
-
msgid "
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
-
#: wp-reset.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
msgid "WordPress Database Reset"
|
73 |
msgstr "Réinitialisation base de données"
|
74 |
|
75 |
-
#: wp-reset.php:
|
76 |
-
msgid "
|
77 |
-
|
|
|
|
|
|
|
|
|
78 |
|
79 |
-
#: wp-reset.php:
|
80 |
msgid "Password: The password you chose during the install."
|
81 |
-
msgstr "
|
|
|
|
|
|
|
|
|
|
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-reset\n"
|
5 |
+
"POT-Creation-Date: 2014-01-29 14:58:47+00:00\n"
|
6 |
+
"PO-Revision-Date: 2014-01-29 18:47+0100\n"
|
7 |
+
"Last-Translator: fxbenard | FxB <fx@fxbenard.com>\n"
|
8 |
"Language-Team: Chris Berthe <chrisberthe@gmail.com>\n"
|
9 |
+
"Language: fr_FR\n"
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
13 |
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
14 |
"X-Poedit-Basepath: ../\n"
|
15 |
+
"X-Generator: Poedit 1.6.3\n"
|
|
|
16 |
"X-Poedit-SearchPath-0: .\n"
|
17 |
|
18 |
+
#: wp-reset.php:132
|
19 |
msgid "You entered the wrong value - please try again"
|
20 |
+
msgstr ""
|
21 |
+
"Vous avez entré une valeur incorrecte - s'il vous plaît essayez à nouveau."
|
22 |
+
|
23 |
+
#: wp-reset.php:134
|
24 |
+
msgid "You did not select any database tables"
|
25 |
+
msgstr "Vous n’avez sélectionné aucune table"
|
26 |
|
27 |
+
#: wp-reset.php:136
|
28 |
msgid "The WordPress database has been reset successfully"
|
29 |
+
msgstr "La base de données WordPress a été réinitialisé avec succès."
|
30 |
|
31 |
+
#: wp-reset.php:141
|
32 |
msgid "Database Reset"
|
33 |
+
msgstr "Réinitialisation de la base de données"
|
34 |
+
|
35 |
+
#: wp-reset.php:143
|
36 |
+
msgid ""
|
37 |
+
"Please choose from the following database tables the ones you would like to "
|
38 |
+
"reset"
|
39 |
+
msgstr ""
|
40 |
+
"Veuillez choisir parmi les tables de la base de données suivantes celles que "
|
41 |
+
"vous souhaitez réinitialiser"
|
42 |
|
43 |
+
#: wp-reset.php:145
|
44 |
+
msgid "Select All"
|
45 |
+
msgstr "Tout sélectionner"
|
46 |
|
47 |
+
#: wp-reset.php:152
|
48 |
+
msgid "Type in (or copy/paste) the generated value into the text box"
|
49 |
+
msgstr ""
|
50 |
+
"Veuillez entrer (ou copier / coller) la valeur générée dans la zone de "
|
51 |
+
"texte "
|
52 |
+
|
53 |
+
#: wp-reset.php:156
|
54 |
msgid "Reset Database"
|
55 |
msgstr "Réinitialiser"
|
56 |
|
57 |
+
#: wp-reset.php:162
|
58 |
msgid "Reactivate current plugins after reset?"
|
59 |
+
msgstr "Réactiver les extensions actuelles après la réinitialisation ?"
|
60 |
+
|
61 |
+
#: wp-reset.php:169
|
62 |
+
msgid ""
|
63 |
+
"The default user <strong><u>admin</u></strong> was never created for this "
|
64 |
+
"WordPress install. So <strong><u>%s</u></strong> will be recreated with its "
|
65 |
+
"current password instead"
|
66 |
+
msgstr ""
|
67 |
+
"L'utilisateur par défaut<strong><u>admin</u></strong> n'a jamais été créé "
|
68 |
+
"dans cette installation de WordPress. Donc <strong><u>%s</u></strong> sera "
|
69 |
+
"recréé avec son mot de passe actuel"
|
70 |
+
|
71 |
+
#: wp-reset.php:171
|
72 |
+
msgid ""
|
73 |
+
"The default user <strong><u>admin</u></strong> will be recreated with its "
|
74 |
+
"current password upon resetting"
|
75 |
+
msgstr ""
|
76 |
+
"L'utilisateur <strong><u>admin</u></strong> par défaut sera recréé avec son "
|
77 |
+
"mot de passe actuel après la réinitialisation."
|
78 |
+
|
79 |
+
#: wp-reset.php:174
|
80 |
+
msgid ""
|
81 |
+
"Note that once you reset the database, all users will be deleted except the "
|
82 |
+
"initial admin user."
|
83 |
+
msgstr ""
|
84 |
+
"Notez qu'une fois la base de données réinitialisée, tous les utilisateurs "
|
85 |
+
"seront supprimées à l'exception de l'utilisateur par défaut admin."
|
86 |
+
|
87 |
+
#: wp-reset.php:192
|
88 |
+
msgid "Select Table"
|
89 |
+
msgstr "Sélectionner Tables"
|
90 |
+
|
91 |
+
#: wp-reset.php:202
|
92 |
+
msgid ""
|
93 |
+
"Clicking OK will result in your database being reset to its initial "
|
94 |
+
"settings. Continue?"
|
95 |
+
msgstr ""
|
96 |
+
"Si vous cliquez sur OK, votre base de données sera supprimé. Continuer?"
|
97 |
|
98 |
+
#: wp-reset.php:256
|
99 |
+
msgid "Overview"
|
100 |
+
msgstr "Vue d'ensemble"
|
|
|
101 |
|
102 |
+
#: wp-reset.php:258
|
103 |
+
msgid ""
|
104 |
+
"This plugin allows you to securely and easily reinitialize the WordPress "
|
105 |
+
"database back to its default settings without actually having to reinstall "
|
106 |
+
"WordPress from scratch. This plugin will come in handy for both theme and "
|
107 |
+
"plugin developers. Two possible use case scenarios would be to:"
|
108 |
+
msgstr ""
|
109 |
+
"Cette extension vous permet en toute sécurité et facilement de réinitialiser "
|
110 |
+
"la base de données de WordPress à ses paramètres par défaut sans avoir à "
|
111 |
+
"réinstaller WordPress à partir de zéro. Cette extension sera utile pour les "
|
112 |
+
"développeurs de thèmes et d'extensions. Deux façons de l'utiliser :"
|
113 |
|
114 |
+
#: wp-reset.php:259
|
115 |
+
msgid ""
|
116 |
+
"<strong>1.</strong> Erase excess junk in the <code>wp_options</code> table "
|
117 |
+
"that accumulates over time.<br /><strong>2.</strong> Revert back to a fresh "
|
118 |
+
"install of the WordPress database after experimenting with various back-end "
|
119 |
+
"options."
|
120 |
+
msgstr ""
|
121 |
+
"<strong>1.</strong> Effacer les excès de junk dans la table "
|
122 |
+
"<code>wp_options</code> qui s'accumule au fil du temps < br/> <strong>2.</"
|
123 |
+
"strong> Revenir à une nouvelle installation de la base de données WordPress "
|
124 |
+
"après avoir essayé différentes options."
|
125 |
|
126 |
+
#: wp-reset.php:263
|
127 |
+
msgid "Instructions"
|
128 |
+
msgstr "Instructions"
|
129 |
|
130 |
+
#: wp-reset.php:265
|
131 |
+
msgid "Performing a database reset is quite straightforward."
|
132 |
+
msgstr "Exécuter une réinitialisation de la base de données est assez simple."
|
133 |
|
134 |
+
#: wp-reset.php:266
|
135 |
+
msgid ""
|
136 |
+
"Select the different tables you would like to reinitialize from the drop "
|
137 |
+
"down list. You can select any number of tables. If you know you would like "
|
138 |
+
"to reset the entire database, simply click the <code>Select All</code> "
|
139 |
+
"button."
|
140 |
+
msgstr ""
|
141 |
+
"Sélectionnez les différentes tables que vous souhaitez réinitialiser dans la "
|
142 |
+
"liste déroulante. Vous pouvez sélectionner autant de tables que vous voulez. "
|
143 |
+
"Si vous savez que vous souhaitez réinitialiser toute la base de données, "
|
144 |
+
"cliquez simplement sur le bouton <code>Tout sélectionner</code>."
|
145 |
|
146 |
+
#: wp-reset.php:267
|
147 |
+
msgid ""
|
148 |
+
"Next you will have to enter the <code>auto generated value</code> into the "
|
149 |
+
"text box. Clicking on the <code>Reset Database</code> button will result in "
|
150 |
+
"a pop-up."
|
151 |
+
msgstr ""
|
152 |
+
"Ensuite, vous devrez entrer la <code>valeur auto générée</code> dans la zone "
|
153 |
+
"de texte. En cliquant sur le bouton <code>Réinitialiser la base de données</"
|
154 |
+
"code> se traduira par un pop-up."
|
155 |
+
|
156 |
+
#: wp-reset.php:268
|
157 |
+
msgid ""
|
158 |
+
"Once you are sure you would like to proceed, click <code>OK</code> to reset."
|
159 |
+
msgstr ""
|
160 |
+
"Lorsque vous êtes sûr de vouloir continuer, cliquez sur <code>OK</code> pour "
|
161 |
+
"lancer la réinitilisation."
|
162 |
|
163 |
+
#: wp-reset.php:272
|
164 |
+
msgid "Contact information:"
|
165 |
+
msgstr "Information de contact :"
|
166 |
+
|
167 |
+
#: wp-reset.php:273
|
168 |
+
msgid ""
|
169 |
+
"Any ideas on features or ways to improve this plugin? Contact me at <a href="
|
170 |
+
"\"http://github.com/chrisberthe/\" target=\"_blank\">GitHub</a> or <a href="
|
171 |
+
"\"http://twitter.com/chrisberthe/\" target=\"_blank\">Twitter</a>."
|
172 |
+
msgstr ""
|
173 |
+
"Avez-vous des idées pour améliorer cette extension ? Contactez moi <a href="
|
174 |
+
"\"http://github.com/chrisberthe/\" target=\"_blank\">GitHub</a> ou <a href="
|
175 |
+
"\"http://twitter.com/chrisberthe/\" target=\"_blank\">Twitter</a>."
|
176 |
+
|
177 |
+
#. Plugin Name of the plugin/theme
|
178 |
+
#: wp-reset.php:334
|
179 |
msgid "WordPress Database Reset"
|
180 |
msgstr "Réinitialisation base de données"
|
181 |
|
182 |
+
#: wp-reset.php:335
|
183 |
+
msgid ""
|
184 |
+
"The tables you selected have been successfully reset to their default "
|
185 |
+
"settings:"
|
186 |
+
msgstr ""
|
187 |
+
"Les tables sélectionnées ont été réinitialisé à leurs valeurs par défaut "
|
188 |
+
"avec succès :"
|
189 |
|
190 |
+
#: wp-reset.php:336
|
191 |
msgid "Password: The password you chose during the install."
|
192 |
+
msgstr ""
|
193 |
+
"Mot de passe : Le mot de passe que vous avez choisi lors de l'installation."
|
194 |
+
|
195 |
+
#. Plugin URI of the plugin/theme
|
196 |
+
msgid "https://github.com/chrisberthe/wordpress-database-reset"
|
197 |
+
msgstr "https://github.com/chrisberthe/wordpress-database-reset"
|
198 |
|
199 |
+
#. Description of the plugin/theme
|
200 |
+
msgid ""
|
201 |
+
"A plugin that allows you to reset the database to WordPress's initial state."
|
202 |
+
msgstr ""
|
203 |
+
"Une extension qui vous permet de réinitialiser la base de données de "
|
204 |
+
"WordPress à son état initial."
|
205 |
+
|
206 |
+
#. Author of the plugin/theme
|
207 |
+
msgid "Chris Berthe ☻"
|
208 |
+
msgstr "Chris Berthe ☻"
|
209 |
+
|
210 |
+
#. Author URI of the plugin/theme
|
211 |
+
msgid "https://github.com/chrisberthe"
|
212 |
+
msgstr "https://github.com/chrisberthe"
|
213 |
+
|
214 |
+
#~ msgid ""
|
215 |
+
#~ "If this plugin becomes non-functional in any way due to WordPress "
|
216 |
+
#~ "upgrades, rest assured I will update it."
|
217 |
+
#~ msgstr ""
|
218 |
+
#~ "Si ce plugin ne marche plus à cause de mises à jour WordPress, rassurez-"
|
219 |
+
#~ "vous que je vais le mettre à jour dès que possible."
|
220 |
+
|
221 |
+
#~ msgid "Goodbye for now."
|
222 |
+
#~ msgstr "À bientôt."
|
languages/wp-reset.pot
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2014 WordPress Database Reset
|
2 |
+
# This file is distributed under the same license as the WordPress Database Reset package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: WordPress Database Reset 2.3.1\n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/wp-reset\n"
|
7 |
+
"POT-Creation-Date: 2014-01-29 14:58:47+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
|
15 |
+
#: wp-reset.php:132
|
16 |
+
msgid "You entered the wrong value - please try again"
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: wp-reset.php:134
|
20 |
+
msgid "You did not select any database tables"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: wp-reset.php:136
|
24 |
+
msgid "The WordPress database has been reset successfully"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: wp-reset.php:141
|
28 |
+
msgid "Database Reset"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: wp-reset.php:143
|
32 |
+
msgid ""
|
33 |
+
"Please choose from the following database tables the ones you would like to "
|
34 |
+
"reset"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: wp-reset.php:145
|
38 |
+
msgid "Select All"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#: wp-reset.php:152
|
42 |
+
msgid "Type in (or copy/paste) the generated value into the text box"
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: wp-reset.php:156
|
46 |
+
msgid "Reset Database"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: wp-reset.php:162
|
50 |
+
msgid "Reactivate current plugins after reset?"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: wp-reset.php:169
|
54 |
+
msgid ""
|
55 |
+
"The default user <strong><u>admin</u></strong> was never created for this "
|
56 |
+
"WordPress install. So <strong><u>%s</u></strong> will be recreated with its "
|
57 |
+
"current password instead"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: wp-reset.php:171
|
61 |
+
msgid ""
|
62 |
+
"The default user <strong><u>admin</u></strong> will be recreated with its "
|
63 |
+
"current password upon resetting"
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#: wp-reset.php:174
|
67 |
+
msgid ""
|
68 |
+
"Note that once you reset the database, all users will be deleted except the "
|
69 |
+
"initial admin user."
|
70 |
+
msgstr ""
|
71 |
+
|
72 |
+
#: wp-reset.php:192
|
73 |
+
msgid "Select Table"
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
#: wp-reset.php:202
|
77 |
+
msgid ""
|
78 |
+
"Clicking OK will result in your database being reset to its initial "
|
79 |
+
"settings. Continue?"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: wp-reset.php:256
|
83 |
+
msgid "Overview"
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#: wp-reset.php:258
|
87 |
+
msgid ""
|
88 |
+
"This plugin allows you to securely and easily reinitialize the WordPress "
|
89 |
+
"database back to its default settings without actually having to reinstall "
|
90 |
+
"WordPress from scratch. This plugin will come in handy for both theme and "
|
91 |
+
"plugin developers. Two possible use case scenarios would be to:"
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
#: wp-reset.php:259
|
95 |
+
msgid ""
|
96 |
+
"<strong>1.</strong> Erase excess junk in the <code>wp_options</code> table "
|
97 |
+
"that accumulates over time.<br /><strong>2.</strong> Revert back to a fresh "
|
98 |
+
"install of the WordPress database after experimenting with various back-end "
|
99 |
+
"options."
|
100 |
+
msgstr ""
|
101 |
+
|
102 |
+
#: wp-reset.php:263
|
103 |
+
msgid "Instructions"
|
104 |
+
msgstr ""
|
105 |
+
|
106 |
+
#: wp-reset.php:265
|
107 |
+
msgid "Performing a database reset is quite straightforward."
|
108 |
+
msgstr ""
|
109 |
+
|
110 |
+
#: wp-reset.php:266
|
111 |
+
msgid ""
|
112 |
+
"Select the different tables you would like to reinitialize from the drop "
|
113 |
+
"down list. You can select any number of tables. If you know you would like "
|
114 |
+
"to reset the entire database, simply click the <code>Select All</code> "
|
115 |
+
"button."
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#: wp-reset.php:267
|
119 |
+
msgid ""
|
120 |
+
"Next you will have to enter the <code>auto generated value</code> into the "
|
121 |
+
"text box. Clicking on the <code>Reset Database</code> button will result in "
|
122 |
+
"a pop-up."
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: wp-reset.php:268
|
126 |
+
msgid ""
|
127 |
+
"Once you are sure you would like to proceed, click <code>OK</code> to reset."
|
128 |
+
msgstr ""
|
129 |
+
|
130 |
+
#: wp-reset.php:272
|
131 |
+
msgid "Contact information:"
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: wp-reset.php:273
|
135 |
+
msgid ""
|
136 |
+
"Any ideas on features or ways to improve this plugin? Contact me at <a href="
|
137 |
+
"\"http://github.com/chrisberthe/\" target=\"_blank\">GitHub</a> or <a href="
|
138 |
+
"\"http://twitter.com/chrisberthe/\" target=\"_blank\">Twitter</a>."
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#. #-#-#-#-# wp-reset.pot (WordPress Database Reset 2.3.1) #-#-#-#-#
|
142 |
+
#. Plugin Name of the plugin/theme
|
143 |
+
#: wp-reset.php:334
|
144 |
+
msgid "WordPress Database Reset"
|
145 |
+
msgstr ""
|
146 |
+
|
147 |
+
#: wp-reset.php:335
|
148 |
+
msgid ""
|
149 |
+
"The tables you selected have been successfully reset to their default "
|
150 |
+
"settings:"
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: wp-reset.php:336
|
154 |
+
msgid "Password: The password you chose during the install."
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#. Plugin URI of the plugin/theme
|
158 |
+
msgid "https://github.com/chrisberthe/wordpress-database-reset"
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#. Description of the plugin/theme
|
162 |
+
msgid ""
|
163 |
+
"A plugin that allows you to reset the database to WordPress's initial state."
|
164 |
+
msgstr ""
|
165 |
+
|
166 |
+
#. Author of the plugin/theme
|
167 |
+
msgid "Chris Berthe ☻"
|
168 |
+
msgstr ""
|
169 |
+
|
170 |
+
#. Author URI of the plugin/theme
|
171 |
+
msgid "https://github.com/chrisberthe"
|
172 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -1,74 +1,83 @@
|
|
1 |
-
=== WordPress Database Reset ===
|
2 |
-
|
3 |
-
Contributors: mousesports
|
4 |
-
Tags: wordpress, database, database-reset, restore, setup, development, default-settings, default, wp-reset, security, secure
|
5 |
-
License: GPL2
|
6 |
-
Requires at least: 3.0
|
7 |
-
Tested up to:
|
8 |
-
Stable tag: 2.3.
|
9 |
-
|
10 |
-
A simple way to reset the database to the state of WordPress right after you install it for the first time.
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
|
14 |
-
WordPress Database Reset allows for a secure and easy way to reinitialize the database back to its default settings without having to reinstall WordPress yourself.
|
15 |
-
|
16 |
-
This plugin will come in handy for both theme and plugin developers. There are different use case scenarios - one of which is being able to easily erase excess junk in the wp_options table that accumulates over time. Another would be to simply obtain a fresh install of the WordPress database after experimenting with various back-end options.
|
17 |
-
|
18 |
-
== Installation ==
|
19 |
-
|
20 |
-
Copy the wp-reset folder and its contents to your wp-content/plugins directory,
|
21 |
-
then activate the plugin. You could also use the built-in Add New Plugin
|
22 |
-
feature within WordPress. After activating, you will automatically be redirected
|
23 |
-
to the plugin page.
|
24 |
-
|
25 |
-
== Screenshots ==
|
26 |
-
1. The plugin page - a more secure way of resetting your database.
|
27 |
-
|
28 |
-
== Changelog ==
|
29 |
-
= 2.3.
|
30 |
-
*
|
31 |
-
|
32 |
-
|
33 |
-
*
|
34 |
-
*
|
35 |
-
*
|
36 |
-
*
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
*
|
45 |
-
*
|
46 |
-
*
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
*
|
54 |
-
*
|
55 |
-
*
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
*
|
61 |
-
|
62 |
-
|
63 |
-
*
|
64 |
-
*
|
65 |
-
|
66 |
-
= 1.
|
67 |
-
*
|
68 |
-
*
|
69 |
-
*
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
* First version
|
1 |
+
=== WordPress Database Reset ===
|
2 |
+
|
3 |
+
Contributors: mousesports
|
4 |
+
Tags: wordpress, database, database-reset, restore, setup, development, default-settings, default, wp-reset, security, secure
|
5 |
+
License: GPL2
|
6 |
+
Requires at least: 3.0
|
7 |
+
Tested up to: 4.2.2
|
8 |
+
Stable tag: 2.3.2
|
9 |
+
|
10 |
+
A simple way to reset the database to the state of WordPress right after you install it for the first time.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
WordPress Database Reset allows for a secure and easy way to reinitialize the database back to its default settings without having to reinstall WordPress yourself.
|
15 |
+
|
16 |
+
This plugin will come in handy for both theme and plugin developers. There are different use case scenarios - one of which is being able to easily erase excess junk in the wp_options table that accumulates over time. Another would be to simply obtain a fresh install of the WordPress database after experimenting with various back-end options.
|
17 |
+
|
18 |
+
== Installation ==
|
19 |
+
|
20 |
+
Copy the wp-reset folder and its contents to your wp-content/plugins directory,
|
21 |
+
then activate the plugin. You could also use the built-in Add New Plugin
|
22 |
+
feature within WordPress. After activating, you will automatically be redirected
|
23 |
+
to the plugin page.
|
24 |
+
|
25 |
+
== Screenshots ==
|
26 |
+
1. The plugin page - a more secure way of resetting your database.
|
27 |
+
|
28 |
+
== Changelog ==
|
29 |
+
= 2.3.2 =
|
30 |
+
* Add option to keep active theme, thanks to Ulrich Pogson
|
31 |
+
* Adhere to WordPress PHP coding syntax standards
|
32 |
+
* Delete the user session and recreate it
|
33 |
+
* Separate the backup_tables method into two new methods
|
34 |
+
* Reset only WP tales and not custom tables
|
35 |
+
* French language updates, thanks to Fx Benard
|
36 |
+
* Fix for undefined variable: backup_tables
|
37 |
+
|
38 |
+
= 2.3.1 =
|
39 |
+
* Fixed bug where reactivate plugins div was not displaying on 'options' table select
|
40 |
+
|
41 |
+
= 2.3 =
|
42 |
+
* Removed deprecated function $wpdb->escape(), replaced with esc_sql()
|
43 |
+
* Add German translation, thanks to Ulrich Pogson
|
44 |
+
* Updated screenshot-1.png
|
45 |
+
* Renamed default localization file
|
46 |
+
* Fixed broken if conditional during code clean up for version 2.2
|
47 |
+
|
48 |
+
= 2.2 =
|
49 |
+
* Fixed scripts and styles to only load on plugin page
|
50 |
+
* Formatted code to meet WordPress syntax standards
|
51 |
+
|
52 |
+
= 2.1 =
|
53 |
+
* Replaced 3.3 deprecated get_userdatabylogin() with get_user_by()
|
54 |
+
* Updated deprecated add_contextual_help() with add_help_tab()
|
55 |
+
* Small change in condition check for backup tables
|
56 |
+
* Removed custom _rand_string() with core wp_generate_password()
|
57 |
+
* Added Portuguese translation - thanks to Fernando Lopes
|
58 |
+
|
59 |
+
= 2.0 =
|
60 |
+
* Added functionality to be able to select which tables you want to reset, rather than having to reset the entire database.
|
61 |
+
* Added bsmSelect for the multiple select.
|
62 |
+
* Modified screenshot-1.png.
|
63 |
+
* Fixed redirect bug
|
64 |
+
* 'Reactivate current plugins after reset' only shows if the options table is selected from the dropdown.
|
65 |
+
|
66 |
+
= 1.4 =
|
67 |
+
* Made quite a few changes to the translation files
|
68 |
+
* Renamed french translation file for plugin format, not theme format
|
69 |
+
* Optimized (until potential version 2.0)
|
70 |
+
|
71 |
+
= 1.3 =
|
72 |
+
* Replaced reactivation option for all currently active plugins (not just this plugin)
|
73 |
+
* Updated language files
|
74 |
+
|
75 |
+
= 1.2 =
|
76 |
+
* Added capability to manually select whether or not plugin should be reactivated upon reset
|
77 |
+
* Modified class name to avoid potential conflicts with WordPress core
|
78 |
+
* Modified wp_mail override
|
79 |
+
* Removed deprecated user level for WordPress 3.0+
|
80 |
+
* Fixed small bug where if admin user did not have admin capabilities, it would tell the user they did
|
81 |
+
|
82 |
+
= 1.0 =
|
83 |
* First version
|
wp-reset.php
CHANGED
@@ -3,409 +3,451 @@
|
|
3 |
Plugin Name: WordPress Database Reset
|
4 |
Plugin URI: https://github.com/chrisberthe/wordpress-database-reset
|
5 |
Description: A plugin that allows you to reset the database to WordPress's initial state.
|
6 |
-
Version: 2.3.
|
7 |
Author: Chris Berthe ☻
|
8 |
Author URI: https://github.com/chrisberthe
|
9 |
License: GNU General Public License
|
|
|
10 |
*/
|
11 |
|
12 |
-
if ( ! class_exists('CB_WP_Reset') && is_admin() ) :
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
?>
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
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 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
Plugin Name: WordPress Database Reset
|
4 |
Plugin URI: https://github.com/chrisberthe/wordpress-database-reset
|
5 |
Description: A plugin that allows you to reset the database to WordPress's initial state.
|
6 |
+
Version: 2.3.2
|
7 |
Author: Chris Berthe ☻
|
8 |
Author URI: https://github.com/chrisberthe
|
9 |
License: GNU General Public License
|
10 |
+
Text Domain: wp-reset
|
11 |
*/
|
12 |
|
13 |
+
if ( ! class_exists( 'CB_WP_Reset' ) && is_admin() ) :
|
14 |
+
|
15 |
+
class CB_WP_Reset {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Nonce value
|
19 |
+
*/
|
20 |
+
private $_nonce = 'wp-reset-nonce';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Tables to preserve
|
24 |
+
*/
|
25 |
+
private $_tables;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* WordPress database tables
|
29 |
+
*/
|
30 |
+
private $_wp_tables;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Loads default options
|
34 |
+
*
|
35 |
+
* @return void
|
36 |
+
*/
|
37 |
+
function __construct() {
|
38 |
+
add_action( 'init', array( $this, 'init_language' ) );
|
39 |
+
add_action( 'admin_init', array( $this, 'wp_reset_init' ) );
|
40 |
+
add_action( 'admin_init', array( $this, '_redirect_user' ) );
|
41 |
+
add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
|
42 |
+
add_filter( 'wp_mail', array( $this, '_fix_mail' ) );
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Handles the admin page functionality
|
47 |
+
*
|
48 |
+
* @access public
|
49 |
+
* @uses wp_install Located in includes/upgrade.php (line 22)
|
50 |
+
*/
|
51 |
+
function wp_reset_init() {
|
52 |
+
global $wpdb, $current_user, $pagenow;
|
53 |
+
|
54 |
+
// Grab the WordPress database tables
|
55 |
+
$this->_wp_tables = $wpdb->tables();
|
56 |
+
|
57 |
+
// Check for valid input - goes ahead and drops / resets tables
|
58 |
+
if ( isset( $_POST['wp-random-value'], $_POST['wp-reset-input'] ) && $_POST['wp-random-value'] == $_POST['wp-reset-input']
|
59 |
+
&& check_admin_referer( 'wp-nonce-submit', $this->_nonce ) ) {
|
60 |
+
|
61 |
+
require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
|
62 |
+
|
63 |
+
// No tables were selected
|
64 |
+
if ( empty( $_POST['tables'] ) ) {
|
65 |
+
wp_redirect( admin_url( $pagenow ) . '?page=wp-reset&reset=no-select' );
|
66 |
+
exit();
|
67 |
+
}
|
68 |
+
|
69 |
+
// Get current options
|
70 |
+
$blog_title = get_option( 'blogname' );
|
71 |
+
$public = get_option( 'blog_public' );
|
72 |
+
|
73 |
+
$admin_user = get_user_by( 'login', 'admin' );
|
74 |
+
$user = ( ! $admin_user || ! user_can( $admin_user->ID, 'update_core' ) ) ? $current_user : $admin_user;
|
75 |
+
|
76 |
+
// Get the selected tables
|
77 |
+
$tables = ( isset( $_POST['tables'] ) ) ? array_flip( $_POST['tables'] ) : array();
|
78 |
+
|
79 |
+
// Compare the selected tables against the ones in the database
|
80 |
+
$this->_tables = array_diff_key( $this->_wp_tables, $tables );
|
81 |
+
|
82 |
+
// Preserve the data from the tables that are unique
|
83 |
+
if ( 0 < count( $this->_tables ) ) {
|
84 |
+
$backup_tables = $this->_back_up_tables( $this->_tables );
|
85 |
+
}
|
86 |
+
|
87 |
+
// Grab the currently active plugins and theme
|
88 |
+
if ( ! empty($_POST['wp-reset-check']) ) {
|
89 |
+
$current_data = array(
|
90 |
+
'active-plugins' => get_option( 'active_plugins' ),
|
91 |
+
'current-theme' => get_option( 'current_theme' ),
|
92 |
+
'template' => get_option( 'template' ),
|
93 |
+
'stylesheet' => get_option( 'stylesheet' )
|
94 |
+
);
|
95 |
+
}
|
96 |
+
|
97 |
+
// Run through the database columns, drop all the tables and
|
98 |
+
// install wp with previous settings
|
99 |
+
if ( ! empty( $this->_wp_tables ) ) {
|
100 |
+
foreach ( $this->_wp_tables as $wp_table ) {
|
101 |
+
$wpdb->query( "DROP TABLE {$wp_table}" );
|
102 |
+
}
|
103 |
+
$keys = wp_install( $blog_title, $user->user_login, $user->user_email, $public );
|
104 |
+
$this->_wp_update_user( $user, $keys );
|
105 |
+
}
|
106 |
+
|
107 |
+
// Delete and replace tables with the backed up table data
|
108 |
+
if ( ! empty( $backup_tables ) ) {
|
109 |
+
foreach ( $this->_tables as $table ) {
|
110 |
+
$wpdb->query( "DELETE FROM " . $table );
|
111 |
+
}
|
112 |
+
$this->_restore_tables( $backup_tables );
|
113 |
+
}
|
114 |
+
|
115 |
+
if ( get_user_meta( $current_user->ID, 'session_tokens' ) ) {
|
116 |
+
delete_user_meta( $current_user->ID, 'session_tokens' );
|
117 |
+
}
|
118 |
+
|
119 |
+
wp_clear_auth_cookie();
|
120 |
+
wp_set_auth_cookie( $current_user->ID );
|
121 |
+
|
122 |
+
if ( ! empty( $current_data ) ) {
|
123 |
+
update_option( 'active_plugins', $current_data['active-plugins'] );
|
124 |
+
|
125 |
+
if ( ! empty( $current_data['current-theme'] ) ) {
|
126 |
+
update_option( 'current_theme', $current_data['current-theme'] );
|
127 |
+
}
|
128 |
+
|
129 |
+
update_option( 'template', $current_data['template'] );
|
130 |
+
update_option( 'stylesheet', $current_data['stylesheet'] );
|
131 |
+
|
132 |
+
wp_redirect( admin_url( $pagenow ) . '?page=wp-reset&reset=success' );
|
133 |
+
exit();
|
134 |
+
}
|
135 |
+
|
136 |
+
wp_redirect( admin_url() );
|
137 |
+
exit();
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Displays the admin page
|
143 |
+
*
|
144 |
+
* @access public
|
145 |
+
* @return void
|
146 |
+
*/
|
147 |
+
function show_admin_page() {
|
148 |
+
global $current_user;
|
149 |
+
|
150 |
+
// Return to see if admin object exists
|
151 |
+
$admin_user = get_user_by( 'login', 'admin' );
|
152 |
+
$random_string = wp_generate_password( 5, false ); ?>
|
153 |
+
|
154 |
+
<?php if ( isset( $_POST['wp-random-value'], $_POST['wp-reset-input'] ) && $_POST['wp-random-value'] != $_POST['wp-reset-input'] ) : ?>
|
155 |
+
<div class="error"><p><strong><?php _e( 'You entered the wrong value - please try again', 'wp-reset' ) ?>.</strong></p></div>
|
156 |
+
<?php elseif ( isset( $_GET['reset'] ) && 'no-select' == $_GET['reset'] ) : ?>
|
157 |
+
<div class="error"><p><strong><?php _e( 'You did not select any database tables', 'wp-reset' ) ?>.</strong></p></div>
|
158 |
+
<?php elseif ( isset( $_GET['reset'] ) && 'success' == $_GET['reset'] ) : ?>
|
159 |
+
<div class="updated"><p><strong><?php _e( 'The WordPress database has been reset successfully', 'wp-reset' ) ?>.</strong></p></div>
|
160 |
+
<?php endif ?>
|
161 |
+
|
162 |
+
<div class="wrap">
|
163 |
+
<?php screen_icon() ?>
|
164 |
+
<h2><?php _e( 'Database Reset', 'wp-reset' ) ?></h2>
|
165 |
+
<form action="" method="POST" id="wp-reset-form">
|
166 |
+
<p><?php _e( 'Please choose from the following database tables the ones you would like to reset', 'wp-reset' ) ?>:</p>
|
167 |
+
<div id="select-buttons">
|
168 |
+
<span><a href='#' id="select-all"><?php _e( 'Select All', 'wp-reset' ) ?></a></span>
|
169 |
+
<select id="wp-tables" multiple="multiple" name="tables[]">
|
170 |
+
<?php foreach ( $this->_wp_tables as $key => $value ) : ?>
|
171 |
+
<option value="<?php echo $key ?>"><?php echo $key ?></option>
|
172 |
+
<?php endforeach ?>
|
173 |
+
</select>
|
174 |
+
</div>
|
175 |
+
<p><?php _e( 'Type in (or copy/paste) the generated value into the text box', 'wp-reset' ) ?>: <strong><?php echo $random_string ?></strong></p>
|
176 |
+
<?php wp_nonce_field( 'wp-nonce-submit', $this->_nonce ) ?>
|
177 |
+
<input type="hidden" name="wp-random-value" value="<?php echo $random_string ?>" id="wp-random-value" />
|
178 |
+
<input type="text" name="wp-reset-input" value="" id="wp-reset-input" />
|
179 |
+
<input type="submit" name="wp-reset-submit" value="<?php _e( 'Reset Database', 'wp-reset' ) ?>" id="wp-reset-submit" class="button-primary" />
|
180 |
+
<img src="<?php echo plugins_url( 'css/i/ajax-loader.gif', __FILE__ ) ?>" alt="loader" id="loader" style="display: none" />
|
181 |
+
<div id="reactivate" style="display: none">
|
182 |
+
<p>
|
183 |
+
<label for="wp-reset-check">
|
184 |
+
<input type="checkbox" name="wp-reset-check" id="wp-reset-check" checked="checked" value="true" />
|
185 |
+
<?php _e( 'Reactivate current plugins and theme after reset?', 'wp-reset' ) ?>
|
186 |
+
</label>
|
187 |
+
</p>
|
188 |
+
</div>
|
189 |
+
</form>
|
190 |
+
|
191 |
+
<?php if ( ! $admin_user || ! user_can( $admin_user->ID, 'update_core' ) ) : ?>
|
192 |
+
<p style="margin-top: 25px"><?php printf( __( 'The default user <strong><u>admin</u></strong> was never created for this WordPress install. So <strong><u>%s</u></strong> will be recreated with its current password instead', 'wp-reset' ), $current_user->user_login ) ?>.</p>
|
193 |
+
<?php else : ?>
|
194 |
+
<p><?php _e( 'The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting', 'wp-reset' ) ?>.</p>
|
195 |
+
<?php endif ?>
|
196 |
+
|
197 |
+
<p><?php _e( 'Note that once you reset the database, all users will be deleted except the initial admin user.', 'wp-reset' ) ?></p>
|
198 |
+
</div>
|
199 |
+
<?php }
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Add JavaScript to the bottom of the plugin page
|
203 |
+
*
|
204 |
+
* @access public
|
205 |
+
* @return bool TRUE on reset confirmation
|
206 |
+
*/
|
207 |
+
function add_admin_javascript() {
|
208 |
?>
|
209 |
+
<script type="text/javascript">
|
210 |
+
/* <![CDATA[ */
|
211 |
+
(function( $ ) {
|
212 |
+
|
213 |
+
$( '#wp-tables' ).bsmSelect({
|
214 |
+
animate: true,
|
215 |
+
title: "<?php _e( 'Select Table', 'wp-reset' ) ?>",
|
216 |
+
plugins: [$.bsmSelect.plugins.compatibility()]
|
217 |
+
});
|
218 |
+
|
219 |
+
$( '#select-all' ).click(function() {
|
220 |
+
$( '#wp-tables' ).children()
|
221 |
+
.attr( 'selected', 'selected' )
|
222 |
+
.end()
|
223 |
+
.change();
|
224 |
+
|
225 |
+
return false;
|
226 |
+
});
|
227 |
+
|
228 |
+
$( '#wp-reset-submit' ).click(function() {
|
229 |
+
var message = "<?php _e( 'Clicking OK will result in your database being reset to its initial settings. Continue?', 'wp-reset' ) ?>",
|
230 |
+
reset = confirm( message );
|
231 |
+
|
232 |
+
if (reset) {
|
233 |
+
$( '#wp-reset-form' ).submit();
|
234 |
+
$( '#loader' ).show();
|
235 |
+
} else {
|
236 |
+
return false;
|
237 |
+
}
|
238 |
+
});
|
239 |
+
|
240 |
+
$( '#wp-tables' ).change(function() {
|
241 |
+
$( '#reactivate' ).toggle( $( "option[value='options']:selected", this ).length > 0 );
|
242 |
+
});
|
243 |
+
|
244 |
+
})( jQuery );
|
245 |
+
/* ]]> */
|
246 |
+
</script>
|
247 |
+
<?php
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Adds our submenu item to the Tools menu
|
252 |
+
*
|
253 |
+
* @access public
|
254 |
+
* @return void
|
255 |
+
*/
|
256 |
+
function add_admin_menu() {
|
257 |
+
if ( current_user_can( 'update_core' ) ) {
|
258 |
+
$this->_hook = add_submenu_page( 'tools.php', 'Database Reset', 'Database Reset', 'update_core', 'wp-reset', array( $this, 'show_admin_page' ) );
|
259 |
+
add_action( 'load-' . $this->_hook, array( $this, 'option_page_actions' ) );
|
260 |
+
}
|
261 |
+
}
|
262 |
+
|
263 |
+
/**
|
264 |
+
* Fires actions on option page load
|
265 |
+
*
|
266 |
+
* @access public
|
267 |
+
* @return void
|
268 |
+
*/
|
269 |
+
function option_page_actions() {
|
270 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'add_plugin_styles_and_scripts' ) );
|
271 |
+
add_action( 'admin_footer', array( $this, 'add_admin_javascript' ) );
|
272 |
+
$this->_add_help_screen();
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Adds v3.3 style help menu for plugin page
|
277 |
+
*
|
278 |
+
* @access private
|
279 |
+
* @return void
|
280 |
+
*/
|
281 |
+
function _add_help_screen() {
|
282 |
+
get_current_screen()->add_help_tab( array(
|
283 |
+
'id' => 'overview',
|
284 |
+
'title' => __( 'Overview' ),
|
285 |
+
'content' =>
|
286 |
+
'<p>' . __( 'This plugin allows you to securely and easily reinitialize the WordPress database back to its default settings without actually having to reinstall WordPress from scratch. This plugin will come in handy for both theme and plugin developers. Two possible use case scenarios would be to:') . '</p>' .
|
287 |
+
'<p>' . __( '<strong>1.</strong> Erase excess junk in the <code>wp_options</code> table that accumulates over time.<br /><strong>2.</strong> Revert back to a fresh install of the WordPress database after experimenting with various back-end options.' ) . '</p>'
|
288 |
+
) );
|
289 |
+
get_current_screen()->add_help_tab( array(
|
290 |
+
'id' => 'instructions',
|
291 |
+
'title' => __( 'Instructions' ),
|
292 |
+
'content' =>
|
293 |
+
'<p>' . __( 'Performing a database reset is quite straightforward.' ) . '</p>' .
|
294 |
+
'<p>' . __( 'Select the different tables you would like to reinitialize from the drop down list. You can select any number of tables. If you know you would like to reset the entire database, simply click the <code>Select All</code> button.' ) . '</p>' .
|
295 |
+
'<p>' . __( 'Next you will have to enter the <code>auto generated value</code> into the text box. Clicking on the <code>Reset Database</code> button will result in a pop-up.' ) . '</p>' .
|
296 |
+
'<p>' . __( 'Once you are sure you would like to proceed, click <code>OK</code> to reset.' ) . '</p>'
|
297 |
+
) );
|
298 |
+
|
299 |
+
get_current_screen()->set_help_sidebar(
|
300 |
+
'<p><strong>' . __( 'Contact information:' ) . '</strong></p>' .
|
301 |
+
'<p>' . __( 'Any ideas on features or ways to improve this plugin? Contact me at <a href="http://github.com/chrisberthe/" target="_blank">GitHub</a> or <a href="http://twitter.com/chrisberthe/" target="_blank">Twitter</a>.' ) . '</p>'
|
302 |
+
);
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Adds any plugin styles to our page
|
307 |
+
*
|
308 |
+
* @access public
|
309 |
+
* @return void
|
310 |
+
*/
|
311 |
+
function add_plugin_styles_and_scripts() {
|
312 |
+
wp_enqueue_style( 'wordpress-reset-css', plugins_url( 'css/wp-reset.css', __FILE__ ) );
|
313 |
+
wp_enqueue_style( 'bsmselect-css', plugins_url( 'css/jquery.bsmselect.css', __FILE__ ) );
|
314 |
+
|
315 |
+
wp_enqueue_script( 'bsmselect', plugins_url( 'js/jquery.bsmselect.js', __FILE__ ) );
|
316 |
+
wp_enqueue_script( 'bsmselect-compatibility', plugins_url( 'js/jquery.bsmselect.compatibility.js', __FILE__ ) );
|
317 |
+
}
|
318 |
+
|
319 |
+
/**
|
320 |
+
* Load language path
|
321 |
+
*
|
322 |
+
* @access public
|
323 |
+
* @return void
|
324 |
+
*/
|
325 |
+
function init_language() {
|
326 |
+
$language_dir = basename( dirname( __FILE__ ) ) . '/languages';
|
327 |
+
load_plugin_textdomain( 'wp-reset', false, $language_dir );
|
328 |
+
}
|
329 |
+
|
330 |
+
/**
|
331 |
+
* For activation hook
|
332 |
+
*
|
333 |
+
* @access public
|
334 |
+
* @return void
|
335 |
+
*/
|
336 |
+
function plugin_activate() {
|
337 |
+
add_option( 'wp-reset-activated', true );
|
338 |
+
}
|
339 |
+
|
340 |
+
/**
|
341 |
+
* Redirects the user after the plugin is activated
|
342 |
+
*
|
343 |
+
* @access private
|
344 |
+
* @return void
|
345 |
+
*/
|
346 |
+
function _redirect_user() {
|
347 |
+
if ( get_option( 'wp-reset-activated', false ) ) {
|
348 |
+
delete_option( 'wp-reset-activated' );
|
349 |
+
wp_redirect( admin_url( 'tools.php' ) . '?page=wp-reset' );
|
350 |
+
}
|
351 |
+
}
|
352 |
+
|
353 |
+
/**
|
354 |
+
* Changes the password to a sentence rather than
|
355 |
+
* an auto-generated password that is sent by email
|
356 |
+
* right after the installation is complete
|
357 |
+
*
|
358 |
+
* @access private
|
359 |
+
* @return $mail Version with password changed
|
360 |
+
*/
|
361 |
+
function _fix_mail( $mail ) {
|
362 |
+
$subject = __( 'WordPress Database Reset', 'wp-reset' );
|
363 |
+
$message = __( 'The tables you selected have been successfully reset to their default settings:', 'wp-reset' );
|
364 |
+
$password = __( 'Password: The password you chose during the install.', 'wp-reset' );
|
365 |
+
|
366 |
+
if ( stristr( $mail['message'], 'Your new WordPress site has been successfully set up at:' ) ) {
|
367 |
+
$mail['subject'] = preg_replace( '/New WordPress Site/', $subject, $mail['subject'] );
|
368 |
+
$mail['message'] = preg_replace( '/Your new WordPress site has been successfully set up at:+/', $message, $mail['message'] );
|
369 |
+
$mail['message'] = preg_replace( '/Password:\s.+/', $password, $mail['message'] );
|
370 |
+
}
|
371 |
+
return $mail;
|
372 |
+
}
|
373 |
+
|
374 |
+
/**
|
375 |
+
* Preserves all the results from the tables the user
|
376 |
+
* did not select from the drop-down.
|
377 |
+
*
|
378 |
+
* @access private
|
379 |
+
* @return array Backed up data if type backup
|
380 |
+
*/
|
381 |
+
function _back_up_tables( $tables ) {
|
382 |
+
global $wpdb;
|
383 |
+
|
384 |
+
if ( is_array( $tables ) ) {
|
385 |
+
$backup_tables = array();
|
386 |
+
|
387 |
+
foreach ( $tables as $table ) {
|
388 |
+
$backup_tables[$table] = $wpdb->get_results( "SELECT * FROM " . $table );
|
389 |
+
}
|
390 |
+
|
391 |
+
return $backup_tables;
|
392 |
+
}
|
393 |
+
return;
|
394 |
+
}
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Restores the data from the tables the user did not
|
398 |
+
* select during the backing up phase.
|
399 |
+
*
|
400 |
+
* @access private
|
401 |
+
* @return void
|
402 |
+
*/
|
403 |
+
function _restore_tables( $tables ) {
|
404 |
+
global $wpdb;
|
405 |
+
|
406 |
+
if ( is_array( $tables ) ) {
|
407 |
+
foreach ( $tables as $table_name => $table_data ) {
|
408 |
+
foreach ( $table_data as $row ) {
|
409 |
+
$columns = $values = array();
|
410 |
+
|
411 |
+
foreach ( $row as $column => $value ) {
|
412 |
+
$columns[] = $column;
|
413 |
+
$values[] = esc_sql( $value );
|
414 |
+
}
|
415 |
+
|
416 |
+
$wpdb->query( "INSERT INTO $table_name (" . implode( ', ', $columns ) . ") VALUES ('" . implode( "', '", $values ) . "')" );
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
return;
|
421 |
+
}
|
422 |
+
|
423 |
+
/**
|
424 |
+
* Updates the user password and clears / sets
|
425 |
+
* the authentication cookie for the user
|
426 |
+
*
|
427 |
+
* @access private
|
428 |
+
* @param $user Current or admin user
|
429 |
+
* @param $keys Array returned by wp_install()
|
430 |
+
* @return true on install success, false otherwise
|
431 |
+
*/
|
432 |
+
function _wp_update_user( $user, $keys ) {
|
433 |
+
global $wpdb;
|
434 |
+
extract( $keys, EXTR_SKIP );
|
435 |
+
|
436 |
+
$query = $wpdb->prepare( "UPDATE $wpdb->users SET user_pass = '%s', user_activation_key = '' WHERE ID = '%d'", $user->user_pass, $user_id );
|
437 |
+
|
438 |
+
if ( $wpdb->query( $query ) ) {
|
439 |
+
// Remove password reminder after installing
|
440 |
+
if ( get_user_meta( $user_id, 'default_password_nag' ) ) {
|
441 |
+
delete_user_meta( $user_id, 'default_password_nag' );
|
442 |
+
}
|
443 |
+
|
444 |
+
return true;
|
445 |
+
}
|
446 |
+
return false;
|
447 |
+
}
|
448 |
+
}
|
449 |
+
|
450 |
+
$cb_wp_reset = new CB_WP_Reset();
|
451 |
+
register_activation_hook( __FILE__, array( 'cb_wp_reset', 'plugin_activate' ) );
|
452 |
+
|
453 |
+
endif;
|