Refactor: delete import csv
This commit is contained in:
@@ -34,7 +34,6 @@ require_once STATPRESS_PLUGIN_DIR . 'includes/admin/pages/page-goals.php';
|
||||
require_once STATPRESS_PLUGIN_DIR . 'includes/admin/pages/page-settings.php';
|
||||
require_once STATPRESS_PLUGIN_DIR . 'includes/admin/pages/page-yearly-summary.php';
|
||||
require_once STATPRESS_PLUGIN_DIR . 'includes/admin/pages/page-infographic.php';
|
||||
require_once STATPRESS_PLUGIN_DIR . 'includes/admin/pages/page-import-csv.php';
|
||||
|
||||
global $statpress_plugin_hooks;
|
||||
$statpress_plugin_hooks = array();
|
||||
@@ -74,7 +73,6 @@ function statpress_enqueue_frontend_material_assets() {
|
||||
|
||||
// --- 5. MIGRACJA DANYCH (jednorazowa) ---
|
||||
add_action( 'admin_init', 'statpress_handle_data_migration' );
|
||||
add_action( 'admin_init', 'statpress_handle_admin_tools' );
|
||||
|
||||
/**
|
||||
* Handles the one-time data migration from 'mystat_' tables to 'statpress_' tables.
|
||||
@@ -156,27 +154,3 @@ function statpress_handle_data_migration() {
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=statpress-dashboard' ) );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles various admin tool actions, like resetting the migration flag.
|
||||
*/
|
||||
function statpress_handle_admin_tools() {
|
||||
// Check if the reset migration action is triggered
|
||||
if ( isset( $_POST['statpress_action'] ) && 'reset_migration' === $_POST['statpress_action'] ) {
|
||||
// Verify nonce and permissions
|
||||
if ( ! isset( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'statpress_reset_migration_nonce' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete the option that hides the migration button
|
||||
delete_option( 'statpress_migration_complete' );
|
||||
|
||||
// Set a transient to show a success notice on the settings page
|
||||
set_transient( 'statpress_migration_reset_notice', true, 60 );
|
||||
wp_safe_redirect( admin_url( 'admin.php?page=statpress-settings' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user