Making WordPress.org

Ticket #1721: 1721.diff

File 1721.diff, 1.4 KB (added by obenland, 9 years ago)
  • admin/class-status-transitions.php

     
    2626        private function __construct() {
    2727                add_action( 'approved_plugin', array( $this, 'approved' ), 10, 2 );
    2828                add_action( 'rejected_plugin', array( $this, 'rejected' ), 10, 2 );
     29
     30                add_action( 'transition_post_status', array( $this, 'record_status_change' ), 10, 3 );
    2931        }
    3032
    3133        /**
     
    161163        }
    162164
    163165        /**
     166         * Records the time a plugin was transitioned into a specific status.
     167         *
     168         * @param string   $new_status New post status.
     169         * @param string   $old_status Old post status.
     170         * @param \WP_Post $post       Post object.
     171         */
     172        public function record_status_change( $new_status, $old_status, $post ) {
     173                if ( 'plugin' === $post->post_type ) {
     174                        update_post_meta( $post->ID, "_{$new_status}", strtotime( $post->post_modified_gmt ) );
     175                }
     176        }
     177
     178        /**
    164179         * Returns the path to a plugins root directory.
    165180         *
    166181         * @param string $dir Directory to search in.
  • cli/class-import.php

     
    9292                                'post_modified_gmt' => $topic->topic_time,
    9393                                'meta_input' => array(
    9494                                        '_author_ip' => $author_ip,
     95                                        '_publish'   => $topic->approved,
    9596                                ),
    9697                        ) );
    9798                }