Making WordPress.org

Changeset 3382


Ignore:
Timestamp:
06/16/2016 07:55:34 AM (10 years ago)
Author:
obenland
Message:

Plugin Directory: Log plugin status changes.

We'll use post meta for now, long term we should be using an audit plugin
for this.

Fixes #1721.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
2 edited

Legend:

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

    r3250 r3382  
    2525         */
    2626        private function __construct() {
     27                add_action( 'transition_post_status', array( $this, 'record_status_change' ), 11, 3 );
     28
    2729                add_action( 'approved_plugin', array( $this, 'approved' ), 10, 2 );
    2830                add_action( 'rejected_plugin', array( $this, 'rejected' ), 10, 2 );
     
    6365                        'back_link' => true,
    6466                ) );
     67        }
     68
     69        /**
     70         * Records the time a plugin was transitioned into a specific status.
     71         *
     72         * @param string   $new_status New post status.
     73         * @param string   $old_status Old post status.
     74         * @param \WP_Post $post       Post object.
     75         */
     76        public function record_status_change( $new_status, $old_status, $post ) {
     77                if ( 'plugin' === $post->post_type ) {
     78                        update_post_meta( $post->ID, "_{$new_status}", strtotime( $post->post_modified_gmt ) );
     79                }
    6580        }
    6681
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php

    r3373 r3382  
    9393                                'meta_input' => array(
    9494                                        '_author_ip' => $author_ip,
     95                                        '_publish'   => $topic->approved,
    9596                                ),
    9697                        ) );
Note: See TracChangeset for help on using the changeset viewer.