Skip to content

Public API: plugin_report_get_data() function #87

@apermo

Description

@apermo

Problem

Other plugins that want to read Plugin Report data currently have to access transients directly, which is fragile (cache key format is an implementation detail) and doesn't trigger data population if the cache is empty.

Proposed changes

Add a public API for external plugins to access report data:

  • RT_Plugin_Report::get_report( $slug ) — static method on the class
  • plugin_report_get_data( $slug ) — global convenience wrapper

Both return cached data when available, or assemble a fresh report (populating the cache) on demand. Other plugins can safely call the global function with a function_exists() guard:

if ( function_exists( 'plugin_report_get_data' ) ) {
    $report = plugin_report_get_data( 'akismet' );
    if ( isset( $report['repo_info'] ) ) {
        echo $report['repo_info']->tested;
    }
}

Internally, the report page's own rendering is updated to use self::get_report() instead of reading the transient directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions