Amazon_S3_And_CloudFront::diagnostic_media_counts PHP Method

diagnostic_media_counts() protected method

Get the total attachment and total S3 attachment counts for the diagnostic log
protected diagnostic_media_counts ( ) : array
return array
    protected function diagnostic_media_counts()
    {
        if (false === ($attachment_counts = get_site_transient('wpos3_attachment_counts'))) {
            $table_prefixes = $this->get_all_blog_table_prefixes();
            $all_media = 0;
            $all_media_s3 = 0;
            foreach ($table_prefixes as $blog_id => $table_prefix) {
                $count = $this->count_attachments($table_prefix);
                $all_media += $count;
                $s3_count = $this->count_attachments($table_prefix, true);
                $all_media_s3 += $s3_count;
            }
            $attachment_counts = array('all' => $all_media, 's3' => $all_media_s3);
            set_site_transient('wpos3_attachment_counts', $attachment_counts, 2 * HOUR_IN_SECONDS);
        }
        return $attachment_counts;
    }
Amazon_S3_And_CloudFront