<<

NAME

Koha::Reports - Koha Report Object set class

API

Class Methods

running

Returns a Koha::Reports resultset of reports currently being executed, optionally filtered by the patron that started them and/or by report id.

    my $running = Koha::Reports->running(
        {
            user_id   => $patron->borrowernumber,
            report_id => $report->id,
        }
    );

    if ( $running->count ) { ... }

Both user_id (a borrowernumber) and report_id are optional. The lookup relies on the SQL comment embedded by "prep_report" in Koha::Report being visible in information_schema.processlist.

The query is always scoped to the current connection's MySQL user via user = SUBSTRING_INDEX(CURRENT_USER(), '@', 1). Without PROCESS privilege MariaDB/MySQL already restricts information_schema.processlist to the caller's own threads, but if a site has granted broader privileges this filter ensures we never count threads belonging to other database users (eg. another Koha instance sharing the server, or an unrelated application using the same MariaDB).

If the database user lacks the privileges needed to query information_schema.processlist, the failure is logged via warn and an empty resultset is returned so that callers degrade gracefully rather than aborting the operation they were guarding.

_processlist_rows

Used internally to query the database process list. Returns an arrayref of hashrefs, one per row.

_type

Returns name of corresponding DBIC resultset

object_class

Returns name of corresponding Koha Object Class

AUTHOR

Kyle M Hall <kyle@bywatersolutions.com>

<<