| 1 |
<h2 class="lws_tk_mysql_title_text"> <?php esc_html_e('MySQL Reports', 'lws-tools'); ?> |
| 2 |
</h2> |
| 3 |
|
| 4 |
<table class="lws_tk_mysqltable" id="lws_tk_mysqltable" style="width:100%"> |
| 5 |
<thead class="lws_tk_tab_line_mysql"> |
| 6 |
<td class="lws_tk_tdmysql_tr"><?php esc_html_e('Name', 'lws-tools'); ?> |
| 7 |
</td> |
| 8 |
<td class="lws_tk_tdmysql_tr"><?php esc_html_e('Size', 'lws-tools'); ?> |
| 9 |
</td> |
| 10 |
<td class="lws_tk_tdmysql_tr"><?php esc_html_e('Charset', 'lws-tools'); ?> |
| 11 |
</td> |
| 12 |
<td class="lws_tk_tdmysql_tr"><?php esc_html_e('Engine', 'lws-tools'); ?> |
| 13 |
</td> |
| 14 |
<td class="lws_tk_tdmysql_tr"><?php esc_html_e('Table created on', 'lws-tools'); ?> |
| 15 |
</td> |
| 16 |
</thead> |
| 17 |
<tbody> |
| 18 |
<?php foreach ($list_tables as $table) : ?> |
| 19 |
<tr class="lws_tk_tr_mysql"> |
| 20 |
<td class="lws_tk_tdmysql" style="width:30%"> |
| 21 |
<?php echo(wordwrap(esc_html($table['name'], 40, "<br>", true))); ?> |
| 22 |
</td> |
| 23 |
<td class="lws_tk_tdmysql" style="width:15%"> |
| 24 |
<?php echo(esc_html($table['size'])); ?> |
| 25 |
</td> |
| 26 |
<td class="lws_tk_tdmysql" style="width:20%"> |
| 27 |
<?php echo(esc_html($table['charset'])); ?> |
| 28 |
</td> |
| 29 |
<td class="lws_tk_tdmysql" style="width:15%"> |
| 30 |
<?php echo(esc_html($table['engine'])); ?> |
| 31 |
</td> |
| 32 |
<td class="lws_tk_tdmysql" style="padding-right:0px"> |
| 33 |
<?php echo(esc_html(explode(' ', $table['created'])[0])); ?> |
| 34 |
</td> |
| 35 |
</tr> |
| 36 |
<?php endforeach ?> |
| 37 |
</tbody> |
| 38 |
</table> |
| 39 |
|
| 40 |
<?php if (is_plugin_active('wps-bidouille/wps-bidouille.php')) : ?> |
| 41 |
<div class="error"> |
| 42 |
<?php esc_html_e('You are using WPS Bidouille. Due to conflicts, you cannot use thoses functions while it is activated.', 'lws-tools'); ?> |
| 43 |
</div> |
| 44 |
<script> |
| 45 |
jQuery(document).ready(function() { |
| 46 |
jQuery('#lws_tk_repair').prop('disabled', true); |
| 47 |
jQuery('#lws_tk_repair').removeClass('lws_tk_general_install_button'); |
| 48 |
jQuery('#lws_tk_repair').addClass('lws_tk_general_install_button_mysql'); |
| 49 |
|
| 50 |
jQuery('#lws_tk_optimise').removeClass('lws_tk_general_install_button'); |
| 51 |
jQuery('#lws_tk_optimise').addClass('lws_tk_general_install_button_mysql'); |
| 52 |
jQuery('#lws_tk_optimise').prop('disabled', true); |
| 53 |
}); |
| 54 |
</script> |
| 55 |
<?php endif ?> |
| 56 |
|
| 57 |
<h2 class="lws_tk_title_repair"><?php esc_html_e('Repair or Optimize the database', 'lws-tools'); ?></h2> |
| 58 |
<div class="lws_tk_div_repair_sql"> |
| 59 |
<div> |
| 60 |
<?php $aff = array('strong' => array()); ?> |
| 61 |
<p class="lws_tk_p_repair_sql"> |
| 62 |
<?php esc_html_e('If your database is not working properly, you may want to repair or optimise it.', 'lws-tools'); ?> |
| 63 |
</p> |
| 64 |
</div> |
| 65 |
<div style="flex:35%; padding-left:30px"> |
| 66 |
<button class="lws_tk_general_install_button lws_tk_mysql_repair" id="lws_tk_repair" onclick=""> |
| 67 |
<span class="" name="update"> |
| 68 |
<img class="lws_tk_image_button" width="20px" height="20px" |
| 69 |
src="<?php echo esc_url(plugin_dir_url(__DIR__) . 'images/reparer.svg')?>"> |
| 70 |
<?php esc_html_e('Repair', 'lws-tools'); ?> |
| 71 |
</span> |
| 72 |
<span class="hidden" name="loading"> |
| 73 |
<img class="lws_tk_image_button" width="20px" height="20px" |
| 74 |
src="<?php echo esc_url(plugin_dir_url(__DIR__) . 'images/loading.svg')?>"> |
| 75 |
<span id="loading_1"><?php esc_html_e("Repairing...", "lws-tools");?></span> |
| 76 |
</span> |
| 77 |
<span class="hidden" name="validated"> |
| 78 |
<img class="lws_tk_image_button" width="18px" height="18px" style="vertical-align:sub" |
| 79 |
src="<?php echo esc_url(plugin_dir_url(__DIR__) . 'images/check_blanc.svg')?>"> |
| 80 |
<?php esc_html_e('Done', 'lws-tools'); ?> |
| 81 |
|
| 82 |
</span> |
| 83 |
</button> |
| 84 |
|
| 85 |
<button class="lws_tk_general_install_button lws_tk_mysql_repair" id="lws_tk_optimise" onclick=""> |
| 86 |
<span class="" name="update"> |
| 87 |
<img class="lws_tk_image_button" width="20px" height="20px" |
| 88 |
src="<?php echo esc_url(plugin_dir_url(__DIR__) . 'images/optimiser.svg')?>"> |
| 89 |
<?php esc_html_e('Repair & Optimise', 'lws-tools'); ?> |
| 90 |
</span> |
| 91 |
<span class="hidden" name="loading"> |
| 92 |
<img class="lws_tk_image_button" width="15px" height="15px" |
| 93 |
src="<?php echo esc_url(plugin_dir_url(__DIR__) . 'images/loading.svg')?>"> |
| 94 |
<span id="loading_1"><?php esc_html_e("Optimizing...", "lws-tools");?></span> |
| 95 |
</span> |
| 96 |
<span class="hidden" name="validated"> |
| 97 |
<img class="lws_tk_image_button" width="18px" height="18px" style="vertical-align:sub" |
| 98 |
src="<?php echo esc_url(plugin_dir_url(__DIR__) . 'images/check_blanc.svg')?>"> |
| 99 |
<?php esc_html_e('Done', 'lws-tools'); ?> |
| 100 |
|
| 101 |
</span> |
| 102 |
</button> |
| 103 |
|
| 104 |
<button class="lws_tk_general_install_button hidden lws_tk_mysql_repair" id="lws_tk_close_iframe_button"> |
| 105 |
<span class="" name="update"><?php esc_html_e('Close', 'lws-tools'); ?></span> |
| 106 |
</button> |
| 107 |
</div> |
| 108 |
</div> |
| 109 |
|
| 110 |
<div class="lws_tk_iframe" id="result"></div> |
| 111 |
|
| 112 |
<script> |
| 113 |
jQuery('#lws_tk_repair').on('click', function() { |
| 114 |
let button = this; |
| 115 |
let button_id = this.id; |
| 116 |
jQuery('#lws_tk_close_iframe_button').addClass('hidden'); |
| 117 |
button.children[0].classList.add('hidden'); |
| 118 |
button.children[2].classList.add('hidden'); |
| 119 |
button.children[1].classList.remove('hidden'); |
| 120 |
button.classList.remove('lws_tk_validated_button_tools'); |
| 121 |
button.setAttribute('disabled', true); |
| 122 |
jQuery('#result').html(""); |
| 123 |
var data = { |
| 124 |
action: "lwstools_repairdb", |
| 125 |
_ajax_nonce: '<?php echo esc_attr(wp_create_nonce('tools_repair_only_db')); ?>', |
| 126 |
}; |
| 127 |
jQuery.post(ajaxurl, data, function(response) { |
| 128 |
jQuery('#result').html("<iframe width='100%' height='600px' sandbox src='" + |
| 129 |
response + |
| 130 |
"<?php echo("?random='" . time(). "'");?> ></iframe>" |
| 131 |
); |
| 132 |
var _theframe = document.getElementById("result").children[0]; |
| 133 |
_theframe.contentWindow.location.href = _theframe.src; |
| 134 |
var data = { |
| 135 |
action: "lwstools_deactivate_repair", |
| 136 |
_ajax_nonce: '<?php echo esc_attr(wp_create_nonce('tools_deactivate_repair_option')); ?>', |
| 137 |
}; |
| 138 |
setTimeout(function() { |
| 139 |
jQuery.post(ajaxurl, data); |
| 140 |
}, 2000); |
| 141 |
var button = jQuery('#' + button_id); |
| 142 |
button.children()[0].classList.add('hidden'); |
| 143 |
button.children()[2].classList.remove('hidden'); |
| 144 |
button.children()[1].classList.add('hidden'); |
| 145 |
button.addClass('lws_tk_validated_button_tools'); |
| 146 |
jQuery('#lws_tk_close_iframe_button').removeClass('hidden'); |
| 147 |
button.prop('disabled', false); |
| 148 |
}); |
| 149 |
}); |
| 150 |
|
| 151 |
jQuery('#lws_tk_optimise').on('click', function() { |
| 152 |
let button = this; |
| 153 |
let button_id = this.id; |
| 154 |
jQuery('#lws_tk_close_iframe_button').addClass('hidden'); |
| 155 |
button.children[0].classList.add('hidden'); |
| 156 |
button.children[2].classList.add('hidden'); |
| 157 |
button.children[1].classList.remove('hidden'); |
| 158 |
button.classList.remove('lws_tk_validated_button_tools'); |
| 159 |
button.setAttribute('disabled', true); |
| 160 |
jQuery('#result').html(""); |
| 161 |
var data = { |
| 162 |
action: "lwstools_optidb", |
| 163 |
_ajax_nonce: '<?php echo esc_attr(wp_create_nonce('tools_optimize_all_db')); ?>', |
| 164 |
}; |
| 165 |
jQuery.post(ajaxurl, data, function(response) { |
| 166 |
setTimeout(function() { |
| 167 |
jQuery('#result').html("<iframe width='100%' height='600px' sandbox src='" + |
| 168 |
response + |
| 169 |
"<?php echo("?random=" . time());?>'></iframe>" |
| 170 |
); |
| 171 |
var _theframe = document.getElementById("result").children[0]; |
| 172 |
_theframe.contentWindow.location.href = _theframe.src; |
| 173 |
|
| 174 |
var button = jQuery('#' + button_id); |
| 175 |
button.children()[0].classList.add('hidden'); |
| 176 |
button.children()[2].classList.remove('hidden'); |
| 177 |
button.children()[1].classList.add('hidden'); |
| 178 |
button.addClass('lws_tk_validated_button_tools'); |
| 179 |
jQuery('#lws_tk_close_iframe_button').removeClass('hidden'); |
| 180 |
button.prop('disabled', false); |
| 181 |
}, 2000); |
| 182 |
setTimeout(function() { |
| 183 |
var data = { |
| 184 |
action: "lwstools_deactivate_repair", |
| 185 |
_ajax_nonce: '<?php echo esc_attr(wp_create_nonce('tools_deactivate_repair_option')); ?>', |
| 186 |
}; |
| 187 |
jQuery.post(ajaxurl, data); |
| 188 |
}, 5000); |
| 189 |
}); |
| 190 |
}); |
| 191 |
|
| 192 |
jQuery('#lws_tk_close_iframe_button').on('click', function() { |
| 193 |
jQuery('#result').html(''); |
| 194 |
jQuery('#lws_tk_repair').children()[0].classList.remove('hidden'); |
| 195 |
jQuery('#lws_tk_repair').children()[2].classList.add('hidden'); |
| 196 |
|
| 197 |
jQuery('#lws_tk_optimise').children()[0].classList.remove('hidden'); |
| 198 |
jQuery('#lws_tk_optimise').children()[2].classList.add('hidden'); |
| 199 |
|
| 200 |
jQuery('#lws_tk_repair').removeClass('lws_tk_validated_button_tools'); |
| 201 |
jQuery('#lws_tk_optimise').removeClass('lws_tk_validated_button_tools'); |
| 202 |
this.classList.add('hidden'); |
| 203 |
}); |
| 204 |
</script> |
| 205 |
|
| 206 |
<script> |
| 207 |
jQuery(document).ready(function() { |
| 208 |
var table = jQuery('#lws_tk_mysqltable').DataTable({ |
| 209 |
scrollY: "600px", |
| 210 |
scrollX: true, |
| 211 |
scrollCollapse: true, |
| 212 |
paging: false, |
| 213 |
fixedColumns: true, |
| 214 |
searching: false, |
| 215 |
info: false, |
| 216 |
}); |
| 217 |
}); |
| 218 |
</script> |