| 1 |
<?php |
| 2 |
namespace WeDevs\ERP\HRM\CLI; |
| 3 |
|
| 4 |
/** |
| 5 |
* HRM CLI class |
| 6 |
*/ |
| 7 |
class Commands extends \WP_CLI_Command { |
| 8 |
|
| 9 |
/** |
| 10 |
* Clean HRM tables |
| 11 |
* |
| 12 |
* @since 1.2.0 |
| 13 |
* |
| 14 |
* @return void |
| 15 |
*/ |
| 16 |
public function clean() { |
| 17 |
global $wpdb; |
| 18 |
|
| 19 |
$tables = [ |
| 20 |
'erp_hr_depts', |
| 21 |
'erp_hr_designations', |
| 22 |
'erp_hr_employees', |
| 23 |
'erp_hr_employee_history', |
| 24 |
'erp_hr_employee_notes', |
| 25 |
'erp_hr_leave_policies', |
| 26 |
'erp_hr_holiday', |
| 27 |
'erp_hr_leave_entitlements', |
| 28 |
'erp_hr_leaves', |
| 29 |
'erp_hr_leave_requests', |
| 30 |
'erp_hr_work_exp', |
| 31 |
'erp_hr_education', |
| 32 |
'erp_hr_dependents', |
| 33 |
'erp_hr_employee_performance', |
| 34 |
'erp_hr_announcement', |
| 35 |
]; |
| 36 |
|
| 37 |
foreach ($tables as $table) { |
| 38 |
$wpdb->query( 'TRUNCATE TABLE ' . $wpdb->prefix . $table); |
| 39 |
} |
| 40 |
|
| 41 |
\WP_CLI::success( "Table deleted successfully!" ); |
| 42 |
} |
| 43 |
|
| 44 |
} |
| 45 |
|
| 46 |
\WP_CLI::add_command( 'hr', 'WeDevs\ERP\HRM\CLI\Commands' ); |
| 47 |
|