Skip to content

History list loads the whole history table and sorts on a column that doesn't exist #477

Closed

Description

@caseysoftware

modules/history/index_table.php:

  • $history->loadAll('history_datetime', $where) loads every history row for the chosen table (no date range, no LIMIT), then runs one phpGACL query per row in PHP to drop the ones the user can't view. On a busy install this is tens of thousands of rows and queries per page view.
  • The order column is history_datetime, but the column is history_date. loadAll() only sorts when the property exists, so the ORDER BY is silently dropped and rows come back in storage order.

Fix: query with history_date ordering, paginate in SQL, and filter by permission in SQL (join the allowed-items lists per module) instead of row by row. The API's /history endpoint needs the same query.

Found by reading the code on dev-5.0.0 @ 179b4eaf; not yet reproduced on a running install.

Fix before Phase 0 of the REST API and MCP server proposal (#471).

Activity

  1. added
    api
    on Oct 23, 2026
  2. added a commit that references this issue on Oct 24, 2026
    d92afe7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apidatabase

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions