Skip to content

Add stats_get_csv to restricted functions #461

@rebeccahum

Description

@rebeccahum

What problem would the enhancement address for VIP?

Every time stats_get_csv() is called, it stores the data in the option stats_cache, which is where it can be polluted, as Jetpack relies on this value: https://github.com/Automattic/jetpack/blob/29b6f22dd57d0a5e8967fef73279dfdc575b820d/modules/stats.php#L1490.

Describe the solution you'd like

This function should not be relied on and a custom solution (e.g. stats endpoint) should be used instead.

What code should be reported as a violation?

$popular = stats_get_csv( 'postviews', [ 'days'  => 2,   'limit' => 20 ] );

What code should not be reported as a violation?

$popular = custom_stats_get_csv( 'postviews', [ 'days'  => 2,   'limit' => 20 ] );

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions