WordPress Database Reset - Version 1.3

Version Description

  • Replaced reactivation option for all currently active plugins (not just this plugin)
  • Updated language files
Download this release

Release Info

Developer mousesports
Plugin Icon 128x128 WordPress Database Reset
Version 1.3
Comparing to
See all releases

Code changes from version 1.2.2 to 1.3

languages/default.mo CHANGED
Binary file
languages/default.po CHANGED
@@ -2,60 +2,80 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP Reset\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2011-10-02 17:15-0500\n"
6
- "PO-Revision-Date: 2011-10-02 17:15-0500\n"
7
  "Last-Translator: \n"
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: /Users/chrisberthe/.ssh/wp/wp-content/plugins/wp-reset\n"
14
  "X-Poedit-Language: English\n"
15
  "X-Poedit-SearchPath-0: .\n"
16
 
17
- #: wp-reset.php:106
18
  msgid "You entered the wrong value - please try again"
19
- msgstr "Vous avez entré une valeur incorrecte - s'il vous plaît essayez à nouveau."
20
 
21
- #: wp-reset.php:108
22
  msgid "The WordPress database has been reset successfully"
23
- msgstr "La base de données WordPress a été réinitialisé avec succès"
24
 
25
- #: wp-reset.php:113
26
  msgid "Database Reset"
27
- msgstr "Réinitialisation base de données"
28
 
29
- #: wp-reset.php:119
30
- msgid "Reset Database"
31
- msgstr "Réinitialiser"
32
 
33
  #: wp-reset.php:123
 
 
 
 
 
 
 
 
34
  #, php-format
35
  msgid "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"
36
- 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."
37
 
38
- #: wp-reset.php:125
39
  msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
40
- msgstr "L'utilisateur <strong><u>admin</u></strong> par défaut sera recréé avec son mot de passe actuel après la réinitialisation"
41
 
42
- #: wp-reset.php:128
43
- msgid "Note that once you reset the database, all users will be deleted except the initial admin user. The plugin will also reactivate itself after resetting"
44
- msgstr "Notez qu'une fois la base de données soit réinitialiser, tous les utilisateurs seront supprimées à l'exception de l'utilisateur admin initial. Le plugin sera également réactiver après la réinitialisation"
45
 
46
- #: wp-reset.php:143
47
  msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
48
- msgstr "Si vous cliquez sur OK, votre base de données sera supprimé. Continuer?"
49
 
50
- #: wp-reset.php:183
51
  msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
52
- msgstr "Avez-vous des idées pour ce plugin? "
53
 
54
- #: wp-reset.php:184
55
  msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
56
- msgstr "Si ce plugin ne marche plus à cause de mises à jour WordPress, rassurez-vous que je vais le mettre à jour dès que possible."
57
 
58
- #: wp-reset.php:185
59
  msgid "Goodbye for now."
60
- msgstr "À bientôt."
 
 
 
 
 
 
 
 
 
 
 
 
61
 
2
  msgstr ""
3
  "Project-Id-Version: WP Reset\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-10-11 23:05-0500\n"
6
+ "PO-Revision-Date: 2011-10-11 23:05-0500\n"
7
  "Last-Translator: \n"
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: /Users/chrisberthe/.ssh/wp/wp-content/plugins/wordpress-database-reset\n"
14
  "X-Poedit-Language: English\n"
15
  "X-Poedit-SearchPath-0: .\n"
16
 
17
+ #: wp-reset.php:110
18
  msgid "You entered the wrong value - please try again"
19
+ msgstr ""
20
 
21
+ #: wp-reset.php:112
22
  msgid "The WordPress database has been reset successfully"
23
+ msgstr ""
24
 
25
+ #: wp-reset.php:117
26
  msgid "Database Reset"
27
+ msgstr ""
28
 
29
+ #: wp-reset.php:118
30
+ msgid "Please type in (or copy/paste) the generated value into the text box"
31
+ msgstr ""
32
 
33
  #: wp-reset.php:123
34
+ msgid "Reset Database"
35
+ msgstr ""
36
+
37
+ #: wp-reset.php:127
38
+ msgid "Reactivate current plugins after reset?"
39
+ msgstr ""
40
+
41
+ #: wp-reset.php:133
42
  #, php-format
43
  msgid "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"
44
+ msgstr ""
45
 
46
+ #: wp-reset.php:135
47
  msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
48
+ msgstr ""
49
 
50
+ #: wp-reset.php:138
51
+ msgid "Note that once you reset the database, all users will be deleted except the initial admin user."
52
+ msgstr ""
53
 
54
+ #: wp-reset.php:154
55
  msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
56
+ msgstr ""
57
 
58
+ #: wp-reset.php:194
59
  msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
60
+ msgstr ""
61
 
62
+ #: wp-reset.php:195
63
  msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
64
+ msgstr ""
65
 
66
+ #: wp-reset.php:196
67
  msgid "Goodbye for now."
68
+ msgstr ""
69
+
70
+ #: wp-reset.php:250
71
+ msgid "WordPress Database Reset"
72
+ msgstr ""
73
+
74
+ #: wp-reset.php:251
75
+ msgid "The WordPress database has been successfully reset to its default settings:"
76
+ msgstr ""
77
+
78
+ #: wp-reset.php:252
79
+ msgid "Password: The password you chose during the install."
80
+ msgstr ""
81
 
languages/fr_FR.mo CHANGED
Binary file
languages/fr_FR.po CHANGED
@@ -2,60 +2,80 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WP Reset\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2011-10-02 17:15-0500\n"
6
- "PO-Revision-Date: 2011-10-02 17:15-0500\n"
7
  "Last-Translator: \n"
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: /Users/chrisberthe/.ssh/wp/wp-content/plugins/wp-reset\n"
14
  "X-Poedit-Language: English\n"
15
  "X-Poedit-SearchPath-0: .\n"
16
 
17
- #: wp-reset.php:106
18
  msgid "You entered the wrong value - please try again"
19
  msgstr "Vous avez entré une valeur incorrecte - s'il vous plaît essayez à nouveau."
20
 
21
- #: wp-reset.php:108
22
  msgid "The WordPress database has been reset successfully"
23
  msgstr "La base de données WordPress a été réinitialisé avec succès"
24
 
25
- #: wp-reset.php:113
26
  msgid "Database Reset"
27
  msgstr "Réinitialisation base de données"
28
 
29
- #: wp-reset.php:119
 
 
 
 
30
  msgid "Reset Database"
31
  msgstr "Réinitialiser"
32
 
33
- #: wp-reset.php:123
 
 
 
 
34
  #, php-format
35
  msgid "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"
36
  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."
37
 
38
- #: wp-reset.php:125
39
  msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
40
  msgstr "L'utilisateur <strong><u>admin</u></strong> par défaut sera recréé avec son mot de passe actuel après la réinitialisation"
41
 
42
- #: wp-reset.php:128
43
- msgid "Note that once you reset the database, all users will be deleted except the initial admin user. The plugin will also reactivate itself after resetting"
44
- msgstr "Notez qu'une fois la base de données soit réinitialiser, tous les utilisateurs seront supprimées à l'exception de l'utilisateur admin initial. Le plugin sera également réactiver après la réinitialisation"
45
 
46
- #: wp-reset.php:143
47
  msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
48
  msgstr "Si vous cliquez sur OK, votre base de données sera supprimé. Continuer?"
49
 
50
- #: wp-reset.php:183
51
  msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
52
  msgstr "Avez-vous des idées pour ce plugin? "
53
 
54
- #: wp-reset.php:184
55
  msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
56
  msgstr "Si ce plugin ne marche plus à cause de mises à jour WordPress, rassurez-vous que je vais le mettre à jour dès que possible."
57
 
58
- #: wp-reset.php:185
59
  msgid "Goodbye for now."
60
  msgstr "À bientôt."
61
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  msgstr ""
3
  "Project-Id-Version: WP Reset\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-10-11 23:06-0500\n"
6
+ "PO-Revision-Date: 2011-10-11 23:11-0500\n"
7
  "Last-Translator: \n"
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: /Users/chrisberthe/.ssh/wp/wp-content/plugins/wordpress-database-reset\n"
14
  "X-Poedit-Language: English\n"
15
  "X-Poedit-SearchPath-0: .\n"
16
 
17
+ #: wp-reset.php:110
18
  msgid "You entered the wrong value - please try again"
19
  msgstr "Vous avez entré une valeur incorrecte - s'il vous plaît essayez à nouveau."
20
 
21
+ #: wp-reset.php:112
22
  msgid "The WordPress database has been reset successfully"
23
  msgstr "La base de données WordPress a été réinitialisé avec succès"
24
 
25
+ #: wp-reset.php:117
26
  msgid "Database Reset"
27
  msgstr "Réinitialisation base de données"
28
 
29
+ #: wp-reset.php:118
30
+ msgid "Please type in (or copy/paste) the generated value into the text box"
31
+ msgstr "Veuillez entrer (ou copier / coller) la valeur générée dans la zone de texte"
32
+
33
+ #: wp-reset.php:123
34
  msgid "Reset Database"
35
  msgstr "Réinitialiser"
36
 
37
+ #: wp-reset.php:127
38
+ msgid "Reactivate current plugins after reset?"
39
+ msgstr "Réactiver les plugins actuels après la réinitialisation?"
40
+
41
+ #: wp-reset.php:133
42
  #, php-format
43
  msgid "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"
44
  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."
45
 
46
+ #: wp-reset.php:135
47
  msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
48
  msgstr "L'utilisateur <strong><u>admin</u></strong> par défaut sera recréé avec son mot de passe actuel après la réinitialisation"
49
 
50
+ #: wp-reset.php:138
51
+ msgid "Note that once you reset the database, all users will be deleted except the initial admin user."
52
+ msgstr "Notez qu'une fois la base de données soit réinitialiser, tous les utilisateurs seront supprimées à l'exception de l'utilisateur admin initial."
53
 
54
+ #: wp-reset.php:154
55
  msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
56
  msgstr "Si vous cliquez sur OK, votre base de données sera supprimé. Continuer?"
57
 
58
+ #: wp-reset.php:194
59
  msgid "Have any cool ideas for this plugin? Contact me either by <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/chrisberthe\">GitHub</a>."
60
  msgstr "Avez-vous des idées pour ce plugin? "
61
 
62
+ #: wp-reset.php:195
63
  msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
64
  msgstr "Si ce plugin ne marche plus à cause de mises à jour WordPress, rassurez-vous que je vais le mettre à jour dès que possible."
65
 
66
+ #: wp-reset.php:196
67
  msgid "Goodbye for now."
68
  msgstr "À bientôt."
69
 
70
+ #: wp-reset.php:250
71
+ msgid "WordPress Database Reset"
72
+ msgstr "Réinitialisation base de données"
73
+
74
+ #: wp-reset.php:251
75
+ msgid "The WordPress database has been successfully reset to its default settings:"
76
+ msgstr "La base de données WordPress a été réinitialisé avec succès:"
77
+
78
+ #: wp-reset.php:252
79
+ msgid "Password: The password you chose during the install."
80
+ msgstr "Mot de passe: Le mot de passe que vous avez choisi lors de l'installation."
81
+
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: wordpress, database, database-reset, default-settings, default, wp-reset,
5
  License: GPL2
6
  Requires at least: 3.0
7
  Tested up to: 3.2.1
8
- Stable tag: 1.2.2
9
 
10
  A secure and easy way to reinitialize the WordPress database to its default settings.
11
 
@@ -37,6 +37,10 @@ There are two important reasons as to why I built this plugin:
37
  1. The plugin page - a more secure way of resetting your database.
38
 
39
  == Changelog ==
 
 
 
 
40
  = 1.2 =
41
  * Added capability to manually select whether or not plugin should be reactivated upon reset
42
  * Modified class name to avoid potential conflicts with WordPress core
5
  License: GPL2
6
  Requires at least: 3.0
7
  Tested up to: 3.2.1
8
+ Stable tag: 1.3
9
 
10
  A secure and easy way to reinitialize the WordPress database to its default settings.
11
 
37
  1. The plugin page - a more secure way of resetting your database.
38
 
39
  == Changelog ==
40
+ = 1.3 =
41
+ * Replaced reactivation option for all currently active plugins (not just this plugin)
42
+ * Updated language files
43
+
44
  = 1.2 =
45
  * Added capability to manually select whether or not plugin should be reactivated upon reset
46
  * Modified class name to avoid potential conflicts with WordPress core
wp-reset.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: WP 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: 1.2.2
7
  Author: Chris Berthe
8
  Author URI: https://github.com/chrisberthe
9
  License: GNU General Public License
@@ -18,6 +18,11 @@ if ( ! class_exists('cb_wp_reset') && is_admin() ) :
18
  */
19
  private $_nonce = 'wp-reset-nonce';
20
 
 
 
 
 
 
21
  /**
22
  * Loads default options
23
  *
@@ -55,6 +60,12 @@ if ( ! class_exists('cb_wp_reset') && is_admin() ) :
55
  $admin_user = get_userdatabylogin('admin');
56
  $user = ( ! $admin_user || ! user_can( $admin_user->ID, 'update_core' ) ) ? $current_user : $admin_user;
57
 
 
 
 
 
 
 
58
  // Run through the database columns and drop all the tables
59
  if ( $db_tables = $wpdb->get_col("SHOW TABLES LIKE '{$wpdb->prefix}%'") )
60
  {
@@ -68,10 +79,9 @@ if ( ! class_exists('cb_wp_reset') && is_admin() ) :
68
  $this->_wp_update_user($user, $keys);
69
  }
70
 
71
- // Reactivate the plugin after reinstalling
72
- if ( isset($_POST['wp-reset-check']) && $_POST['wp-reset-check'] == 'true' )
73
  {
74
- update_option('active_plugins', array(plugin_basename(__FILE__)));
75
  wp_redirect(admin_url($pagenow) . '?page=wp-reset&reset=success'); exit();
76
  }
77
 
@@ -114,7 +124,7 @@ if ( ! class_exists('cb_wp_reset') && is_admin() ) :
114
  <p>
115
  <label for="wp-reset-check">
116
  <input type="checkbox" name="wp-reset-check" id="wp-reset-check" checked="checked" value="true" />
117
- <?php _e('Reactivate plugin after resetting?', 'wp-reset') ?>
118
  </label>
119
  </p>
120
  </form>
@@ -251,6 +261,30 @@ if ( ! class_exists('cb_wp_reset') && is_admin() ) :
251
  return $mail;
252
  }
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  /**
255
  * Updates the user password and clears / sets
256
  * the authentication cookie for the user
@@ -270,7 +304,7 @@ if ( ! class_exists('cb_wp_reset') && is_admin() ) :
270
 
271
  if ( $wpdb->query($query) )
272
  {
273
- // Set the default_password_nag to nothing
274
  // so it doesn't pop up with the password reminder after installing
275
  if ( get_user_meta($user_id, 'default_password_nag') ) delete_user_meta($user_id, 'default_password_nag');
276
 
1
  <?php
2
  /*
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: 1.3
7
  Author: Chris Berthe
8
  Author URI: https://github.com/chrisberthe
9
  License: GNU General Public License
18
  */
19
  private $_nonce = 'wp-reset-nonce';
20
 
21
+ /**
22
+ * Plugins to reactivate
23
+ */
24
+ private $_active_plugins;
25
+
26
  /**
27
  * Loads default options
28
  *
60
  $admin_user = get_userdatabylogin('admin');
61
  $user = ( ! $admin_user || ! user_can( $admin_user->ID, 'update_core' ) ) ? $current_user : $admin_user;
62
 
63
+ // Grab the currently active plugins
64
+ if ( isset($_POST['wp-reset-check']) && $_POST['wp-reset-check'] == 'true' )
65
+ {
66
+ $this->_active_plugins = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", 'active_plugins'));
67
+ }
68
+
69
  // Run through the database columns and drop all the tables
70
  if ( $db_tables = $wpdb->get_col("SHOW TABLES LIKE '{$wpdb->prefix}%'") )
71
  {
79
  $this->_wp_update_user($user, $keys);
80
  }
81
 
82
+ // Reactivate the plugins after reinstalling
83
+ if ( $this->_reactivate_plugins() )
84
  {
 
85
  wp_redirect(admin_url($pagenow) . '?page=wp-reset&reset=success'); exit();
86
  }
87
 
124
  <p>
125
  <label for="wp-reset-check">
126
  <input type="checkbox" name="wp-reset-check" id="wp-reset-check" checked="checked" value="true" />
127
+ <?php _e('Reactivate current plugins after reset?', 'wp-reset') ?>
128
  </label>
129
  </p>
130
  </form>
261
  return $mail;
262
  }
263
 
264
+ /**
265
+ * Reactivates the plugins after reset
266
+ *
267
+ * @access private
268
+ * @return TRUE on plugin reactivation, FALSE otherwise
269
+ */
270
+ function _reactivate_plugins()
271
+ {
272
+ global $wpdb;
273
+
274
+ if ( ! empty($this->_active_plugins) )
275
+ {
276
+ // Replace the list of plugins with the 'old' list after the reset
277
+ $query = $wpdb->prepare("UPDATE $wpdb->options SET option_value = %s WHERE option_name = %s", $this->_active_plugins, 'active_plugins');
278
+
279
+ if ( $wpdb->query($query) )
280
+ {
281
+ return TRUE;
282
+ }
283
+ }
284
+
285
+ return FALSE;
286
+ }
287
+
288
  /**
289
  * Updates the user password and clears / sets
290
  * the authentication cookie for the user
304
 
305
  if ( $wpdb->query($query) )
306
  {
307
+ // Delete the default_password_nag
308
  // so it doesn't pop up with the password reminder after installing
309
  if ( get_user_meta($user_id, 'default_password_nag') ) delete_user_meta($user_id, 'default_password_nag');
310