PluginProbe
Awesome Support – WordPress HelpDesk & Support Plugin / trunk
Awesome Support – WordPress HelpDesk & Support Plugin vtrunk
6.4.0 trunk 3.0.0 3.0.1 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 All 95 releases
awesome-support / includes / admin / views / system-tools.php

system-tools.php in Awesome Support – WordPress HelpDesk & Support Plugin trunk, at includes/admin/views/system-tools.php

351 lines 17.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * System Tools.
4 *
5 * The system tools are a set of functions that helps accomplish some of the more technical
6 * operations on the plugin data.
7 *
8 * The functions are triggered by a URL parameter and the trigger is pulled from the system_tools method
9 * within the Awesome_Support_Admin class. Those functions must be triggered early so that we can safely
10 * redirect to "read only" pages after the function was executed.
11 */
12
13 /**
14 * Build the link that triggers a specific tool.
15 *
16 * @since 3.0.0
17 * @param string $tool Tool to trigger
18 * @param array $args Arbitrary arguments
19 * @return string URL that triggers the tool function
20 */
21 function wpas_tool_link( $tool, $args = array() ) {
22 $args['tool'] = $tool;
23 $args['_nonce'] = wp_create_nonce( 'system_tool' );
24
25 return esc_url( add_query_arg( $args, admin_url( 'edit.php' ) ) );
26 }
27
28 if ( isset( $_GET['done'] ) ) {
29
30 $message = '' ;
31
32 switch( $_GET['done'] ) {
33
34 case 'tickets_metas':
35 $message = __( 'Tickets metas were cleared', 'awesome-support' );
36 break;
37
38 case 'agents_metas':
39 $message = __( 'Agents metas were cleared', 'awesome-support' );
40 break;
41
42 case 'clear_taxonomies':
43 $message = __( 'All custom taxonomies terms were cleared', 'awesome-support' );
44 break;
45
46 case 'resync_products':
47 $message = __( 'All products have been re-synchronized', 'awesome-support' );
48 break;
49
50 case 'delete_products':
51 $message = __( 'All products have been deleted', 'awesome-support' );
52 break;
53
54 case 'update_last_reply':
55 $message = __( 'Last reply date has been updated on all tickets.', 'awesome-support' );
56 break;
57
58 case 'ticket_attachments':
59 $message = __( 'All unclaimed ticket attachment folders have been deleted', 'awesome-support' );
60 break;
61
62 case 'reset_channels':
63 $message = __( 'All channels have been reset', 'awesome-support' );
64 break;
65
66 case 'reset_ticket_types':
67 $message = __( 'All ticket types have been reset', 'awesome-support' );
68 break;
69
70 case 'install_blue_blocks_email_template':
71 $message = __( 'The Blue Blocks Email Template Set Has Been Installed', 'awesome-support' );
72 break;
73
74 case 'install_blue_blocks_ss_email_template':
75 $message = __( 'The Blue Blocks With Satisfaction Survey Elements Email Template Set Has Been Installed', 'awesome-support' );
76 break;
77
78 case 'install_elegant_email_template':
79 $message = __( 'The Elegant Email Template Set Has Been Installed', 'awesome-support' );
80 break;
81
82 case 'install_elegant_ss_email_template':
83 $message = __( 'The Elegant With Satisfaction Survey Elements Email Template Set Has Been Installed', 'awesome-support' );
84 break;
85
86 case 'install_simple_email_template':
87 $message = __( 'The Simple Email Template Set Has Been Installed', 'awesome-support' );
88 break;
89
90 case 'install_default_email_template':
91 $message = __( 'The Default Email Template Set Has Been Installed', 'awesome-support' );
92 break;
93
94 case 'install_debug_email_template':
95 $message = __( 'The Debug Email Template Set Has Been Installed', 'awesome-support' );
96 break;
97
98 case 'mark_all_auto_del_attchmnts':
99 case 'remove_mark_all_auto_del_attchmnts':
100 case 'mark_open_auto_del_attchmnts':
101 case 'remove_mark_open_auto_del_attchmnts':
102 case 'mark_closed_auto_del_attchmnts':
103 case 'remove_mark_closed_auto_del_attchmnts':
104
105 $done_parts = explode( '_', sanitize_text_field( wp_unslash( $_GET['done'] ) ) );
106 $flag_added_removed = 'remove' === substr( sanitize_text_field( wp_unslash( $_GET['done'] ) ), 0, 6 ) ? 'removed' : 'added';
107 $flag_ticket_types = 'removed' === $flag_added_removed ? $done_parts[2] : $done_parts[1];
108
109
110 // translators: %1$s is the flag or status, %2$s is the number of tickets.
111 $x_content = __( 'Auto delete attachments flag %1$s on %2$s tickets', 'awesome-support' );
112
113 $message = sprintf( $x_content, $flag_added_removed, $flag_ticket_types );
114 break;
115 }
116
117 $message = apply_filters('wpas_show_done_tool_message', $message, sanitize_text_field( wp_unslash( $_GET['done'] ) ));
118
119 }
120
121 if ( isset( $message ) && !empty( $message ) ) {
122 echo '<div class="updated below-h2"><p>' . esc_html( $message ) . '</p></div>';
123 }
124 ?>
125 <p><?php esc_html_e( 'These tool are intended for advanced users or for use on the support staff request. Be aware that some of these tools can definitively erase data.', 'awesome-support' ); ?></p>
126 <table class="widefat wpas-system-tools-table" id="wpas-system-tools">
127 <thead>
128 <tr>
129 <th data-override="key" class="row-title"><?php esc_html_e( 'General Tools', 'awesome-support' ); ?></th>
130 <th data-override="value"></th>
131 </tr>
132 </thead>
133 <tbody>
134 <tr>
135 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Tickets Metas', 'awesome-support' ); ?></label></td>
136 <td>
137 <a href="<?php echo esc_url( wpas_tool_link( 'tickets_metas' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Clear', 'awesome-support' ); ?></a>
138 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Clear all transients for all tickets.', 'awesome-support' ); ?></span>
139 </td>
140 </tr>
141 <tr>
142 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Agents Metas', 'awesome-support' ); ?></label></td>
143 <td>
144 <a href="<?php echo esc_url( wpas_tool_link( 'agents_metas' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Clear', 'awesome-support' ); ?></a>
145 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Clear all agents metas.', 'awesome-support' ); ?></span>
146 </td>
147 </tr>
148 <tr>
149 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Custom Taxonomies', 'awesome-support' ); ?></label></td>
150 <td>
151 <a href="<?php echo esc_url( wpas_tool_link( 'clear_taxonomies' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Clear', 'awesome-support' ); ?></a>
152 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Clear all terms from all custom taxonomies.', 'awesome-support' ); ?></span>
153 </td>
154 </tr>
155 <tr>
156 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Ticket Attachments', 'awesome-support' ); ?></label></td>
157 <td>
158 <a href="<?php echo esc_url( wpas_tool_link( 'ticket_attachments' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Clear', 'awesome-support' ); ?></a>
159 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Clear unclaimed ticket attachment folders.', 'awesome-support' ); ?></span>
160 </td>
161 </tr>
162 <tr>
163 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Update last reply date on tickets', 'awesome-support' ); ?></label></td>
164 <td>
165 <a href="<?php echo esc_url( wpas_tool_link( 'update_last_reply' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Update', 'awesome-support' ); ?></a>
166 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Update last reply date on tickets.', 'awesome-support' ); ?></span>
167 </td>
168 </tr>
169 <tr>
170 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Reset replies count', 'awesome-support' ); ?></label></td>
171 <td>
172 <a href="<?php echo esc_url( wpas_tool_link( 'reset_replies_count' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Count', 'awesome-support' ); ?></a>
173 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Count all ticket replies.', 'awesome-support' ); ?></span>
174 </td>
175 </tr>
176 <tr>
177 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Reset channels', 'awesome-support' ); ?></label></td>
178 <td>
179 <a href="<?php echo esc_url( wpas_tool_link( 'reset_channels' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Reset', 'awesome-support' ); ?></a>
180 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Reset channels.', 'awesome-support' ); ?></span>
181 </td>
182 </tr>
183 <tr>
184 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Reset ticket types', 'awesome-support' ); ?></label></td>
185 <td>
186 <a href="<?php echo esc_url( wpas_tool_link( 'reset_ticket_types' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Reset', 'awesome-support' ); ?></a>
187 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Reset ticket_types.', 'awesome-support' ); ?></span>
188 </td>
189 </tr>
190 <tr>
191 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Zero Out All Time Fields', 'awesome-support' ); ?></label></td>
192 <td>
193 <a href="<?php echo esc_url( wpas_tool_link( 'reset_time_fields' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Reset', 'awesome-support' ); ?></a>
194 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Reset time fields by setting them all to zero on ALL tickets!', 'awesome-support' ); ?></span>
195 </td>
196 </tr>
197 <?php do_action( 'wpas_system_tools_table_after' ); ?>
198 </tbody>
199 </table>
200
201 <p><h3><?php esc_html_e( 'Install an email template set', 'awesome-support' ); ?></h3></p>
202 <p><?php esc_html_e( 'Warning: Using these options will overwrite your email templates in TICKETS->SETTINGS->EMAILS!', 'awesome-support' ); ?></p>
203 <table class="widefat wpas-system-tools-table" id="wpas-system-tools">
204 <thead>
205 <tr>
206 <th data-override="key" class="row-title"><?php esc_html_e( 'Email Template Sets', 'awesome-support' ); ?></th>
207 <th data-override="value"></th>
208 </tr>
209 </thead>
210 <tbody>
211 <tr>
212 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Blue Blocks', 'awesome-support' ); ?></label></td>
213 <td>
214 <a href="<?php echo esc_url( wpas_tool_link( 'install_blue_blocks_email_template' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Install', 'awesome-support' ); ?></a>
215 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Install the Blue Blocks email template set into the TICKETS->SETTINGS->EMAIL template fields', 'awesome-support' ); ?></span>
216 </td>
217 </tr>
218 <tr>
219 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Blue Blocks With Satisfaction Survey Elements', 'awesome-support' ); ?></label></td>
220 <td>
221 <a href="<?php echo esc_url( wpas_tool_link( 'install_blue_blocks_ss_email_template' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Install', 'awesome-support' ); ?></a>
222 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Install the Blue Blocks with Satisfaction Survey Elements email template set into the TICKETS->SETTINGS->EMAIL template fields', 'awesome-support' ); ?></span>
223 </td>
224 </tr>
225
226 <tr>
227 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Elegant', 'awesome-support' ); ?></label></td>
228 <td>
229 <a href="<?php echo esc_url( wpas_tool_link( 'install_elegant_email_template' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Install', 'awesome-support' ); ?></a>
230 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Install the Elegant email template set into the TICKETS->SETTINGS->EMAIL template fields', 'awesome-support' ); ?></span>
231 </td>
232 </tr>
233 <tr>
234 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Elegant With Satisfaction Survey Elements', 'awesome-support' ); ?></label></td>
235 <td>
236 <a href="<?php echo esc_url( wpas_tool_link( 'install_elegant_ss_email_template' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Install', 'awesome-support' ); ?></a>
237 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Install the Elegant email template set with Satisfaction Survey Elements into the TICKETS->SETTINGS->EMAIL template fields', 'awesome-support' ); ?></span>
238 </td>
239 </tr>
240
241 <tr>
242 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Simple', 'awesome-support' ); ?></label></td>
243 <td>
244 <a href="<?php echo esc_url( wpas_tool_link( 'install_simple_email_template' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Install', 'awesome-support' ); ?></a>
245 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Install the Simple email template set into the TICKETS->SETTINGS->EMAIL template fields', 'awesome-support' ); ?></span>
246 </td>
247 </tr>
248
249 <tr>
250 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Default', 'awesome-support' ); ?></label></td>
251 <td>
252 <a href="<?php echo esc_url( wpas_tool_link( 'install_default_email_template' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Install', 'awesome-support' ); ?></a>
253 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Install the Default email template set into the TICKETS->SETTINGS->EMAIL template fields', 'awesome-support' ); ?></span>
254 </td>
255 </tr>
256
257 <tr>
258 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Debug', 'awesome-support' ); ?></label></td>
259 <td>
260 <a href="<?php echo esc_url( wpas_tool_link( 'install_debug_email_template' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Install', 'awesome-support' ); ?></a>
261 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Install a debugging email template set into the TICKETS->SETTINGS->EMAIL template fields', 'awesome-support' ); ?></span>
262 </td>
263 </tr>
264
265 <?php do_action( 'wpas_system_email_template_tools_table_after' ); ?>
266 </tbody>
267 </table>
268
269 <p><h3><?php esc_html_e( 'Tools to re-run conversion of data after upgrading from an earlier version', 'awesome-support' ); ?></h3></p>
270 <table class="widefat wpas-system-tools-table" id="wpas-system-tools">
271 <thead>
272 <tr>
273 <th data-override="key" class="row-title"><?php esc_html_e( 'Data Conversion Tools', 'awesome-support' ); ?></th>
274 <th data-override="value"></th>
275 </tr>
276 </thead>
277 <tbody>
278 <tr>
279 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Re-run conversion from 3.3.x to 4.0.0', 'awesome-support' ); ?></label></td>
280 <td>
281 <a href="<?php echo esc_url( wpas_tool_link( 'rerun_334_to_400_conversion' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Rerun Conversion', 'awesome-support' ); ?></a>
282 <span class="wpas-system-tools-desc"><?php esc_html_e( 'If your CAPABILITIES are not installed, re-run the 3.3.x to 4.0.0 conversion process. Make sure you have a BACKUP!', 'awesome-support' ); ?></span>
283 </td>
284 </tr>
285 <tr>
286 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Re-run conversion from 4.0.x to 4.4.0', 'awesome-support' ); ?></label></td>
287 <td>
288 <a href="<?php echo esc_url( wpas_tool_link( 'rerun_400_to_440_conversion' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Rerun Conversion', 'awesome-support' ); ?></a>
289 <span class="wpas-system-tools-desc"><?php esc_html_e( 'If your CAPABILITIES are not installed, re-run the 4.x.x to 4.4.0 conversion process. Make sure you have a BACKUP!', 'awesome-support' ); ?></span>
290 </td>
291 </tr>
292 <tr>
293 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Re-run conversion from 4.x.x to 5.0.0', 'awesome-support' ); ?></label></td>
294 <td>
295 <a href="<?php echo esc_url( wpas_tool_link( 'rerun_400_to_500_conversion' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Rerun Conversion', 'awesome-support' ); ?></a>
296 <span class="wpas-system-tools-desc"><?php esc_html_e( 'If your CAPABILITIES are not installed, re-run the 4.x.x to 5.0.0 conversion process. Make sure you have a BACKUP!', 'awesome-support' ); ?></span>
297 </td>
298 </tr>
299 <tr>
300 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Re-run conversion from 5.8.0 to 5.9.0', 'awesome-support' ); ?></label></td>
301 <td>
302 <a href="<?php echo esc_url( wpas_tool_link( 'rerun_580_to_590_conversion' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Rerun Conversion', 'awesome-support' ); ?></a>
303 <span class="wpas-system-tools-desc"><?php esc_html_e( 'If your CAPABILITIES are not installed, re-run the 5.8.0 to 5.9.0 conversion process. Make sure you have a BACKUP!', 'awesome-support' ); ?></span>
304 </td>
305 </tr>
306
307
308 <?php do_action( 'wpas_system_data_conversion_tools_table_after' ); ?>
309 </tbody>
310 </table>
311
312 <p><h3><?php esc_html_e( 'Tools to handle ticket and reply attachments', 'awesome-support' ); ?></h3></p>
313 <table class="widefat wpas-system-tools-table" id="wpas-system-tools-attachments">
314 <thead>
315 <tr>
316 <th data-override="key" class="row-title"><?php esc_html_e( 'Auto Delete Attachments Flag', 'awesome-support' ); ?></th>
317 <th data-override="value"></th>
318 </tr>
319 </thead>
320 <tbody>
321 <tr>
322 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'All Tickets', 'awesome-support' ); ?></label></td>
323 <td>
324 <a href="<?php echo esc_url( wpas_tool_link( 'mark_all_auto_del_attchmnts' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Add', 'awesome-support' ); ?></a>
325 <a href="<?php echo esc_url( wpas_tool_link( 'remove_mark_all_auto_del_attchmnts' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Remove', 'awesome-support' ); ?></a>
326 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Add or Remove auto delete attachments flag on all tickets.', 'awesome-support' ); ?></span>
327 </td>
328 </tr>
329 <tr>
330 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Open Tickets', 'awesome-support' ); ?></label></td>
331 <td>
332 <a href="<?php echo esc_url( wpas_tool_link( 'mark_open_auto_del_attchmnts' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Add', 'awesome-support' ); ?></a>
333 <a href="<?php echo esc_url( wpas_tool_link( 'remove_mark_open_auto_del_attchmnts' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Remove', 'awesome-support' ); ?></a>
334 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Add or Remove auto delete attachments flag on open tickets.', 'awesome-support' ); ?></span>
335 </td>
336 </tr>
337 <tr>
338 <td class="row-title"><label for="tablecell"><?php esc_html_e( 'Closed Tickets', 'awesome-support' ); ?></label></td>
339 <td>
340 <a href="<?php echo esc_url( wpas_tool_link( 'mark_closed_auto_del_attchmnts' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Add', 'awesome-support' ); ?></a>
341 <a href="<?php echo esc_url( wpas_tool_link( 'remove_mark_closed_auto_del_attchmnts' ) ); ?>" class="button-secondary"><?php esc_html_e( 'Remove', 'awesome-support' ); ?></a>
342 <span class="wpas-system-tools-desc"><?php esc_html_e( 'Add or Remove auto delete attachments flag on closed tickets.', 'awesome-support' ); ?></span>
343 </td>
344 </tr>
345
346
347 </tbody>
348 </table>
349
350 <?php do_action( 'wpas_system_tools_after' ); ?>
351