Action
uncanny-automator
automator_repair_tables_after
Fires after the WordPress database tables have been repaired by Automator.
add_action( 'automator_repair_tables_after', $callback, 10, 1 );
Description
Fires after Uncanny Automator has completed its database table repair process. Developers can use this hook to perform cleanup, trigger follow-up actions, or log the repair event. No parameters are passed.
Usage
add_action( 'automator_repair_tables_after', 'your_function_name', 10, 1 );
Examples
add_action( 'automator_repair_tables_after', 'my_automator_post_repair_actions', 10, 0 );
/**
* Perform additional actions after Automator tables have been repaired.
*
* This function is hooked into the 'automator_repair_tables_after' action.
* It demonstrates how to leverage this hook to perform custom tasks
* after the database tables have been verified and repaired by the plugin.
* For example, you might want to log the event or trigger other
* related processes.
*/
function my_automator_post_repair_actions() {
// Log that the tables have been repaired
error_log( 'Uncanny Automator: Database tables have been successfully repaired.' );
// Potentially clear a transient that indicates a need for repair
// if the plugin hasn't already done so or if you have a custom check.
// For demonstration purposes, let's assume we might want to clear a cached
// status if this repair was triggered by a specific custom event.
delete_transient( 'automator_repair_needed_flag' );
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/core/admin/admin-tools/tabs/tools/tools.php:69
private function process_request() {
$this->validate_request();
$query_params = array(
'post_type' => AUTOMATOR_POST_TYPE_RECIPE,
'page' => 'uncanny-automator-admin-tools',
'tab' => 'tools',
);
switch ( automator_filter_input( 'type' ) ) {
case 'drop_view':
$dropped = Automator_DB::drop_view( automator_filter_input( 'view' ) );
$query_params['status'] = $dropped ? 'true' : 'false';
break;
case 'repair_tables':
Automator_DB::verify_base_tables( true );
automator_delete_option( 'automator_schema_missing_tables' );
$query_params['database_repaired'] = 'yes';
do_action( 'automator_repair_tables_after' );
break;
case 'purge_tables':
$purged = Automator_DB::purge_tables();
automator_delete_option( 'automator_schema_missing_tables' );
$query_params['purged'] = $purged ? 'true' : 'false';
break;
}
wp_safe_redirect( add_query_arg( $query_params, admin_url( 'edit.php' ) ) );
exit;
}
Internal Usage
Found in uncanny-automator-pro/src/schema.php:61:
add_action( 'automator_repair_tables_after', array( $this, 'repair_tables' ) );