/home/altere25/.trash/wp-to-sanity-companion
Edit: /home/altere25/.trash/wp-to-sanity-companion/templates\admin\log.php (10849B)
prefix . 'ad_migration_log';
$log_ids = array_map('intval', $_POST['log_ids']);
switch ($_POST['bulk_action']) {
case 'delete':
$placeholders = implode(',', array_fill(0, count($log_ids), '%d'));
$wpdb->query($wpdb->prepare("DELETE FROM {$log_table} WHERE id IN ($placeholders)", ...$log_ids));
echo '
' . esc_html__('Selected logs deleted.', 'wp-to-sanity') . '
';
break;
case 'retry':
// v2: re-trigger the webhook for each failed post by marking it
// pending so the next publish/edit re-fires. The v1 queue table
// no longer exists; queueing lives on the Worker Durable Object.
$placeholders = implode(',', array_fill(0, count($log_ids), '%d'));
$wpdb->query($wpdb->prepare(
"UPDATE {$log_table} SET status = 'pending', error_message = NULL WHERE id IN ($placeholders)",
...$log_ids
));
echo '
' . esc_html__('Selected logs reset to pending. Re-publish the posts to re-trigger migration.', 'wp-to-sanity') . '
';
break;
}
}
// Filter handling
$filter_status = $_GET['status'] ?? 'all';
$filter_post_type = $_GET['post_type'] ?? 'all';
$search = $_GET['s'] ?? '';
$where_clauses = ['1=1'];
if ($filter_status !== 'all') {
$where_clauses[] = $wpdb->prepare('status = %s', $filter_status);
}
if ($search) {
$where_clauses[] = $wpdb->prepare('(post_id = %d OR sanity_id LIKE %s)', intval($search), '%' . $wpdb->esc_like($search) . '%');
}
$where = implode(' AND ', $where_clauses);
?>