Making WordPress.org


Ignore:
Timestamp:
08/17/2023 05:16:41 AM (21 months ago)
Author:
dd32
Message:

Plugin Directory: API: Increase the cache duration for plugin details, but add API cache invalidation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php

    r12594 r12846  
    99use WordPressdotorg\Plugin_Directory\Email\Plugin_Rejected as Plugin_Rejected_Email;
    1010use WordPressdotorg\Plugin_Directory\Admin\Metabox\Reviewer as Reviewer_Metabox;
     11use WordPressdotorg\Plugin_Directory\Jobs\API_Update_Updater;
     12use WordPressdotorg\Plugin_Directory\Standalone\Plugins_Info_API;
    1113
    1214/**
     
    164166            update_post_meta( $post->ID, "_{$new_status}", strtotime( $post->post_modified_gmt ) );
    165167        }
     168
     169        // Clear any relevant caches.
     170        $this->flush_caches( $post );
    166171    }
    167172
     
    377382        Reviewer_Metabox::set_reviewer( $post, false, false );
    378383    }
     384
     385    /**
     386     * Flush the caches for the plugin.
     387     */
     388    protected function flush_caches( $post ) {
     389        // Update the API endpoints with the new data
     390        API_Update_Updater::update_single_plugin( $post->post_name );
     391        Plugins_Info_API::flush_plugin_information_cache( $post->post_name );
     392    }
    379393}
Note: See TracChangeset for help on using the changeset viewer.