Skip to content

Migrate Configurable Reports blocks to SQL report list blocks #9

In review

Description

@keevan

Moved from catalyst/moodle-report_sql#49, since block instances are better created and migrated by the block plugin (see the discussion on catalyst/moodle-report_sql#53).

Summary

Sites replacing Configurable Reports (BCR, block_configurable_reports) with block_sqlreports must currently re-add every block by hand. Provide a way to convert all existing BCR block instances in one step, with no loss of placement or visibility.

Proposed

  • An admin page (preview, then confirm) and a CLI script with --dry-run.
  • For each configurable_reports row in block_instances, create a block_sqlreports block in "List of reports" mode, then remove the old block.
  • Carry over as-is:
    • placement: parent context, "show in subcontexts", page type and sub-page patterns, default region and weight;
    • per-page hidden/shown state and position overrides (block_positions);
    • per-user collapsed/docked state;
    • the moodle/block:view and moodle/block:edit permission overrides;
    • the block title (BCR's default title is dropped) and the global/course report switches, mapped to "Show site reports" and "Show course reports".
  • Each block is migrated in its own transaction, so one failure leaves that block untouched and does not stop the rest. Re-running only picks up blocks that remain.
  • Work from database rows only. No BCR code is needed, so it still runs after BCR is removed from disk.

Out of scope

  • Importing and publishing reports. Do that with report_sql's "Import from Configurable Reports" and set audiences there. This plugin does not control publishing.
  • Migrating BCR permissions or reports that report_sql rejects on import.

Suggested order of operations

  1. Import the BCR reports with report_sql.
  2. Publish them and set their audiences.
  3. Run the block migration.
  4. Remove BCR.

Related

Activity

  1. self-assigned this
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions