Version Description
Download this release
Release Info
Developer | mousesports |
Plugin | WordPress Database Reset |
Version | 3.0 |
Comparing to | |
See all releases |
Code changes from version 2.3.2 to 3.0
- assets/css/bsmselect.css +76 -0
- assets/css/database-reset.css +32 -0
- assets/images/donate.png +0 -0
- assets/images/spinner.gif +0 -0
- assets/js/bsmselect.compatibility.js +10 -0
- assets/js/bsmselect.js +13 -0
- assets/js/database-reset.js +43 -0
- class-db-reset-admin.php +189 -0
- class-db-reset-command.php +104 -0
- class-db-reset-manager.php +30 -0
- class-db-resetter.php +215 -0
- init.php +36 -0
- languages/wp-reset-de_DE.mo +0 -0
- languages/wp-reset-de_DE.po +0 -114
- languages/wp-reset-fr_FR.mo +0 -0
- languages/wp-reset-fr_FR.po +0 -222
- languages/wp-reset-pt_BR.mo +0 -0
- languages/wp-reset-pt_BR.po +0 -119
- languages/wp-reset.pot +0 -172
- lib/class-plugin-autoloader.php +33 -0
- lib/helpers.php +144 -0
- readme.txt +110 -83
- screenshot-1.png +0 -0
- views/index.php +13 -0
- views/partials/disclaimer.php +3 -0
- views/partials/donate.php +7 -0
- views/partials/notice.php +9 -0
- views/partials/security-code.php +7 -0
- views/partials/select-tables.php +21 -0
- views/partials/submit-button.php +4 -0
assets/css/bsmselect.css
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.bsmContainer {
|
2 |
+
/* container that surrounds entire bsmSelect widget */
|
3 |
+
color: #555;
|
4 |
+
}
|
5 |
+
|
6 |
+
.bsmSelect {
|
7 |
+
/* the newly created regular 'select' */
|
8 |
+
display: inline;
|
9 |
+
}
|
10 |
+
|
11 |
+
.bsmOptionDisabled {
|
12 |
+
/* disabled options in new select */
|
13 |
+
color: #999;
|
14 |
+
}
|
15 |
+
|
16 |
+
.bsmHighlight {
|
17 |
+
/* the highlight span */
|
18 |
+
float: right;
|
19 |
+
padding: 0;
|
20 |
+
margin: 0 0 0 1em;
|
21 |
+
}
|
22 |
+
|
23 |
+
.bsmList {
|
24 |
+
/* html list that contains selected items */
|
25 |
+
border-color: #DFDFDF;
|
26 |
+
margin: 0.25em 0 1.5em 0;
|
27 |
+
position: relative;
|
28 |
+
display: block;
|
29 |
+
padding-left: 0;
|
30 |
+
list-style: none;
|
31 |
+
width: 287px;
|
32 |
+
}
|
33 |
+
|
34 |
+
.bsmListItem {
|
35 |
+
/* li item from the html list above */
|
36 |
+
position: relative;
|
37 |
+
margin-left: 0;
|
38 |
+
padding-left: 0;
|
39 |
+
list-style: none;
|
40 |
+
background: #FCFCFC;
|
41 |
+
border: 1px solid #DFDFDF;
|
42 |
+
width: 100%;
|
43 |
+
margin: 0 0 -1px 0;
|
44 |
+
line-height: 1em;
|
45 |
+
}
|
46 |
+
|
47 |
+
.bsmListItem:hover {
|
48 |
+
background-color: #F0F0F0;
|
49 |
+
}
|
50 |
+
|
51 |
+
.bsmListItemLabel {
|
52 |
+
/* this is a span that surrounds the text in the item, except for the remove link */
|
53 |
+
padding: 5px;
|
54 |
+
display: block;
|
55 |
+
}
|
56 |
+
|
57 |
+
.bsmListSortable .bsmListItemLabel {
|
58 |
+
cursor: move;
|
59 |
+
}
|
60 |
+
|
61 |
+
.bsmListItemRemove {
|
62 |
+
/* the remove link in each list item */
|
63 |
+
text-decoration: none;
|
64 |
+
position: absolute;
|
65 |
+
right: 0;
|
66 |
+
top: 0;
|
67 |
+
padding: 5px;
|
68 |
+
}
|
69 |
+
|
70 |
+
.bsmListItemRemove:hover {
|
71 |
+
text-decoration: underline;
|
72 |
+
}
|
73 |
+
|
74 |
+
#bsmListbsmContainer0 {
|
75 |
+
margin-top: 12px;
|
76 |
+
}
|
assets/css/database-reset.css
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#select-container {
|
2 |
+
width: 290px;
|
3 |
+
}
|
4 |
+
|
5 |
+
#select-all {
|
6 |
+
float: right;
|
7 |
+
margin-top: 6px;
|
8 |
+
}
|
9 |
+
|
10 |
+
#security-code {
|
11 |
+
font-weight: bold;
|
12 |
+
display: inline-block;
|
13 |
+
margin-left: 3px;
|
14 |
+
}
|
15 |
+
|
16 |
+
#loader {
|
17 |
+
margin-left: 10px;
|
18 |
+
position: absolute;
|
19 |
+
width: 28px;
|
20 |
+
}
|
21 |
+
|
22 |
+
#reactivate {
|
23 |
+
color: #21759B;
|
24 |
+
}
|
25 |
+
|
26 |
+
#donate-button {
|
27 |
+
bottom: 15px;
|
28 |
+
position: absolute;
|
29 |
+
right: 15px;
|
30 |
+
width: 170px;
|
31 |
+
outline: 0;
|
32 |
+
}
|
assets/images/donate.png
ADDED
Binary file
|
assets/images/spinner.gif
ADDED
Binary file
|
assets/js/bsmselect.compatibility.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Better Select Multiple Compatibility Plugin - jQuery Plugin
|
3 |
+
*
|
4 |
+
* Copyright (c) 2010-2011 by Victor Berchet - http://www.github.com/vicb
|
5 |
+
*
|
6 |
+
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
7 |
+
*
|
8 |
+
* version: v1.0.1 - 2011-11-14
|
9 |
+
*/
|
10 |
+
!function(a){a.bsmSelect.plugins.compatibility=function(){return this instanceof a.bsmSelect.plugins.compatibility?void 0:new a.bsmSelect.plugins.compatibility},a.extend(a.bsmSelect.plugins.compatibility.prototype,{init:function(b){var c=b.options;"undefined"!=typeof c.animate&&(c.animate===!0?(c.showEffect=a.bsmSelect.effects.verticalListAdd,c.hideEffect=a.bsmSelect.effects.verticalListRemove):c.showEffect=a.isFunction(c.animate.add)?c.animate.add:"string"==typeof c.animate.add&&a.isFunction(a.bsmSelect.effects[c.animate.add])?a.bsmSelect.effects[c.animate.add]:a.bsmSelect.effects.show,c.hideEffect=a.isFunction(c.animate.drop)?c.animate.drop:"string"==typeof c.animate.drop&&a.isFunction(a.bsmSelect.effects[c.animate.drop])?a.bsmSelect.effects[c.animate.drop]:a.bsmSelect.effects.remove),"undefined"!=typeof c.highlight&&(c.highlight===!0?c.highlightEffect=a.bsmSelect.effects.highlight:a.isFunction(c.highlight)?c.highlightEffect=c.highlight:"string"==typeof c.highlight&&a.isFunction(a.bsmSelect.effects[c.highlight])&&(c.highlightEffect=a.bsmSelect.effects[c.highlight]))}})}(jQuery);
|
assets/js/bsmselect.js
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* Better Select Multiple - jQuery Plugin
|
3 |
+
*
|
4 |
+
* based on Alternate Select Multiple (asmSelect) 1.0.4a beta (http://www.ryancramer.com/projects/asmselect/)
|
5 |
+
*
|
6 |
+
* Copyright (c) 2009 by Ryan Cramer - http://www.ryancramer.com
|
7 |
+
* Copyright (c) 2010 by Victor Berchet - http://www.github.com/vicb
|
8 |
+
*
|
9 |
+
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
10 |
+
*
|
11 |
+
* bsmSelect version: v1.4.3 - 2011-05-05
|
12 |
+
*/
|
13 |
+
!function(a){function b(b,c){this.$original=a(b),this.buildingSelect=!1,this.ieClick=!1,this.ignoreOriginalChangeEvent=!1,this.options=c,this.buildDom()}b.prototype={generateUid:function(a){return this.uid=this.options.containerClass+a},buildDom:function(){var b=this,c=this.options;"original"===c.addItemTarget&&a("option",this.$original).each(function(b,c){null===a(c).data("bsm-order")&&a(c).data("bsm-order",b)});for(var d=0;a("#"+this.generateUid(d)).size();d++);this.$select=a("<select>",{"class":c.selectClass,name:c.selectClass+this.uid,id:c.selectClass+this.uid,change:a.proxy(this.selectChangeEvent,this),click:a.proxy(this.selectClickEvent,this)}),this.$list=a.isFunction(c.listType)?c.listType(this.$original):a("<"+c.listType+">",{id:c.listClass+this.uid}),this.$list.addClass(c.listClass),this.$container=a("<div>",{"class":c.containerClass,id:this.uid}),this.buildSelect(),this.$original.change(a.proxy(this.originalChangeEvent,this)).wrap(this.$container).before(this.$select),this.$list.parent().length||this.$original.before(this.$list),this.$original.attr("id")&&a("label[for="+this.$original.attr("id")+"]").attr("for",this.$select.attr("id")),this.$list.delegate("."+c.removeClass,"click",function(){return b.dropListItem(a(this).closest("li")),!1}),a.each(c.plugins,function(){this.init(b)})},selectChangeEvent:function(){if(!(a.browser.msie&&a.browser.version<7)||this.ieClick){var b=a("option:selected:eq(0)",this.$select);b.data("orig-option")&&(this.addListItem(b),this.triggerOriginalChange(b.data("orig-option"),"add")),this.ieClick=!1}},selectClickEvent:function(){this.ieClick=!0},originalChangeEvent:function(){this.ignoreOriginalChangeEvent?this.ignoreOriginalChangeEvent=!1:(this.buildSelect(),a.browser.opera&&this.$list.hide().show())},buildSelect:function(){var b=this;this.buildingSelect=!0,this.$select.empty().prepend(a('<option value=""></option>').text(this.$original.attr("title")||this.options.title)),this.$list.empty(),this.$original.children().each(function(){a(this).is("option")?b.addSelectOption(b.$select,a(this)):a(this).is("optgroup")&&b.addSelectOptionGroup(b.$select,a(this))}),this.options.debugMode||this.$original.hide(),this.selectFirstItem(),this.buildingSelect=!1},addSelectOption:function(b,c){var d=a("<option>",{text:c.text(),val:c.val()}).appendTo(b).data("orig-option",c),e=c.is(":selected"),f=c.is(":disabled");c.data("bsm-option",d),e&&!f?(this.addListItem(d),this.disableSelectOption(d)):!e&&f&&this.disableSelectOption(d)},addSelectOptionGroup:function(b,c){var d=this,e=a("<optgroup>",{label:c.attr("label")}).appendTo(b);c.is(":disabled")&&e.attr("disabled","disabled"),a("option",c).each(function(){d.addSelectOption(e,a(this))})},selectFirstItem:function(){a("option:eq(0)",this.$select).attr("selected","selected")},disableSelectOption:function(b){b.addClass(this.options.optionDisabledClass).removeAttr("selected").attr("disabled","disabled").toggle(!this.options.hideWhenAdded),a.browser.msie&&a.browser.version<8&&this.$select.hide().show()},enableSelectOption:function(b){b.removeClass(this.options.optionDisabledClass).removeAttr("disabled").toggle(!this.options.hideWhenAdded),a.browser.msie&&a.browser.version<8&&this.$select.hide().show()},addListItem:function(b){var c,d=b.data("orig-option"),e=this.options;if(d){if(!this.buildingSelect){if(d.is(":selected"))return;d.attr("selected","selected")}switch(c=a("<li>",{"class":e.listItemClass}).append(a("<span>",{"class":e.listItemLabelClass,html:e.extractLabel(b,e)})).append(a("<a>",{href:"#","class":e.removeClass,html:e.removeLabel})).data("bsm-option",b),this.disableSelectOption(b.data("item",c)),e.addItemTarget){case"bottom":this.$list.append(c.hide());break;case"original":var f=d.data("bsm-order"),g=!1;a("."+e.listItemClass,this.$list).each(function(){return f<a(this).data("bsm-option").data("orig-option").data("bsm-order")?(c.hide().insertBefore(this),g=!0,!1):void 0}),g||this.$list.append(c.hide());break;default:this.$list.prepend(c.hide())}this.buildingSelect?a.bsmSelect.effects.show(c):(e.showEffect(c),e.highlightEffect(this.$select,c,e.highlightAddedLabel,this.options),this.selectFirstItem())}},dropListItem:function(b){var c=b.data("bsm-option"),d=this.options;c.removeData("item").data("orig-option").removeAttr("selected"),(this.buildingSelect?a.bsmSelect.effects.remove:d.hideEffect)(b),this.enableSelectOption(c),d.highlightEffect(this.$select,b,d.highlightRemovedLabel,d),this.triggerOriginalChange(c.data("orig-option"),"drop")},triggerOriginalChange:function(a,b){this.ignoreOriginalChangeEvent=!0,this.$original.trigger("change",[{option:a,value:a.val(),item:a.data("bsm-option").data("item"),type:b}])}},a.fn.bsmSelect=function(c){var d=a.extend({},a.bsmSelect.conf,c);return this.each(function(){var c=a(this).data("bsmSelect");c||(c=new b(a(this),d),a(this).data("bsmSelect",c))})},a.bsmSelect={},a.extend(a.bsmSelect,{effects:{show:function(a){a.show()},remove:function(a){a.remove()},highlight:function(b,c,d,e){var f,g=b.attr("id")+e.highlightClass;a("#"+g).remove(),f=a("<span>",{"class":e.highlightClass,id:g,html:d+c.children("."+e.listItemLabelClass).first().text()}).hide(),b.after(f.fadeIn("fast").delay(50).fadeOut("slow",function(){a(this).remove()}))},verticalListAdd:function(b){b.animate({opacity:"show",height:"show"},100,function(){a(this).animate({height:"+=2px"},100,function(){a(this).animate({height:"-=2px"},100)})})},verticalListRemove:function(b){b.animate({opacity:"hide",height:"hide"},100,function(){a(this).prev("li").animate({height:"-=2px"},100,function(){a(this).animate({height:"+=2px"},100)}),a(this).remove()})}},plugins:{}}),a.bsmSelect.conf={listType:"ol",showEffect:a.bsmSelect.effects.show,hideEffect:a.bsmSelect.effects.remove,highlightEffect:a.noop,addItemTarget:"bottom",hideWhenAdded:!1,debugMode:!1,title:"Select...",removeLabel:"remove",highlightAddedLabel:"Added: ",highlightRemovedLabel:"Removed: ",extractLabel:function(a){return a.html()},plugins:[],containerClass:"bsmContainer",selectClass:"bsmSelect",optionDisabledClass:"bsmOptionDisabled",listClass:"bsmList",listItemClass:"bsmListItem",listItemLabelClass:"bsmListItemLabel",removeClass:"bsmListItemRemove",highlightClass:"bsmHighlight"}}(jQuery);
|
assets/js/database-reset.js
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function( $ ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
var tables = $( '#wp-tables' );
|
5 |
+
|
6 |
+
tables.bsmSelect({
|
7 |
+
animate: true,
|
8 |
+
title: dbReset.selectTable,
|
9 |
+
plugins: [$.bsmSelect.plugins.compatibility()]
|
10 |
+
});
|
11 |
+
|
12 |
+
$( '#select-all' ).on('click', function(e) {
|
13 |
+
e.preventDefault();
|
14 |
+
|
15 |
+
tables.children()
|
16 |
+
.attr( 'selected', 'selected' )
|
17 |
+
.end()
|
18 |
+
.change();
|
19 |
+
});
|
20 |
+
|
21 |
+
tables.on( 'change', function() {
|
22 |
+
$( '#reactivate' ).showIfSelected( 'options' );
|
23 |
+
$( '#disclaimer' ).showIfSelected( 'users' );
|
24 |
+
});
|
25 |
+
|
26 |
+
$( '#db-reset-code-confirm' ).on( 'change keyup paste', function() {
|
27 |
+
$( '#db-reset-submit' ).prop( 'disabled', $( this ).val() !== $( "#security-code" ).text() );
|
28 |
+
});
|
29 |
+
|
30 |
+
$( '#db-reset-submit' ).on('click', function(e) {
|
31 |
+
e.preventDefault();
|
32 |
+
|
33 |
+
if ( confirm( dbReset.confirmAlert ) ) {
|
34 |
+
$( '#db-reset-form' ).submit();
|
35 |
+
$( '#loader' ).show();
|
36 |
+
}
|
37 |
+
});
|
38 |
+
|
39 |
+
$.fn.showIfSelected = function( selectValue ) {
|
40 |
+
$( this ).toggle( $( "option[value='" + selectValue + "']:selected", tables ).length > 0 );
|
41 |
+
}
|
42 |
+
|
43 |
+
})( jQuery );
|
class-db-reset-admin.php
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'DB_Reset_Admin' ) ) :
|
4 |
+
|
5 |
+
class DB_Reset_Admin {
|
6 |
+
|
7 |
+
private $code;
|
8 |
+
private $nonce;
|
9 |
+
private $notice_error;
|
10 |
+
private $notice_success;
|
11 |
+
private $request;
|
12 |
+
private $resetter;
|
13 |
+
private $user;
|
14 |
+
private $version;
|
15 |
+
private $wp_tables;
|
16 |
+
|
17 |
+
public function __construct( $version ) {
|
18 |
+
$this->resetter = new DB_Resetter();
|
19 |
+
$this->version = $version;
|
20 |
+
|
21 |
+
$this->set_request( $_REQUEST );
|
22 |
+
$this->set_view_variables();
|
23 |
+
}
|
24 |
+
|
25 |
+
private function set_request( array $request ) {
|
26 |
+
$this->request = $request;
|
27 |
+
}
|
28 |
+
|
29 |
+
private function set_view_variables() {
|
30 |
+
$this->set_code();
|
31 |
+
$this->set_nonce();
|
32 |
+
$this->set_user();
|
33 |
+
$this->set_wp_tables();
|
34 |
+
}
|
35 |
+
|
36 |
+
private function set_code() {
|
37 |
+
$this->code = $this->generate_code();
|
38 |
+
}
|
39 |
+
|
40 |
+
private function set_nonce() {
|
41 |
+
$this->nonce = strtolower( str_replace( '_', '-', __CLASS__ ) );
|
42 |
+
}
|
43 |
+
|
44 |
+
private function set_user() {
|
45 |
+
$this->user = $this->resetter->get_user();
|
46 |
+
}
|
47 |
+
|
48 |
+
private function set_wp_tables() {
|
49 |
+
$this->wp_tables = $this->resetter->get_wp_tables();
|
50 |
+
}
|
51 |
+
|
52 |
+
private function generate_code( $length = 5 ) {
|
53 |
+
return substr( md5( time() ), 1, $length );
|
54 |
+
}
|
55 |
+
|
56 |
+
public function run() {
|
57 |
+
add_action( 'admin_init', array( $this, 'reset' ) );
|
58 |
+
add_action( 'admin_menu', array( $this, 'add_tools_menu' ) );
|
59 |
+
}
|
60 |
+
|
61 |
+
public function reset() {
|
62 |
+
if ( $this->form_is_safe_to_submit() ) {
|
63 |
+
try {
|
64 |
+
$this->resetter->set_reactivate( $this->request[ 'db-reset-reactivate-theme-data' ] );
|
65 |
+
$this->resetter->reset( $this->request[ 'db-reset-tables' ] );
|
66 |
+
$this->handle_after_reset();
|
67 |
+
} catch ( Exception $e ) {
|
68 |
+
$this->notice_error = $e->getMessage();
|
69 |
+
}
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
private function form_is_safe_to_submit() {
|
74 |
+
return isset( $this->request['db-reset-code-confirm'] ) &&
|
75 |
+
$this->assert_request_variables_not_empty() &&
|
76 |
+
$this->assert_correct_code();
|
77 |
+
}
|
78 |
+
|
79 |
+
private function handle_after_reset() {
|
80 |
+
if ( empty( $this->request[ 'db-reset-reactivate-theme-data' ] ) ) {
|
81 |
+
wp_redirect( admin_url() );
|
82 |
+
exit;
|
83 |
+
}
|
84 |
+
|
85 |
+
$this->notice_success = __( 'The selected tables were reset', 'wordpress-database-reset' );
|
86 |
+
}
|
87 |
+
|
88 |
+
private function assert_request_variables_not_empty() {
|
89 |
+
$this->set_empty_request_key( 'db-reset-tables', array() );
|
90 |
+
$this->set_empty_request_key( 'db-reset-reactivate-theme-data', false );
|
91 |
+
|
92 |
+
return true;
|
93 |
+
}
|
94 |
+
|
95 |
+
private function set_empty_request_key( $key, $default ) {
|
96 |
+
if ( ! array_key_exists( $key, $this->request ) ) {
|
97 |
+
$this->request[ $key ] = $default;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
private function assert_correct_code() {
|
102 |
+
if ( $this->request['db-reset-code'] !==
|
103 |
+
$this->request['db-reset-code-confirm'] ) {
|
104 |
+
$this->notice_error = __( 'You entered the wrong security code', 'wordpress-database-reset' );
|
105 |
+
return false;
|
106 |
+
}
|
107 |
+
|
108 |
+
return true;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function add_tools_menu() {
|
112 |
+
$plugin_page = add_management_page(
|
113 |
+
__( 'Database Reset', 'wordpress-database-reset' ),
|
114 |
+
__( 'Database Reset', 'wordpress-database-reset' ),
|
115 |
+
'update_core',
|
116 |
+
'database-reset',
|
117 |
+
array( $this, 'render' )
|
118 |
+
);
|
119 |
+
|
120 |
+
add_action( 'load-' . $plugin_page, array( $this, 'load_assets' ) );
|
121 |
+
}
|
122 |
+
|
123 |
+
public function render() {
|
124 |
+
require_once( DB_RESET_PATH . '/views/index.php' );
|
125 |
+
}
|
126 |
+
|
127 |
+
public function load_assets() {
|
128 |
+
$this->load_stylesheets();
|
129 |
+
$this->load_javascript();
|
130 |
+
}
|
131 |
+
|
132 |
+
private function load_stylesheets() {
|
133 |
+
wp_enqueue_style(
|
134 |
+
'bsmselect',
|
135 |
+
plugins_url( 'assets/css/bsmselect.css', __FILE__ ),
|
136 |
+
array(),
|
137 |
+
$this->version
|
138 |
+
);
|
139 |
+
|
140 |
+
wp_enqueue_style(
|
141 |
+
'database-reset',
|
142 |
+
plugins_url( 'assets/css/database-reset.css', __FILE__ ),
|
143 |
+
array('bsmselect'),
|
144 |
+
$this->version
|
145 |
+
);
|
146 |
+
}
|
147 |
+
|
148 |
+
private function load_javascript() {
|
149 |
+
wp_enqueue_script(
|
150 |
+
'bsmselect',
|
151 |
+
plugins_url( 'assets/js/bsmselect.js', __FILE__ ),
|
152 |
+
array( 'jquery' ),
|
153 |
+
$this->version,
|
154 |
+
true
|
155 |
+
);
|
156 |
+
|
157 |
+
wp_enqueue_script(
|
158 |
+
'bsmselect-compatibility',
|
159 |
+
plugins_url( 'assets/js/bsmselect.compatibility.js', __FILE__ ),
|
160 |
+
array( 'bsmselect' ),
|
161 |
+
$this->version,
|
162 |
+
true
|
163 |
+
);
|
164 |
+
|
165 |
+
wp_enqueue_script(
|
166 |
+
'database-reset',
|
167 |
+
plugins_url( 'assets/js/database-reset.js', __FILE__ ),
|
168 |
+
array( 'bsmselect', 'bsmselect-compatibility' ),
|
169 |
+
$this->version,
|
170 |
+
true
|
171 |
+
);
|
172 |
+
|
173 |
+
wp_localize_script(
|
174 |
+
'database-reset',
|
175 |
+
'dbReset',
|
176 |
+
$this->load_javascript_vars()
|
177 |
+
);
|
178 |
+
}
|
179 |
+
|
180 |
+
private function load_javascript_vars() {
|
181 |
+
return array(
|
182 |
+
'confirmAlert' => __( 'Are you sure you want to continue?', 'wordpress-database-reset' ),
|
183 |
+
'selectTable' => __( 'Select Tables', 'wordpress-database-reset' )
|
184 |
+
);
|
185 |
+
}
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
endif;
|
class-db-reset-command.php
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Reset the database tables.
|
5 |
+
*/
|
6 |
+
class DB_Reset_Command extends WP_CLI_Command {
|
7 |
+
|
8 |
+
private $reactivate;
|
9 |
+
private $reporting;
|
10 |
+
|
11 |
+
public function __construct() {
|
12 |
+
$this->resetter = new DB_Resetter();
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Reset the database tables.
|
17 |
+
*
|
18 |
+
* ## OPTIONS
|
19 |
+
*
|
20 |
+
* <tables>
|
21 |
+
* The list of tables to reset
|
22 |
+
*
|
23 |
+
* <reactivate>
|
24 |
+
* Reactivate current theme and plugins after reset?
|
25 |
+
*
|
26 |
+
* ## EXAMPLES
|
27 |
+
* wp reset database
|
28 |
+
* wp reset database --tables='users,posts,comments'
|
29 |
+
* wp reset database --no-reactivate
|
30 |
+
*/
|
31 |
+
public function database( $args, $assoc_args ) {
|
32 |
+
$this->handle_before_reset();
|
33 |
+
$this->reactivate_data( $assoc_args[ 'reactivate' ] );
|
34 |
+
$this->reset( $this->sanitize_input( $assoc_args[ 'tables' ] ) );
|
35 |
+
$this->handle_after_reset();
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Lists the database tables.
|
40 |
+
*
|
41 |
+
* @subcommand list
|
42 |
+
*/
|
43 |
+
public function _list() {
|
44 |
+
$tables = $this->resetter->get_wp_tables();
|
45 |
+
|
46 |
+
foreach( $tables as $key => $value ) {
|
47 |
+
WP_CLI::line( $key );
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
private function handle_before_reset() {
|
52 |
+
$this->disable_error_reporting();
|
53 |
+
}
|
54 |
+
|
55 |
+
private function disable_error_reporting() {
|
56 |
+
$this->reporting = error_reporting();
|
57 |
+
error_reporting( 0 );
|
58 |
+
}
|
59 |
+
|
60 |
+
private function sanitize_input( $string = '' ) {
|
61 |
+
if ( ! empty ( $string ) ) {
|
62 |
+
return explode( ',', preg_replace( '/\s+/', '', $string ) );
|
63 |
+
}
|
64 |
+
|
65 |
+
return array_keys( $this->get_wp_tables() );
|
66 |
+
}
|
67 |
+
|
68 |
+
private function get_wp_tables() {
|
69 |
+
return $this->resetter->get_wp_tables();
|
70 |
+
}
|
71 |
+
|
72 |
+
private function reactivate_data( $string = '' ) {
|
73 |
+
if ( is_null( $string ) ) {
|
74 |
+
$string = 'true';
|
75 |
+
}
|
76 |
+
|
77 |
+
$this->reactivate = ( $string ) ? 'true' : 'false';
|
78 |
+
|
79 |
+
$this->resetter->set_reactivate( $this->reactivate );
|
80 |
+
}
|
81 |
+
|
82 |
+
private function reset( array $tables ) {
|
83 |
+
foreach ( $tables as $key => $value ) {
|
84 |
+
WP_CLI::success( $value );
|
85 |
+
}
|
86 |
+
|
87 |
+
$this->resetter->reset( $tables );
|
88 |
+
$this->output_successful_notice();
|
89 |
+
}
|
90 |
+
|
91 |
+
private function output_successful_notice() {
|
92 |
+
WP_CLI::line( __( 'The selected tables were reset', 'wordpress-database-reset' ) );
|
93 |
+
|
94 |
+
if ( 'true' === $this->reactivate ) {
|
95 |
+
WP_CLI::line( __( 'The current theme and plugins were reactivated','wordpress-database-reset' ) );
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
private function handle_after_reset() {
|
100 |
+
error_reporting( $this->reporting );
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
WP_CLI::add_command( 'reset', 'DB_Reset_Command' );
|
class-db-reset-manager.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'DB_Reset_Manager' ) ) :
|
4 |
+
|
5 |
+
class DB_Reset_Manager {
|
6 |
+
|
7 |
+
private $version;
|
8 |
+
|
9 |
+
public function __construct( $version ) {
|
10 |
+
$this->version = $version;
|
11 |
+
}
|
12 |
+
|
13 |
+
public function run() {
|
14 |
+
if ( is_admin() ) {
|
15 |
+
$this->load_admin();
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
private function load_admin() {
|
20 |
+
$admin = new DB_Reset_Admin( $this->get_version() );
|
21 |
+
$admin->run();
|
22 |
+
}
|
23 |
+
|
24 |
+
private function get_version() {
|
25 |
+
return $this->version;
|
26 |
+
}
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
endif;
|
class-db-resetter.php
ADDED
@@ -0,0 +1,215 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'DB_Resetter' ) ) :
|
4 |
+
|
5 |
+
class DB_Resetter {
|
6 |
+
|
7 |
+
private $backup;
|
8 |
+
private $blog_data;
|
9 |
+
private $theme_data;
|
10 |
+
private $preserved;
|
11 |
+
private $selected;
|
12 |
+
private $reactivate;
|
13 |
+
private $user;
|
14 |
+
private $wp_tables;
|
15 |
+
|
16 |
+
public function __construct() {
|
17 |
+
$this->set_wp_tables();
|
18 |
+
$this->set_user();
|
19 |
+
}
|
20 |
+
|
21 |
+
public function reset( array $tables ) {
|
22 |
+
$this->validate_selected( $tables );
|
23 |
+
$this->set_backup();
|
24 |
+
$this->reinstall();
|
25 |
+
$this->restore_backup();
|
26 |
+
}
|
27 |
+
|
28 |
+
private function validate_selected( array $tables ) {
|
29 |
+
if ( ! empty( $tables ) && is_array( $tables ) ) {
|
30 |
+
$this->selected = array_flip( $tables );
|
31 |
+
return;
|
32 |
+
}
|
33 |
+
|
34 |
+
throw new Exception( __( 'You did not select any database tables', 'wordpress-database-reset' ) );
|
35 |
+
}
|
36 |
+
|
37 |
+
private function set_backup() {
|
38 |
+
$this->set_tables_to_preserve( $this->selected );
|
39 |
+
$this->back_up_tables( $this->preserved );
|
40 |
+
$this->set_blog_data();
|
41 |
+
|
42 |
+
if ( $this->should_restore_theme_data() ) {
|
43 |
+
$this->set_theme_data();
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
private function set_tables_to_preserve( array $tables ) {
|
48 |
+
$this->preserved = array_diff_key( $this->wp_tables, $tables );
|
49 |
+
}
|
50 |
+
|
51 |
+
private function back_up_tables( array $tables ) {
|
52 |
+
global $wpdb;
|
53 |
+
$this->backup = array();
|
54 |
+
|
55 |
+
foreach ( $tables as $table ) {
|
56 |
+
$this->backup[ $table ] = $wpdb->get_results( "SELECT * FROM {$table}" );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
private function set_blog_data() {
|
61 |
+
$this->blog_data = array(
|
62 |
+
'name' => get_option( 'blogname' ),
|
63 |
+
'public' => get_option( 'blog_public' ),
|
64 |
+
'site_url' => get_option( 'siteurl' )
|
65 |
+
);
|
66 |
+
}
|
67 |
+
|
68 |
+
private function should_restore_theme_data() {
|
69 |
+
return ( 'true' === $this->reactivate );
|
70 |
+
}
|
71 |
+
|
72 |
+
private function set_theme_data() {
|
73 |
+
$this->theme_data = array(
|
74 |
+
'active-plugins' => get_option( 'active_plugins' ),
|
75 |
+
'current-theme' => get_option( 'current_theme' ),
|
76 |
+
'stylesheet' => get_option( 'stylesheet' ),
|
77 |
+
'template' => get_option( 'template' )
|
78 |
+
);
|
79 |
+
}
|
80 |
+
|
81 |
+
private function reinstall() {
|
82 |
+
$this->drop_wp_tables();
|
83 |
+
$this->install_wp();
|
84 |
+
$this->update_user_settings();
|
85 |
+
}
|
86 |
+
|
87 |
+
private function drop_wp_tables() {
|
88 |
+
global $wpdb;
|
89 |
+
|
90 |
+
foreach ( $this->wp_tables as $wp_table ) {
|
91 |
+
$wpdb->query( "DROP TABLE {$wp_table}" );
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
private function install_wp() {
|
96 |
+
return db_reset_install(
|
97 |
+
$this->blog_data[ 'name' ],
|
98 |
+
$this->user->user_login,
|
99 |
+
$this->user->user_email,
|
100 |
+
$this->blog_data[ 'public' ],
|
101 |
+
$this->blog_data[ 'site_url' ]
|
102 |
+
);
|
103 |
+
}
|
104 |
+
|
105 |
+
private function update_user_settings() {
|
106 |
+
global $wpdb;
|
107 |
+
|
108 |
+
$wpdb->query(
|
109 |
+
$wpdb->prepare(
|
110 |
+
"UPDATE $wpdb->users
|
111 |
+
SET user_pass = '%s', user_activation_key = ''
|
112 |
+
WHERE ID = '%d'",
|
113 |
+
$this->user->user_pass, $this->user->ID
|
114 |
+
)
|
115 |
+
);
|
116 |
+
|
117 |
+
$this->remove_password_nag( $this->user->ID );
|
118 |
+
}
|
119 |
+
|
120 |
+
private function remove_password_nag( $user_id ) {
|
121 |
+
if ( get_user_meta( $user_id, 'default_password_nag' ) ) {
|
122 |
+
delete_user_meta( $user_id, 'default_password_nag' );
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
private function restore_backup() {
|
127 |
+
$this->delete_backup_table_rows( $this->preserved );
|
128 |
+
$this->restore_backup_tables( $this->backup );
|
129 |
+
$this->remove_user_session_tokens();
|
130 |
+
$this->reset_user_auth_cookie();
|
131 |
+
$this->assert_theme_data_needs_reset();
|
132 |
+
}
|
133 |
+
|
134 |
+
private function delete_backup_table_rows( array $tables ) {
|
135 |
+
global $wpdb;
|
136 |
+
|
137 |
+
foreach ( $tables as $table ) {
|
138 |
+
$wpdb->query( "DELETE FROM {$table}" );
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
private function restore_backup_tables( array $tables ) {
|
143 |
+
global $wpdb;
|
144 |
+
|
145 |
+
foreach ( $tables as $table => $data ) {
|
146 |
+
foreach ( $data as $row ) {
|
147 |
+
$columns = $values = array();
|
148 |
+
|
149 |
+
foreach ( $row as $column => $value ) {
|
150 |
+
$columns[] = $column;
|
151 |
+
$values[] = esc_sql( $value );
|
152 |
+
}
|
153 |
+
|
154 |
+
$wpdb->query( "INSERT INTO $table (" . implode( ', ', $columns ) . ") VALUES ('" . implode( "', '", $values ) . "')" );
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
|
159 |
+
private function remove_user_session_tokens() {
|
160 |
+
if ( get_user_meta( $this->user->ID, 'session_tokens' ) ) {
|
161 |
+
delete_user_meta( $this->user->ID, 'session_tokens' );
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
private function reset_user_auth_cookie() {
|
166 |
+
if ( ! is_command_line() ) {
|
167 |
+
wp_clear_auth_cookie();
|
168 |
+
wp_set_auth_cookie( $this->user->ID );
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
private function assert_theme_data_needs_reset() {
|
173 |
+
if ( $this->should_restore_theme_data() ) {
|
174 |
+
$this->restore_theme_data();
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
private function restore_theme_data() {
|
179 |
+
update_option( 'active_plugins', $this->theme_data['active-plugins'] );
|
180 |
+
update_option( 'template', $this->theme_data['template'] );
|
181 |
+
update_option( 'stylesheet', $this->theme_data['stylesheet'] );
|
182 |
+
|
183 |
+
if ( ! empty( $this->theme_data['current-theme'] ) ) {
|
184 |
+
update_option( 'current_theme', $this->theme_data['current-theme'] );
|
185 |
+
}
|
186 |
+
}
|
187 |
+
|
188 |
+
public function set_reactivate( $with_theme_data ) {
|
189 |
+
$this->reactivate = $with_theme_data;
|
190 |
+
}
|
191 |
+
|
192 |
+
private function set_wp_tables() {
|
193 |
+
global $wpdb;
|
194 |
+
$this->wp_tables = $wpdb->tables();
|
195 |
+
}
|
196 |
+
|
197 |
+
public function get_wp_tables() {
|
198 |
+
return $this->wp_tables;
|
199 |
+
}
|
200 |
+
|
201 |
+
private function set_user() {
|
202 |
+
global $current_user;
|
203 |
+
|
204 |
+
$this->user = ( 0 !== $current_user->ID ) ?
|
205 |
+
wp_get_current_user() :
|
206 |
+
get_userdata( 1 );
|
207 |
+
}
|
208 |
+
|
209 |
+
public function get_user() {
|
210 |
+
return $this->user;
|
211 |
+
}
|
212 |
+
|
213 |
+
}
|
214 |
+
|
215 |
+
endif;
|
init.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 skip the 5 minute installation and reset WordPress's database back to its original state.
|
6 |
+
Version: 3.0
|
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 |
+
define( 'DB_RESET_VERSION', '3.0' );
|
14 |
+
define( 'DB_RESET_PATH', dirname( __FILE__ ) );
|
15 |
+
define( 'DB_RESET_NAME', basename( DB_RESET_PATH ) );
|
16 |
+
define( 'AUTOLOADER', DB_RESET_PATH . '/lib/class-plugin-autoloader.php' );
|
17 |
+
|
18 |
+
require_once( DB_RESET_PATH . '/lib/helpers.php' );
|
19 |
+
|
20 |
+
register_activation_hook( __FILE__, 'db_reset_activate' );
|
21 |
+
|
22 |
+
load_plugin_textdomain( 'wordpress-database-reset', false, DB_RESET_NAME . '/languages/' );
|
23 |
+
|
24 |
+
if ( file_exists( AUTOLOADER ) ) {
|
25 |
+
require_once( AUTOLOADER );
|
26 |
+
new Plugin_Autoloader( DB_RESET_PATH );
|
27 |
+
|
28 |
+
add_action(
|
29 |
+
'wp_loaded',
|
30 |
+
array ( new DB_Reset_Manager( DB_RESET_VERSION ), 'run' )
|
31 |
+
);
|
32 |
+
}
|
33 |
+
|
34 |
+
if ( is_command_line() ) {
|
35 |
+
require_once( __DIR__ . '/class-db-reset-command.php' );
|
36 |
+
}
|
languages/wp-reset-de_DE.mo
DELETED
Binary file
|
languages/wp-reset-de_DE.po
DELETED
@@ -1,114 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-10-11 23:05-0500\n"
|
6 |
-
"PO-Revision-Date: 2013-10-30 22:41+0100\n"
|
7 |
-
"Last-Translator: Ulrich Pogson <grapplerulrich@gmail.com>\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: ../\n"
|
14 |
-
"Language: en\n"
|
15 |
-
"X-Generator: Poedit 1.5.7\n"
|
16 |
-
"X-Poedit-SearchPath-0: .\n"
|
17 |
-
|
18 |
-
#: wp-reset.php:110
|
19 |
-
msgid "You entered the wrong value - please try again"
|
20 |
-
msgstr "Du hast den falschen Wert eingegeben - bitte versuchst du es nochmals"
|
21 |
-
|
22 |
-
#: wp-reset.php:112
|
23 |
-
msgid "The WordPress database has been reset successfully"
|
24 |
-
msgstr "Die WordPress-Datenbank wurde erfolgreich zurückgesetzt"
|
25 |
-
|
26 |
-
#: wp-reset.php:117
|
27 |
-
msgid "Database Reset"
|
28 |
-
msgstr "Database zurücksetzen"
|
29 |
-
|
30 |
-
#: wp-reset.php:118
|
31 |
-
msgid "Please type in (or copy/paste) the generated value into the text box"
|
32 |
-
msgstr ""
|
33 |
-
"Bitte gibst du (oder kopieren / einfügen) den generierten Wert in das "
|
34 |
-
"Textfeld ein"
|
35 |
-
|
36 |
-
#: wp-reset.php:123
|
37 |
-
msgid "Reset Database"
|
38 |
-
msgstr "Datenbank zurücksetzen"
|
39 |
-
|
40 |
-
#: wp-reset.php:127
|
41 |
-
msgid "Reactivate current plugins after reset?"
|
42 |
-
msgstr "Aktuelle Plugins nach dem Zurücksetzen reaktivieren?"
|
43 |
-
|
44 |
-
#: wp-reset.php:133
|
45 |
-
#, php-format
|
46 |
-
msgid ""
|
47 |
-
"The default user <strong><u>admin</u></strong> was never created for this "
|
48 |
-
"WordPress install. So <strong><u>%s</u></strong> will be recreated with its "
|
49 |
-
"current password instead"
|
50 |
-
msgstr ""
|
51 |
-
"Der Standard-Benutzername <strong><u>admin</ u></ strong> wurde nie für "
|
52 |
-
"diese WordPress Installation erstellt. So wird <strong><u>% s </ u></ "
|
53 |
-
"strong> dafür mit seinem aktuellen Kennwort erstellt"
|
54 |
-
|
55 |
-
#: wp-reset.php:135
|
56 |
-
msgid ""
|
57 |
-
"The default user <strong><u>admin</u></strong> will be recreated with its "
|
58 |
-
"current password upon resetting"
|
59 |
-
msgstr ""
|
60 |
-
"Der Standardbenutzer <strong><u>admin</ u></ strong> wird mit seinem "
|
61 |
-
"aktuellen Kennwort nach die Rücksetzung erstellt"
|
62 |
-
|
63 |
-
#: wp-reset.php:138
|
64 |
-
msgid ""
|
65 |
-
"Note that once you reset the database, all users will be deleted except the "
|
66 |
-
"initial admin user."
|
67 |
-
msgstr ""
|
68 |
-
"Bitte beachten, dass wenn du die Datenbank zurückzusetzt, werden alle "
|
69 |
-
"Benutzer mit Ausnahme der ersten Admin Benutzer gelöscht."
|
70 |
-
|
71 |
-
#: wp-reset.php:154
|
72 |
-
msgid ""
|
73 |
-
"Clicking OK will result in your database being reset to its initial "
|
74 |
-
"settings. Continue?"
|
75 |
-
msgstr ""
|
76 |
-
"Beim auf OK klicken wird die Datenbank zurückgesetzt zu seine ursprünglichen "
|
77 |
-
"Einstellungen. Weiterfahren?"
|
78 |
-
|
79 |
-
#: wp-reset.php:194
|
80 |
-
msgid ""
|
81 |
-
"Have any cool ideas for this plugin? Contact me either by <a href=\"http://"
|
82 |
-
"twitter.com/#!/chrisberthe\">Twitter</a> or by <a href=\"https://github.com/"
|
83 |
-
"chrisberthe\">GitHub</a>."
|
84 |
-
msgstr ""
|
85 |
-
"Haben Sie coole Ideen für dieses Plugin? Kontaktieren Sie mich entweder auf "
|
86 |
-
"<a href=\"http://twitter.com/#!/chrisberthe\">Twitter</ a> oder <a href="
|
87 |
-
"\"https://github.com/chrisberthe\">GitHub</ a>."
|
88 |
-
|
89 |
-
#: wp-reset.php:195
|
90 |
-
msgid ""
|
91 |
-
"If this plugin becomes non-functional in any way due to WordPress upgrades, "
|
92 |
-
"rest assured I will update it."
|
93 |
-
msgstr ""
|
94 |
-
"Wenn dieses Plugin wird nicht-funktionieren in irgendeiner Weise durch die "
|
95 |
-
"WordPress Upgrades, sei dir versichert, dass ich es aktualisieren werde ."
|
96 |
-
|
97 |
-
#: wp-reset.php:196
|
98 |
-
msgid "Goodbye for now."
|
99 |
-
msgstr "Auf Wiedersehen!"
|
100 |
-
|
101 |
-
#: wp-reset.php:250
|
102 |
-
msgid "WordPress Database Reset"
|
103 |
-
msgstr "WordPress Database Reset"
|
104 |
-
|
105 |
-
#: wp-reset.php:251
|
106 |
-
msgid ""
|
107 |
-
"The WordPress database has been successfully reset to its default settings:"
|
108 |
-
msgstr ""
|
109 |
-
"Die WordPress-Datenbank wurde erfolgreich zu die Standardeinstellungen "
|
110 |
-
"zurückzusetzt"
|
111 |
-
|
112 |
-
#: wp-reset.php:252
|
113 |
-
msgid "Password: The password you chose during the install."
|
114 |
-
msgstr "Passwort: Das Passwort, das du während der Installation gewählt hast."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/wp-reset-fr_FR.mo
DELETED
Binary file
|
languages/wp-reset-fr_FR.po
DELETED
@@ -1,222 +0,0 @@
|
|
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-pt_BR.mo
DELETED
Binary file
|
languages/wp-reset-pt_BR.po
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: WordPress Database Reset\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-11-08 02:00-0300\n"
|
6 |
-
"PO-Revision-Date: 2011-11-08 06:20-0300\n"
|
7 |
-
"Last-Translator: Fernando Lopes <contato@fernandolopes.com.br>\n"
|
8 |
-
"Language-Team: Fernando Lopes <contato@fernandolopes.com.br>\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-Poedit-Language: Portuguese\n"
|
15 |
-
"X-Poedit-Country: BRAZIL\n"
|
16 |
-
"X-Poedit-SearchPath-0: .\n"
|
17 |
-
"X-Poedit-SearchPath-1: ..\n"
|
18 |
-
|
19 |
-
#: wp-reset.php:156
|
20 |
-
#: ../wordpress-database-reset/wp-reset.php:156
|
21 |
-
msgid "You entered the wrong value - please try again"
|
22 |
-
msgstr "Você digitou o valor errado - por favor tente novamente"
|
23 |
-
|
24 |
-
#: wp-reset.php:158
|
25 |
-
#: ../wordpress-database-reset/wp-reset.php:158
|
26 |
-
msgid "You did not select any database tables"
|
27 |
-
msgstr "Você não selecionou nenhuma tabela do banco de dados"
|
28 |
-
|
29 |
-
#: wp-reset.php:160
|
30 |
-
#: ../wordpress-database-reset/wp-reset.php:160
|
31 |
-
msgid "The WordPress database has been reset successfully"
|
32 |
-
msgstr "O banco de dados do WordPress foi reiniciado com sucesso"
|
33 |
-
|
34 |
-
#: wp-reset.php:165
|
35 |
-
#: ../wordpress-database-reset/wp-reset.php:165
|
36 |
-
msgid "Database Reset"
|
37 |
-
msgstr "Reiniciar Banco de Dados"
|
38 |
-
|
39 |
-
#: wp-reset.php:167
|
40 |
-
#: ../wordpress-database-reset/wp-reset.php:167
|
41 |
-
msgid "Please choose from the following database tables the ones you would like to reset"
|
42 |
-
msgstr "Por favor, escolha a partir das tabelas do banco de dados abaixo o que você gostaria de reiniciar"
|
43 |
-
|
44 |
-
#: wp-reset.php:169
|
45 |
-
#: ../wordpress-database-reset/wp-reset.php:169
|
46 |
-
msgid "Select All"
|
47 |
-
msgstr "Selecionar Tudas"
|
48 |
-
|
49 |
-
#: wp-reset.php:176
|
50 |
-
#: ../wordpress-database-reset/wp-reset.php:176
|
51 |
-
msgid "Type in (or copy/paste) the generated value into the text box"
|
52 |
-
msgstr "Digite (ou copie/cole) o valor gerado na caixa de texto"
|
53 |
-
|
54 |
-
#: wp-reset.php:180
|
55 |
-
#: ../wordpress-database-reset/wp-reset.php:180
|
56 |
-
msgid "Reset Database"
|
57 |
-
msgstr "Reiniciar Banco de Dados"
|
58 |
-
|
59 |
-
#: wp-reset.php:186
|
60 |
-
#: ../wordpress-database-reset/wp-reset.php:186
|
61 |
-
msgid "Reactivate current plugins after reset?"
|
62 |
-
msgstr "Reativar os plugins atuais depois de reiniciar?"
|
63 |
-
|
64 |
-
#: wp-reset.php:193
|
65 |
-
#: ../wordpress-database-reset/wp-reset.php:193
|
66 |
-
#, php-format
|
67 |
-
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"
|
68 |
-
msgstr "O usuário padrão <strong><u>admin</u></strong>, nunca foi criado nesta instalação do WordPress. Então, o usuário <strong><u>%s</u></strong> será recriado com a sua senha atual"
|
69 |
-
|
70 |
-
#: wp-reset.php:195
|
71 |
-
#: ../wordpress-database-reset/wp-reset.php:195
|
72 |
-
msgid "The default user <strong><u>admin</u></strong> will be recreated with its current password upon resetting"
|
73 |
-
msgstr "O usuário padrão <strong><u>admin</u></strong> será recriado com sua senha atual mediante a reinicialização"
|
74 |
-
|
75 |
-
#: wp-reset.php:198
|
76 |
-
#: ../wordpress-database-reset/wp-reset.php:198
|
77 |
-
msgid "Note that once you reset the database, all users will be deleted except the initial admin user."
|
78 |
-
msgstr "Note que, uma vez que você reiniciar o banco de dados, todos os usuários serão apagados, exceto o usuário <strong><u>admin</u></strong> inicial."
|
79 |
-
|
80 |
-
#: wp-reset.php:216
|
81 |
-
#: ../wordpress-database-reset/wp-reset.php:216
|
82 |
-
msgid "Select Table"
|
83 |
-
msgstr "Selecionar Tabela"
|
84 |
-
|
85 |
-
#: wp-reset.php:226
|
86 |
-
#: ../wordpress-database-reset/wp-reset.php:226
|
87 |
-
msgid "Clicking OK will result in your database being reset to its initial settings. Continue?"
|
88 |
-
msgstr "Clicar em OK fará com que o banco de dados seja reiniciado para as configurações iniciais. Continuar?"
|
89 |
-
|
90 |
-
#: wp-reset.php:273
|
91 |
-
#: ../wordpress-database-reset/wp-reset.php:273
|
92 |
-
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>."
|
93 |
-
msgstr "Tem alguma idéia legal para este plugin? Entre em contato comigo pelo <a href=\"http://twitter.com/#!/chrisberthe\">Twitter</a> ou pelo <a href=\"https://github.com/chrisberthe\">GitHub</a>."
|
94 |
-
|
95 |
-
#: wp-reset.php:274
|
96 |
-
#: ../wordpress-database-reset/wp-reset.php:274
|
97 |
-
msgid "If this plugin becomes non-functional in any way due to WordPress upgrades, rest assured I will update it."
|
98 |
-
msgstr "Se este plugin se tornar não-funcional de alguma forma devido a upgrades WordPress, eu vou atualizá-lo."
|
99 |
-
|
100 |
-
#: wp-reset.php:275
|
101 |
-
#: ../wordpress-database-reset/wp-reset.php:275
|
102 |
-
msgid "Goodbye for now."
|
103 |
-
msgstr "Adeus por agora."
|
104 |
-
|
105 |
-
#: wp-reset.php:345
|
106 |
-
#: ../wordpress-database-reset/wp-reset.php:345
|
107 |
-
msgid "WordPress Database Reset"
|
108 |
-
msgstr "WordPress Reiniciar Banco de Dados"
|
109 |
-
|
110 |
-
#: wp-reset.php:346
|
111 |
-
#: ../wordpress-database-reset/wp-reset.php:346
|
112 |
-
msgid "The tables you selected have been successfully reset to their default settings:"
|
113 |
-
msgstr "As tabelas selecionadas foram reiniciadas com sucesso para suas configurações padrão:"
|
114 |
-
|
115 |
-
#: wp-reset.php:347
|
116 |
-
#: ../wordpress-database-reset/wp-reset.php:347
|
117 |
-
msgid "Password: The password you chose during the install."
|
118 |
-
msgstr "Senha: A senha que você escolheu durante a instalação."
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages/wp-reset.pot
DELETED
@@ -1,172 +0,0 @@
|
|
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 ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/class-plugin-autoloader.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( ! class_exists( 'Plugin_Autoloader' ) ) :
|
4 |
+
|
5 |
+
class Plugin_Autoloader {
|
6 |
+
|
7 |
+
public $directory = __DIR__;
|
8 |
+
|
9 |
+
public function __construct( $directory = '' ) {
|
10 |
+
$this->set_directory( $directory );
|
11 |
+
spl_autoload_register( array( $this, 'autoload' ) );
|
12 |
+
}
|
13 |
+
|
14 |
+
public function set_directory( $directory ) {
|
15 |
+
if ( ! empty( $directory ) ) {
|
16 |
+
$this->directory = $directory;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
|
20 |
+
public function autoload( $class ) {
|
21 |
+
$file = $this->directory . '/class-' . strtolower( str_replace( '_', '-', $class ) ) . '.php';
|
22 |
+
$this->get_class( $file );
|
23 |
+
}
|
24 |
+
|
25 |
+
private function get_class( $file ) {
|
26 |
+
if ( file_exists( $file ) ) {
|
27 |
+
require_once( $file );
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
}
|
32 |
+
|
33 |
+
endif;
|
lib/helpers.php
ADDED
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Check for command line constant
|
5 |
+
*/
|
6 |
+
function is_command_line() {
|
7 |
+
return ( defined( 'WP_CLI' ) && WP_CLI );
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Activation process
|
12 |
+
* @return bool Should we proceed with plugin activation?
|
13 |
+
*/
|
14 |
+
function db_reset_activate() {
|
15 |
+
$status = db_reset_activation_checks();
|
16 |
+
|
17 |
+
if ( is_string( $status ) ) {
|
18 |
+
db_reset_cancel_activation( $status );
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Check for minimum plugin requirements
|
24 |
+
* @return string|bool Error message if fails or boolean true if passes
|
25 |
+
*/
|
26 |
+
function db_reset_activation_checks() {
|
27 |
+
if ( ! function_exists( 'spl_autoload_register' ) &&
|
28 |
+
version_compare( phpversion(), '5.3', '<' ) ) {
|
29 |
+
return __( 'The WordPress Database Reset plugin requires at least PHP 5.3!', 'wordpress-database-reset' );
|
30 |
+
}
|
31 |
+
|
32 |
+
if ( version_compare( get_bloginfo( 'version' ), '3.0', '<' ) ) {
|
33 |
+
return __( 'The WordPress Database Reset plugin requires at least WordPress 3.0!', 'wordpress-database-reset' );
|
34 |
+
}
|
35 |
+
|
36 |
+
return true;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Cancel activation and kill process
|
41 |
+
* @param string $message Error message
|
42 |
+
* @return void
|
43 |
+
*/
|
44 |
+
function db_reset_cancel_activation( $message ) {
|
45 |
+
deactivate_plugins( __FILE__ );
|
46 |
+
wp_die( $message );
|
47 |
+
}
|
48 |
+
|
49 |
+
// Ewww. Still need it though.
|
50 |
+
require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Installs the site.
|
54 |
+
*
|
55 |
+
* This is a copied and pasted version from /wp-admin/includes/upgrade.php.
|
56 |
+
* Why am I doing this? Because there's no way of hooking into the WP install
|
57 |
+
* method to stop the 'new blog' email from firing.
|
58 |
+
*
|
59 |
+
* Also, through the command line, the call to wp_guess_url() doesn't work
|
60 |
+
* and returns an empty value. We must pass the siteurl option to this
|
61 |
+
* function in order to be able to reset the options table without it
|
62 |
+
* completely breaking the site.
|
63 |
+
*
|
64 |
+
* @since 2.1.0
|
65 |
+
*
|
66 |
+
* @param string $blog_title Blog title.
|
67 |
+
* @param string $user_name User's username.
|
68 |
+
* @param string $user_email User's email.
|
69 |
+
* @param bool $public Whether blog is public.
|
70 |
+
* @param string $deprecated Optional. Not used.
|
71 |
+
* @param string $user_password Optional. User's chosen password. Default empty (random password).
|
72 |
+
* @param string $language Optional. Language chosen. Default empty.
|
73 |
+
* @return array Array keys 'url', 'user_id', 'password', and 'password_message'.
|
74 |
+
*/
|
75 |
+
function db_reset_install( $blog_title, $user_name, $user_email, $public, $site_url, $deprecated = '', $user_password = '', $language = '' ) {
|
76 |
+
if ( ! empty( $deprecated ) )
|
77 |
+
_deprecated_argument( __FUNCTION__, '2.6' );
|
78 |
+
|
79 |
+
wp_check_mysql_version();
|
80 |
+
wp_cache_flush();
|
81 |
+
make_db_current_silent();
|
82 |
+
populate_options();
|
83 |
+
populate_roles();
|
84 |
+
|
85 |
+
update_option( 'blogname', $blog_title );
|
86 |
+
update_option( 'admin_email', $user_email );
|
87 |
+
update_option( 'blog_public', $public );
|
88 |
+
|
89 |
+
if ( $language ) {
|
90 |
+
update_option( 'WPLANG', $language );
|
91 |
+
}
|
92 |
+
|
93 |
+
$guessurl = ( wp_guess_url() !== 'http:' ) ? wp_guess_url() : $site_url;
|
94 |
+
|
95 |
+
update_option( 'siteurl', $guessurl );
|
96 |
+
update_option( 'home', $guessurl );
|
97 |
+
|
98 |
+
// If not a public blog, don't ping.
|
99 |
+
if ( ! $public )
|
100 |
+
update_option( 'default_pingback_flag', 0 );
|
101 |
+
|
102 |
+
/*
|
103 |
+
* Create default user. If the user already exists, the user tables are
|
104 |
+
* being shared among blogs. Just set the role in that case.
|
105 |
+
*/
|
106 |
+
$user_id = username_exists( $user_name );
|
107 |
+
$user_password = trim( $user_password );
|
108 |
+
$email_password = false;
|
109 |
+
if ( ! $user_id && empty( $user_password ) ) {
|
110 |
+
$user_password = wp_generate_password( 12, false );
|
111 |
+
$message = __( '<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.' );
|
112 |
+
$user_id = wp_create_user( $user_name, $user_password, $user_email );
|
113 |
+
update_user_option( $user_id, 'default_password_nag', true, true );
|
114 |
+
$email_password = true;
|
115 |
+
} elseif ( ! $user_id ) {
|
116 |
+
// Password has been provided
|
117 |
+
$message = '<em>'.__( 'Your chosen password.' ).'</em>';
|
118 |
+
$user_id = wp_create_user( $user_name, $user_password, $user_email );
|
119 |
+
} else {
|
120 |
+
$message = __( 'User already exists. Password inherited.' );
|
121 |
+
}
|
122 |
+
|
123 |
+
$user = new WP_User( $user_id );
|
124 |
+
$user->set_role( 'administrator' );
|
125 |
+
|
126 |
+
wp_install_defaults( $user_id );
|
127 |
+
|
128 |
+
wp_install_maybe_enable_pretty_permalinks();
|
129 |
+
|
130 |
+
flush_rewrite_rules();
|
131 |
+
|
132 |
+
wp_cache_flush();
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Fires after a site is fully installed.
|
136 |
+
*
|
137 |
+
* @since 3.9.0
|
138 |
+
*
|
139 |
+
* @param WP_User $user The site owner.
|
140 |
+
*/
|
141 |
+
do_action( 'wp_install', $user );
|
142 |
+
|
143 |
+
return array( 'url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message );
|
144 |
+
}
|
readme.txt
CHANGED
@@ -1,83 +1,110 @@
|
|
1 |
-
=== WordPress Database Reset ===
|
2 |
-
|
3 |
-
Contributors: mousesports
|
4 |
-
Tags: wordpress, database,
|
5 |
-
License: GPL2
|
6 |
-
Requires at least: 3.0
|
7 |
-
Tested up to: 4.2.2
|
8 |
-
Stable tag:
|
9 |
-
|
10 |
-
A
|
11 |
-
|
12 |
-
== Description ==
|
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 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WordPress Database Reset ===
|
2 |
+
|
3 |
+
Contributors: mousesports
|
4 |
+
Tags: wordpress, database, reset, restore, setup, developer, theme, default, secure
|
5 |
+
License: GPL2
|
6 |
+
Requires at least: 3.0
|
7 |
+
Tested up to: 4.2.2
|
8 |
+
Stable tag: 3.0
|
9 |
+
|
10 |
+
A plugin that allows you to skip the 5 minute installation and reset WordPress's database back to its original state.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
**Overview**
|
15 |
+
|
16 |
+
The WordPress Database Reset plugin allows you to reset the database back to its default settings without having to go through the WordPress 5 minute installation.
|
17 |
+
|
18 |
+
**Features**
|
19 |
+
|
20 |
+
* Extremely fast one click process to reset the WordPress database
|
21 |
+
* Choose to reset the entire database or specific database tables
|
22 |
+
* Secure and super simple to use
|
23 |
+
* Prefer the command line? Reset the database in one command
|
24 |
+
* Excellent for theme and plugin developers who need to clean the database of any unnecessary content
|
25 |
+
|
26 |
+
**Command Line**
|
27 |
+
|
28 |
+
Once activated, you can use the WordPress Database Reset plugin with [WordPress CLI](http://wp-cli.org/).
|
29 |
+
Full documentation for the commands can be found on [the code repository](https://github.com/chrisberthe/wordpress-database-reset#command-line)
|
30 |
+
|
31 |
+
**Support Forum**
|
32 |
+
|
33 |
+
Create a new post in the [WordPress Database Reset support forum](https://wordpress.org/support/plugin/wordpress-database-reset).
|
34 |
+
|
35 |
+
**Want to help out?**
|
36 |
+
|
37 |
+
* Provide new language translations - [read this tutorial](http://weblogtoolscollection.com/archives/2007/08/27/localizing-a-wordpress-plugin-using-poedit/) or use the [online PO Editor](https://poeditor.com/).
|
38 |
+
* Help develop the plugin by forking [the code repository](https://github.com/chrisberthe/wordpress-database-reset) on GitHub.
|
39 |
+
* Want to help others that might be having issues? [Answer questions on the support forum](https://wordpress.org/support/plugin/wordpress-database-reset).
|
40 |
+
* If you love this plugin and would like to make a donation: 1. You're awesome and 2. You can find the donate button on the plugin page.
|
41 |
+
|
42 |
+
== Screenshots ==
|
43 |
+
1. The WordPress Database Reset plugin page
|
44 |
+
|
45 |
+
== Changelog ==
|
46 |
+
= 3.0.0 =
|
47 |
+
* Completely re-written from scratch
|
48 |
+
* Add extended WP_CLI command class
|
49 |
+
* Clean up admin interface
|
50 |
+
* Remove unnecessary help tabs
|
51 |
+
* Submit button is now deactivated until user inputs security code
|
52 |
+
* Add PayPal donation button
|
53 |
+
* Remove outdated localization files
|
54 |
+
* Update the text domain to match slug for translate.wordpress.org
|
55 |
+
|
56 |
+
= 2.3.2 =
|
57 |
+
* Add option to keep active theme, thanks to Ulrich Pogson
|
58 |
+
* Adhere to WordPress PHP coding syntax standards
|
59 |
+
* Delete the user session and recreate it
|
60 |
+
* Separate the backup_tables method into two new methods
|
61 |
+
* Reset only WP tables and not custom tables
|
62 |
+
* French language updates, thanks to Fx Benard
|
63 |
+
* Fix for undefined variable: backup_tables
|
64 |
+
|
65 |
+
= 2.3.1 =
|
66 |
+
* Fixed bug where reactivate plugins div was not displaying on 'options' table select
|
67 |
+
|
68 |
+
= 2.3 =
|
69 |
+
* Removed deprecated function $wpdb->escape(), replaced with esc_sql()
|
70 |
+
* Add German translation, thanks to Ulrich Pogson
|
71 |
+
* Updated screenshot-1.png
|
72 |
+
* Renamed default localization file
|
73 |
+
* Fixed broken if conditional during code clean up for version 2.2
|
74 |
+
|
75 |
+
= 2.2 =
|
76 |
+
* Fixed scripts and styles to only load on plugin page
|
77 |
+
* Formatted code to meet WordPress syntax standards
|
78 |
+
|
79 |
+
= 2.1 =
|
80 |
+
* Replaced 3.3 deprecated get_userdatabylogin() with get_user_by()
|
81 |
+
* Updated deprecated add_contextual_help() with add_help_tab()
|
82 |
+
* Small change in condition check for backup tables
|
83 |
+
* Removed custom _rand_string() with core wp_generate_password()
|
84 |
+
* Added Portuguese translation - thanks to Fernando Lopes
|
85 |
+
|
86 |
+
= 2.0 =
|
87 |
+
* Added functionality to be able to select which tables you want to reset, rather than having to reset the entire database.
|
88 |
+
* Added bsmSelect for the multiple select.
|
89 |
+
* Modified screenshot-1.png.
|
90 |
+
* Fixed redirect bug
|
91 |
+
* 'Reactivate current plugins after reset' only shows if the options table is selected from the dropdown.
|
92 |
+
|
93 |
+
= 1.4 =
|
94 |
+
* Made quite a few changes to the translation files
|
95 |
+
* Renamed french translation file for plugin format, not theme format
|
96 |
+
* Optimized (until potential version 2.0)
|
97 |
+
|
98 |
+
= 1.3 =
|
99 |
+
* Replaced reactivation option for all currently active plugins (not just this plugin)
|
100 |
+
* Updated language files
|
101 |
+
|
102 |
+
= 1.2 =
|
103 |
+
* Added capability to manually select whether or not plugin should be reactivated upon reset
|
104 |
+
* Modified class name to avoid potential conflicts with WordPress core
|
105 |
+
* Modified wp_mail override
|
106 |
+
* Removed deprecated user level for WordPress 3.0+
|
107 |
+
* Fixed small bug where if admin user did not have admin capabilities, it would tell the user they did
|
108 |
+
|
109 |
+
= 1.0 =
|
110 |
+
* First version
|
screenshot-1.png
CHANGED
Binary file
|
views/index.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wrap card">
|
2 |
+
<h2><?php _e( 'Database Reset', 'wordpress-database-reset' ) ?></h2>
|
3 |
+
|
4 |
+
<?php include( 'partials/notice.php' ) ?>
|
5 |
+
|
6 |
+
<form method="post" id="db-reset-form">
|
7 |
+
<?php include( 'partials/select-tables.php' ) ?>
|
8 |
+
<?php include( 'partials/security-code.php' ) ?>
|
9 |
+
<?php include( 'partials/submit-button.php' ) ?>
|
10 |
+
</form>
|
11 |
+
|
12 |
+
<?php include( 'partials/donate.php' ) ?>
|
13 |
+
</div>
|
views/partials/disclaimer.php
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
<p id="disclaimer" style="display: none">
|
2 |
+
<em><?php printf( __( 'You selected the users table. Only the <strong><u>%s</u></strong> user will be restored', 'wordpress-database-reset' ), $this->user->user_login ) ?>.</em>
|
3 |
+
</p>
|
views/partials/donate.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
2 |
+
<input type="hidden" name="cmd" value="_s-xclick">
|
3 |
+
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHLwYJKoZIhvcNAQcEoIIHIDCCBxwCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYCdj0VyUeQ45dbveTJSqo8qF8PCgPCdRMUUuRCMsfdkVlkYPhVREf4StuXFWzYjNsCYAcROCmOf2cmbIwHsw+mrbGcEs3ruqplz7SuWJBnpl6gbi7r4NGIggZblej1Efq0eT7qAnoF/8gOGz3WB2W9UQ2bP+nKp/zoiVw9sMHe8XzELMAkGBSsOAwIaBQAwgawGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIwjHjEMrQMiKAgYi5qz3K+xtyTCLK1Z0AqxabLWTRR0Dd/fm5aT5zX3F9SpHk/xfDx702Phh/v2FymJKm66Ll4IR8ooKn459b0rZUw187SB56ZyaH/El/K71uEctky5m3MhLPs4WvAoJmvDL190HUmq/0hrTTkV+/ctR1zJtGbKV/NVkejRSx+MIex/fPSkH3J6hdoIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTUwNzE5MDQ0MTAyWjAjBgkqhkiG9w0BCQQxFgQUuszkAdsdwqRpEggBZFgD5T8e7tAwDQYJKoZIhvcNAQEBBQAEgYAMU9e/azraOkPXlSHGh9ySEXNhijjHo7ihNDDlr9IY9NT7PPytMtgMgjXupe9cERonDsEho8Li3viET4LctEKncmcsv98yYoteluCp0d8sER+MMRtAk4G5tXZ+bSvETjAMQz6kUCWlfYHNWLQ6v8dNX9nLAXyPg4DlpX998TANgg==-----END PKCS7-----
|
4 |
+
">
|
5 |
+
<input type="image" src="<?php echo plugins_url( 'assets/images/donate.png', dirname( __DIR__ ) ) ?>" border="0" name="submit" id="donate-button" alt="PayPal - The safer, easier way to pay online!">
|
6 |
+
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
7 |
+
</form>
|
views/partials/notice.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( $this->notice_success ) : ?>
|
2 |
+
<div class="updated notice is-dismissible">
|
3 |
+
<p><strong><?php echo $this->notice_success ?>.</strong></p>
|
4 |
+
</div>
|
5 |
+
<?php elseif ( $this->notice_error ) : ?>
|
6 |
+
<div class="error notice is-dismissible">
|
7 |
+
<p><strong><?php echo $this->notice_error ?>.</strong></p>
|
8 |
+
</div>
|
9 |
+
<?php endif ?>
|
views/partials/security-code.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
2. <?php _e( 'Enter the security code into the text box', 'wordpress-database-reset' ) ?>:
|
3 |
+
<span id="security-code"><?php echo $this->code ?></span>
|
4 |
+
</p>
|
5 |
+
|
6 |
+
<input type="hidden" name="db-reset-code" value="<?php echo $this->code ?>" />
|
7 |
+
<input type="text" name="db-reset-code-confirm" id="db-reset-code-confirm" value="" placeholder="*****" />
|
views/partials/select-tables.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<p>1. <?php _e( 'Select the database tables you would like to reset', 'wordpress-database-reset' ) ?>:</p>
|
2 |
+
|
3 |
+
<div id="select-container">
|
4 |
+
<a href='#' id="select-all"><?php _e( 'Select All', 'wordpress-database-reset' ) ?></a>
|
5 |
+
<select id="wp-tables" multiple="multiple" name="db-reset-tables[]">
|
6 |
+
<?php foreach ( $this->wp_tables as $key => $value ) : ?>
|
7 |
+
<option value="<?php echo $key ?>"><?php echo $key ?></option>
|
8 |
+
<?php endforeach ?>
|
9 |
+
</select>
|
10 |
+
</div>
|
11 |
+
|
12 |
+
<p id="reactivate" style="display: none">
|
13 |
+
<label for="db-reset-reactivate-theme-data">
|
14 |
+
<input type="checkbox" name="db-reset-reactivate-theme-data" id="db-reset-reactivate-theme-data" checked="checked" value="true" />
|
15 |
+
<?php _e( 'Reactivate current theme and plugins after reset?', 'wordpress-database-reset' ) ?>
|
16 |
+
</label>
|
17 |
+
</p>
|
18 |
+
|
19 |
+
<?php include( 'disclaimer.php' ) ?>
|
20 |
+
|
21 |
+
<hr>
|
views/partials/submit-button.php
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
<p>
|
2 |
+
<input type="submit" name="db-reset-submit" value="<?php _e( 'Reset Tables', 'wordpress-database-reset' ) ?>" id="db-reset-submit" class="button-primary" disabled />
|
3 |
+
<img src="<?php echo plugins_url( 'assets/images/spinner.gif', dirname( __DIR__ ) ) ?>" alt="loader" id="loader" style="display: none" />
|
4 |
+
</p>
|