WP Reset – Fastest WordPress Reset Plugin - Version 1.35

Version Description

Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 WP Reset – Fastest WordPress Reset Plugin
Version 1.35
Comparing to
See all releases

Code changes from version 1.30 to 1.35

Files changed (6) hide show
  1. css/wp-reset.css +10 -0
  2. js/wp-reset.js +16 -0
  3. license.txt +280 -0
  4. readme.txt +19 -7
  5. wp-reset-cli.php +62 -3
  6. wp-reset.php +100 -5
css/wp-reset.css CHANGED
@@ -8,6 +8,16 @@
8
  vertical-align: middle;
9
  }
10
 
 
 
 
 
 
 
 
 
 
 
11
  .tools_page_wp-reset.wp-core-ui .button, .tools_page_wp-reset.wp-core-ui .button-primary, .tools_page_wp-reset.wp-core-ui .button-secondary {
12
  border-radius: 0;
13
  }
8
  vertical-align: middle;
9
  }
10
 
11
+ .tools_page_wp-reset h1 span {
12
+ font-size: 13px;
13
+ vertical-align: super;
14
+ font-style: italic;
15
+ }
16
+
17
+ .tools_page_wp-reset .textcenter {
18
+ text-align: center;
19
+ }
20
+
21
  .tools_page_wp-reset.wp-core-ui .button, .tools_page_wp-reset.wp-core-ui .button-primary, .tools_page_wp-reset.wp-core-ui .button-secondary {
22
  border-radius: 0;
23
  }
js/wp-reset.js CHANGED
@@ -25,6 +25,16 @@ jQuery(document).ready(function($) {
25
  }); // delete transients
26
 
27
 
 
 
 
 
 
 
 
 
 
 
28
  // delete themes
29
  $('.tools_page_wp-reset').on('click', '#delete-themes', 'click', function(e) {
30
  e.preventDefault();
@@ -202,6 +212,12 @@ jQuery(document).ready(function($) {
202
  return true;
203
  }
204
 
 
 
 
 
 
 
205
  $.get(ajaxurl, { notice_name: notice_name,
206
  _ajax_nonce: wp_reset.nonce_dismiss_notice,
207
  action: 'wp_reset_dismiss_notice'
25
  }); // delete transients
26
 
27
 
28
+ // delete uploads
29
+ $('.tools_page_wp-reset').on('click', '#delete-uploads', 'click', function(e) {
30
+ e.preventDefault();
31
+
32
+ run_tool(this, 'delete_uploads');
33
+
34
+ return false;
35
+ }); // delete uploads
36
+
37
+
38
  // delete themes
39
  $('.tools_page_wp-reset').on('click', '#delete-themes', 'click', function(e) {
40
  e.preventDefault();
212
  return true;
213
  }
214
 
215
+ if (notice_name == 'geoip_tab') {
216
+ $('#wp-reset-tabs').tabs('option', 'active', 0).tabs('disable', 3);
217
+ $('#wp-reset-tabs li:eq(3)').remove();
218
+ $('#wp-reset-tabs').tabs('refresh');
219
+ }
220
+
221
  $.get(ajaxurl, { notice_name: notice_name,
222
  _ajax_nonce: wp_reset.nonce_dismiss_notice,
223
  action: 'wp_reset_dismiss_notice'
license.txt ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
- === WP Reset - Fastest WordPress Reset Plugin ===
2
  Tags: wordpress reset, reset wordpress, reset database, reset wordpress database, reset, restart wordpress, clean wordpress, default wp, default wordpress, reset wp, wp reset, developer, wp-cli
3
- Contributors: WebFactory, wpreset, googlemapswidget
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 4.9
7
- Stable tag: 1.30
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,13 +12,16 @@ WordPress Reset resets any WordPress site to the default values without modifyin
12
 
13
  == Description ==
14
 
15
- <a href="https://wpreset.com/?utm_source=wordpressorg&utm_medium=content&utm_campaign=wp-reset&utm_term=wp-reset-top">WP Reset</a> quickly resets the site's database to the default installation values without modifying any files. It deletes all customizations and content. WP Reset is fast and safe to use. It has multiple fail-safe mechanisms so you can never accidentally lose data. WP Reset is extremely helpful for plugin and theme developers. It **speeds up testing and debugging** by providing a quick way to reset settings and re-test code. It was developed by developers for developers.
 
 
 
 
 
16
  For support please use the <a href="https://wordpress.org/support/plugin/wp-reset">forums</a>, and if you need more information visit <a href="https://wpreset.com/?utm_source=wordpressorg&utm_medium=content&utm_campaign=wp-reset&utm_term=wpreset.com">wpreset.com</a> and be sure to check out the <a href="https://wpreset.com/roadmap/?utm_source=wordpressorg&utm_medium=content&utm_campaign=wp-reset&utm_term=roadmap">roadmap</a> for the list of upcoming features.
17
 
18
  Access WP Reset admin page via the "Tools" menu.
19
 
20
- > WP Reset is proudly sponsored by <a target="_blank" href="https://ipgeolocation.io/">IP Geolocation</a>, a **premium GeoIP service for developers**. See how you can use their <a href="https://wpreset.com/geoip-transform-boring-data-better-user-experience/">GeoIP service</a> to make boring IP addresses more interesting for users. They offer <a href="https://ipgeolocation.io/signup">50,000 API requests a month FREE for developers</a>, and keep WP Reset updated, maintained & ad free.
21
-
22
  **Please read carefully before proceeding to understand what WP Reset does**
23
 
24
  #### Resetting will delete:
@@ -54,6 +57,8 @@ WP Reset has yet to be completely tested with multisite! Please be careful when
54
 
55
  Delete transients - deletes all transient related database entries. Including expired and non-expired transients, and orphaned timeout entries.
56
 
 
 
57
  Delete plugins - deletes all plugins except WP Reset which remains active.
58
 
59
  Delete themes - deletes all themes.
@@ -81,10 +86,17 @@ Or if needed, upload manually;
81
 
82
  1. WP Reset admin page
83
  2. Reset action has to be double-confirmed
84
-
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
 
 
88
  = v1.30 =
89
  * 2018/08/27
90
  * more code clean-up
1
+ === WP Reset - Best WordPress Reset Plugin ===
2
  Tags: wordpress reset, reset wordpress, reset database, reset wordpress database, reset, restart wordpress, clean wordpress, default wp, default wordpress, reset wp, wp reset, developer, wp-cli
3
+ Contributors: WebFactory, wpreset, googlemapswidget, securityninja, underconstructionpage
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 4.9
7
+ Stable tag: 1.35
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ <a href="https://wpreset.com/?utm_source=wordpressorg&utm_medium=content&utm_campaign=wp-reset&utm_term=wp-reset-top">WP Reset</a> quickly resets the site's database to the default installation values without modifying any files. It deletes all customizations and content. WP Reset is fast and safe to use and comes with a suite of useful developer tools. It has multiple fail-safe mechanisms so you can never accidentally lose data. WP Reset is extremely helpful for plugin & theme developers. It **speeds up development, testing and debugging** by providing a quick way to reset various settings and re-test code. It was developed by developers for developers.
16
+
17
+ https://youtu.be/qMnkCW2PFoI?rel=0
18
+
19
+ > WP Reset is proudly sponsored by <a target="_blank" href="https://ipgeolocation.io/">IP Geolocation</a>, a **premium GeoIP service for developers**. See how you can use their <a href="https://wpreset.com/geoip-transform-boring-data-better-user-experience/">GeoIP service</a> to make boring IP addresses more interesting for users. They offer <a href="https://ipgeolocation.io/signup">50,000 API requests a month FREE for developers</a>, and keep WP Reset updated & maintained.
20
+
21
  For support please use the <a href="https://wordpress.org/support/plugin/wp-reset">forums</a>, and if you need more information visit <a href="https://wpreset.com/?utm_source=wordpressorg&utm_medium=content&utm_campaign=wp-reset&utm_term=wpreset.com">wpreset.com</a> and be sure to check out the <a href="https://wpreset.com/roadmap/?utm_source=wordpressorg&utm_medium=content&utm_campaign=wp-reset&utm_term=roadmap">roadmap</a> for the list of upcoming features.
22
 
23
  Access WP Reset admin page via the "Tools" menu.
24
 
 
 
25
  **Please read carefully before proceeding to understand what WP Reset does**
26
 
27
  #### Resetting will delete:
57
 
58
  Delete transients - deletes all transient related database entries. Including expired and non-expired transients, and orphaned timeout entries.
59
 
60
+ Delete uploads - delete all files and folder in the /uploads/ folder.
61
+
62
  Delete plugins - deletes all plugins except WP Reset which remains active.
63
 
64
  Delete themes - deletes all themes.
86
 
87
  1. WP Reset admin page
88
  2. Reset action has to be double-confirmed
89
+ 3. Additional tools for resetting and deleting various WordPress objects
90
 
91
  == Changelog ==
92
 
93
+ = v1.35 =
94
+ * 2018/09/18
95
+ * WP Reset is proudly sponsored by <a href="https://ipgeolocation.io/">IP Geolocation</a>
96
+ * 60k users hit on 2018/09/16 with 323,300 downloads; 35 days for +10k
97
+ * added all tools to WP-CLI
98
+ * new tool: delete all files in uploads folder
99
+
100
  = v1.30 =
101
  * 2018/08/27
102
  * more code clean-up
wp-reset-cli.php CHANGED
@@ -41,8 +41,8 @@ class WP_Reset_CLI extends WP_CLI_Command {
41
  *
42
  * @when after_wp_load
43
  */
44
- function reset( $_, $assoc_args ) {
45
- WP_CLI::confirm( 'Are you sure you want to do this?', $assoc_args );
46
 
47
  global $wp_reset;
48
  $params = array();
@@ -73,11 +73,70 @@ class WP_Reset_CLI extends WP_CLI_Command {
73
  *
74
  * @when after_wp_load
75
  */
76
- function version( $_, $assoc_args ) {
77
  global $wp_reset;
78
 
79
  WP_CLI::line( 'WP Reset v' . $wp_reset->version );
80
  } // version
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  } // WP_Reset_CLI
82
 
83
  WP_CLI::add_command( 'reset', 'WP_Reset_CLI' );
41
  *
42
  * @when after_wp_load
43
  */
44
+ function reset( $args, $assoc_args ) {
45
+ WP_CLI::confirm( 'Are you sure you want to reset the site? There is NO UNDO!', $assoc_args );
46
 
47
  global $wp_reset;
48
  $params = array();
73
  *
74
  * @when after_wp_load
75
  */
76
+ function version( $args, $assoc_args ) {
77
  global $wp_reset;
78
 
79
  WP_CLI::line( 'WP Reset v' . $wp_reset->version );
80
  } // version
81
+
82
+
83
+ /**
84
+ * Delete selected WordPress objects.
85
+ *
86
+ * ## OPTIONS
87
+ *
88
+ * <plugins|themes|transients|uploads>
89
+ * : WP objects to delete.
90
+ *
91
+ * [--yes]
92
+ * : Answer yes to the confirmation message.
93
+ *
94
+ * ## EXAMPLES
95
+ *
96
+ * $ wp reset delete themes --yes
97
+ * Success: 3 themes have been deleted.
98
+ *
99
+ * @when after_wp_load
100
+ */
101
+ function delete( $args, $assoc_args ) {
102
+ global $wp_reset;
103
+
104
+ if ( empty( $args[0] ) ) {
105
+ WP_CLI::error( 'Please choose a subcommand: plugins, themes, transients or uploads.' );
106
+ return;
107
+ } elseif ( false == in_array( $args[0], array( 'themes', 'plugins', 'transients', 'uploads' ) ) ) {
108
+ WP_CLI::error( 'Unknown subcommand. Please choose from: plugins, themes, transients or uploads.' );
109
+ } else {
110
+ $subcommand = $args[0];
111
+ }
112
+
113
+ switch ($subcommand) {
114
+ case 'themes':
115
+ WP_CLI::confirm( 'Are you sure you want to delete all themes?', $assoc_args );
116
+ $cnt = $wp_reset->do_delete_themes( false );
117
+ WP_CLI::success( $cnt . ' themes have been deleted.' );
118
+ break;
119
+ case 'plugins':
120
+ WP_CLI::confirm( 'Are you sure you want to delete all plugins?', $assoc_args );
121
+ $cnt = $wp_reset->do_delete_plugins( true, false );
122
+ WP_CLI::success( $cnt . ' plugins have been deleted.' );
123
+ break;
124
+ case 'transients':
125
+ WP_CLI::confirm( 'Are you sure you want to delete all transients?', $assoc_args );
126
+ $cnt = $wp_reset->do_delete_transients();
127
+ WP_CLI::success( $cnt . ' transient database entries have been deleted.' );
128
+ break;
129
+ case 'uploads':
130
+ WP_CLI::confirm( 'Are you sure you want to delete all files & folders in /uploads/ folder?', $assoc_args );
131
+ $cnt = $wp_reset->do_delete_uploads();
132
+ WP_CLI::success( $cnt . ' files & folders have been deleted.' );
133
+ break;
134
+ default:
135
+ // should never come to this but can't hurt
136
+ WP_CLI::error( 'Unknown subcommand. Please choose from: plugins, themes, transients or uploads.' );
137
+ return;
138
+ }
139
+ } // delete
140
  } // WP_Reset_CLI
141
 
142
  WP_CLI::add_command( 'reset', 'WP_Reset_CLI' );
wp-reset.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Reset
4
  Plugin URI: https://wpreset.com/
5
  Description: Reset the site to default installation values without modifying any files. Deletes all customizations and content.
6
- Version: 1.30
7
  Author: WebFactory Ltd
8
  Author URI: https://www.webfactoryltd.com/
9
  Text Domain: wp-reset
@@ -42,6 +42,7 @@ class WP_Reset {
42
  public $plugin_url = '';
43
  public $plugin_dir = '';
44
  protected $options = array();
 
45
 
46
 
47
  /**
@@ -342,7 +343,48 @@ class WP_Reset {
342
  $count = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '\_transient\_%' OR option_name LIKE '\_site\_transient\_%'");
343
 
344
  return $count;
345
- } // do_delete_transients
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
 
347
 
348
  /**
@@ -426,6 +468,9 @@ class WP_Reset {
426
  } elseif ($tool == 'delete_plugins') {
427
  $cnt = $this->do_delete_plugins(true);
428
  wp_send_json_success($cnt);
 
 
 
429
  } else {
430
  wp_send_json_error(__('Unknown tool.', 'wp-reset'));
431
  }
@@ -634,7 +679,7 @@ class WP_Reset {
634
  return $text;
635
  }
636
 
637
- $text = '<i><a href="' . $this->generate_web_link('admin_footer') . '" title="' . __('Visit WP Reset page for more info', 'wp-reset') . '" target="_blank">WP Reset</a> v' . $this->version . ' by <a href="https://www.webfactoryltd.com/" title="' . __('Visit our site to get more great plugins', 'wp-reset'). '" target="_blank">WebFactory Ltd</a>.</i> '. $text;
638
 
639
  return $text;
640
  } // admin_footer_text
@@ -670,6 +715,7 @@ class WP_Reset {
670
  function plugin_page() {
671
  $notice_shown = false;
672
  $meta = $this->get_meta();
 
673
 
674
  // double check for admin priv
675
  if (!current_user_can('administrator')) {
@@ -678,7 +724,7 @@ class WP_Reset {
678
 
679
  settings_errors();
680
  echo '<div class="wrap">';
681
- echo '<h1><img id="logo-icon" src="' . $this->plugin_url . 'img/wp-reset-logo.png" title="' . __('WP Reset', 'wp-reset') . '" alt="' . __('WP Reset', 'wp-reset') . '"></h1>';
682
  echo '<form id="wp_reset_form" action="' . admin_url('tools.php?page=wp-reset') . '" method="post" autocomplete="off">';
683
 
684
  if (false === $notice_shown && is_multisite()) {
@@ -698,7 +744,8 @@ class WP_Reset {
698
  $notice_shown = true;
699
  }
700
 
701
- if (false === $notice_shown && $meta['reset_count'] >= 2 && false == $this->get_dismissed_notices('tidy')) {
 
702
  echo '<div class="card notice-wrapper">';
703
  echo '<h2>' . __('Are you a plugin author? Get your plugin reviewed on Tidy Repo', 'wp-reset') . '</h2>';
704
  echo '<p>' . __('Since 2013 Tidy Repo has been reviewing the best and most reliable WordPress plugins. <b>Submitting a plugin is free</b>, so you have nothing to lose and a lot of exposure to gain when it gets reviewed.', 'wp-reset') . '</p>';
@@ -714,6 +761,9 @@ class WP_Reset {
714
  echo '<li><a href="#tab-reset">' . __('Reset', 'wp-reset') . '</a></li>';
715
  echo '<li><a href="#tab-tools">' . __('Tools', 'wp-reset') . '</a></li>';
716
  echo '<li><a href="#tab-support">' . __('Support', 'wp-reset') . '</a></li>';
 
 
 
717
  echo '</ul>';
718
 
719
  echo '<div style="display: none;" id="tab-reset">';
@@ -727,6 +777,12 @@ class WP_Reset {
727
  echo '<div style="display: none;" id="tab-support">';
728
  $this->tab_support();
729
  echo '</div>';
 
 
 
 
 
 
730
 
731
  echo '</div>'; // tabs
732
 
@@ -810,6 +866,18 @@ class WP_Reset {
810
  echo '<p><a data-btn-confirm="Delete all transients" data-text-wait="Deleting transients. Please wait." data-text-confirm="All database entries related to transients will be deleted. There is NO UNDO. WP Reset will not make any backups." data-text-done="%n transient database entries have been deleted." class="button" href="#" id="delete-transients">Delete all transients</a></p>';
811
  echo '</div>';
812
 
 
 
 
 
 
 
 
 
 
 
 
 
813
  echo '<div class="card">';
814
  echo '<h2>' . __('Themes', 'wp-reset') . '</h2>';
815
  echo '<p>' . __('All themes will be deleted. Including the currently active theme - ' . $theme->get('Name') . '. <b>There is NO UNDO. WP Reset will not make any backups.</b>', 'wp-reset') . '</p>';
@@ -842,6 +910,33 @@ class WP_Reset {
842
  echo '</div>';
843
  } // tab_support
844
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
845
 
846
  /**
847
  * Helper function for generating UTM tagged links
3
  Plugin Name: WP Reset
4
  Plugin URI: https://wpreset.com/
5
  Description: Reset the site to default installation values without modifying any files. Deletes all customizations and content.
6
+ Version: 1.35
7
  Author: WebFactory Ltd
8
  Author URI: https://www.webfactoryltd.com/
9
  Text Domain: wp-reset
42
  public $plugin_url = '';
43
  public $plugin_dir = '';
44
  protected $options = array();
45
+ private $delete_count = 0;
46
 
47
 
48
  /**
343
  $count = $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE '\_transient\_%' OR option_name LIKE '\_site\_transient\_%'");
344
 
345
  return $count;
346
+ } // do_delete_transients
347
+
348
+
349
+ /**
350
+ * Deletes all files in uploads folder.
351
+ *
352
+ * @return int
353
+ */
354
+ function do_delete_uploads() {
355
+ $upload_dir = wp_get_upload_dir();
356
+
357
+ $this->delete_folder($upload_dir['basedir'], $upload_dir['basedir']);
358
+
359
+ return $this->delete_count;
360
+ } // do_delete_uploads
361
+
362
+
363
+ /**
364
+ * Recursively deletes a folder
365
+ *
366
+ * @return bool
367
+ */
368
+ private function delete_folder($folder, $base_folder) {
369
+ $files = array_diff(scandir($folder), array('.', '..'));
370
+
371
+ foreach ($files as $file) {
372
+ if (is_dir($folder . DIRECTORY_SEPARATOR . $file)) {
373
+ $this->delete_folder($folder . DIRECTORY_SEPARATOR . $file, $base_folder);
374
+ } else {
375
+ $tmp = @unlink($folder . DIRECTORY_SEPARATOR . $file);
376
+ $this->delete_count = $this->delete_count + (int) $tmp;
377
+ }
378
+ } // foreach
379
+
380
+ if ($folder != $base_folder) {
381
+ $tmp = @rmdir($folder);
382
+ $this->delete_count = $this->delete_count + (int) $tmp;
383
+ return $tmp;
384
+ } else {
385
+ return true;
386
+ }
387
+ } // delete_folder
388
 
389
 
390
  /**
468
  } elseif ($tool == 'delete_plugins') {
469
  $cnt = $this->do_delete_plugins(true);
470
  wp_send_json_success($cnt);
471
+ } elseif ($tool == 'delete_uploads') {
472
+ $cnt = $this->do_delete_uploads();
473
+ wp_send_json_success($cnt);
474
  } else {
475
  wp_send_json_error(__('Unknown tool.', 'wp-reset'));
476
  }
679
  return $text;
680
  }
681
 
682
+ $text = '<i><a href="' . $this->generate_web_link('admin_footer') . '" title="' . __('Visit WP Reset page for more info', 'wp-reset') . '" target="_blank">WP Reset</a> v' . $this->version . ' by <a href="https://www.webfactoryltd.com/" title="' . __('Visit our site to get more great plugins', 'wp-reset'). '" target="_blank">WebFactory Ltd</a>. Proudly sponsored by <a target="_blank" href="https://ipgeolocation.io/">IP Geolocation</a> - premium GeoIP service for developers.</i>';
683
 
684
  return $text;
685
  } // admin_footer_text
715
  function plugin_page() {
716
  $notice_shown = false;
717
  $meta = $this->get_meta();
718
+ $notices = $this->get_dismissed_notices();
719
 
720
  // double check for admin priv
721
  if (!current_user_can('administrator')) {
724
 
725
  settings_errors();
726
  echo '<div class="wrap">';
727
+ echo '<h1><img id="logo-icon" src="' . $this->plugin_url . 'img/wp-reset-logo.png" title="' . __('WP Reset', 'wp-reset') . '" alt="' . __('WP Reset', 'wp-reset') . '"> <span>proudly sponsored by <a href="https://ipgeolocation.io/" target="_blank">IP Geolocation</a></span></h1>';
728
  echo '<form id="wp_reset_form" action="' . admin_url('tools.php?page=wp-reset') . '" method="post" autocomplete="off">';
729
 
730
  if (false === $notice_shown && is_multisite()) {
744
  $notice_shown = true;
745
  }
746
 
747
+ // disabled for now
748
+ if (false && false === $notice_shown && $meta['reset_count'] >= 2 && false == $this->get_dismissed_notices('tidy')) {
749
  echo '<div class="card notice-wrapper">';
750
  echo '<h2>' . __('Are you a plugin author? Get your plugin reviewed on Tidy Repo', 'wp-reset') . '</h2>';
751
  echo '<p>' . __('Since 2013 Tidy Repo has been reviewing the best and most reliable WordPress plugins. <b>Submitting a plugin is free</b>, so you have nothing to lose and a lot of exposure to gain when it gets reviewed.', 'wp-reset') . '</p>';
761
  echo '<li><a href="#tab-reset">' . __('Reset', 'wp-reset') . '</a></li>';
762
  echo '<li><a href="#tab-tools">' . __('Tools', 'wp-reset') . '</a></li>';
763
  echo '<li><a href="#tab-support">' . __('Support', 'wp-reset') . '</a></li>';
764
+ if (empty($notices['geoip_tab'])) {
765
+ echo '<li><a href="#tab-geoip">' . __('IP Geolocation', 'wp-reset') . '</a></li>';
766
+ }
767
  echo '</ul>';
768
 
769
  echo '<div style="display: none;" id="tab-reset">';
777
  echo '<div style="display: none;" id="tab-support">';
778
  $this->tab_support();
779
  echo '</div>';
780
+
781
+ if (empty($notices['geoip_tab'])) {
782
+ echo '<div style="display: none;" id="tab-geoip">';
783
+ $this->tab_geoip();
784
+ echo '</div>';
785
+ }
786
 
787
  echo '</div>'; // tabs
788
 
866
  echo '<p><a data-btn-confirm="Delete all transients" data-text-wait="Deleting transients. Please wait." data-text-confirm="All database entries related to transients will be deleted. There is NO UNDO. WP Reset will not make any backups." data-text-done="%n transient database entries have been deleted." class="button" href="#" id="delete-transients">Delete all transients</a></p>';
867
  echo '</div>';
868
 
869
+ $upload_dir = wp_upload_dir(date('Y/m'), true);
870
+
871
+ echo '<div class="card">';
872
+ echo '<h2>' . __('Uploads Folder', 'wp-reset') . '</h2>';
873
+ echo '<p>' . __('All files in <code>' . $upload_dir['basedir'] . '</code> folder will be deleted. Including folders and subfolder, and files in subfolders. Files associated with <a href="' . admin_url('upload.php') . '">media</a> entries will be deleted too. <b>There is NO UNDO. WP Reset will not make any backups.</b>', 'wp-reset') . '</p>';
874
+ if (false != $upload_dir['error']) {
875
+ echo '<p><span style="color:#dd3036;"><b>Tool is not available.</b></span> Folder is not writeable by WordPress. Please check file and folder access rights.</p>';
876
+ } else {
877
+ echo '<p><a data-btn-confirm="Delete everything in uploads folder" data-text-wait="Deleting uploads. Please wait." data-text-confirm="All files and folders in uploads will be deleted. There is NO UNDO. WP Reset will not make any backups." data-text-done="%n files &amp; folders have been deleted." class="button" href="#" id="delete-uploads">Delete all files &amp; folders in uploads folder</a></p>';
878
+ }
879
+ echo '</div>';
880
+
881
  echo '<div class="card">';
882
  echo '<h2>' . __('Themes', 'wp-reset') . '</h2>';
883
  echo '<p>' . __('All themes will be deleted. Including the currently active theme - ' . $theme->get('Name') . '. <b>There is NO UNDO. WP Reset will not make any backups.</b>', 'wp-reset') . '</p>';
910
  echo '</div>';
911
  } // tab_support
912
 
913
+
914
+ /**
915
+ * Echoes content for sponsor tab
916
+ *
917
+ * @return null
918
+ */
919
+ private function tab_geoip() {
920
+ echo '<div class="card">';
921
+ echo '<h2>' . __('WP Reset is proudly sponsored by IP Geolocation', 'wp-reset') . '</h2>';
922
+ echo '<p>' . __('Keeping a plugin maintained, supported and free is neither easy nor cheap that\'s why we\'re thrilled that a <a href="https://ipgeolocation.io/" target="_blank">premium GeoIP service</a> decided to sponsor WP Reset. No notifications, no popups, no shady links. They keep the plugin free and clean.', 'wp-reset') . '</p>';
923
+ echo '</div>';
924
+
925
+ echo '<div class="card">';
926
+ echo '<h2>' . __('Why would I need a GeoIP service?', 'wp-reset') . '</h2>';
927
+ echo '<p>' . __('IP addresses are boring and don\'t mean much to people. However, they can easily be transformed into a huge source of data by using a GeoIP service. From filtering and segmenting users to providing a better UX - geographical data can enhance any web app! See an <a href="https://wpreset.com/geoip-transform-boring-data-better-user-experience/" target="_blank">example</a> we recently wrote about.', 'wp-reset') . '</p>';
928
+ echo '<p><a href="https://ipgeolocation.io/ip-location" target="_blank" class="button">See what data is available for your IP address</a></p>';
929
+ echo '</div>';
930
+
931
+ echo '<div class="card">';
932
+ echo '<h2>' . __('Get a free account', 'wp-reset') . '</h2>';
933
+ echo '<p>' . __('IP Geolocation knows how difficult it is to start any new project. That\'s why they offer <a href="https://ipgeolocation.io/signup" target="_blank">50,000 API requests per month for free</a>. No credit card required, no tricks - just register for an account and you can use the service. It\'s a great way to add value to any web project.' , 'wp-reset') . '</p>';
934
+ echo '<p><a href="https://ipgeolocation.io/signup" target="_blank" class="button">Get a FREE account with 50,000 API requests a month</a></p>';
935
+ echo '</div>';
936
+
937
+ echo '<p>Permanently <a href="#" class="wpr-dismiss-notice" data-notice="geoip_tab">remove this tab</a>.</p>';
938
+ } // tab_geoip
939
+
940
 
941
  /**
942
  * Helper function for generating UTM tagged links