Changeset 6534 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php
- Timestamp:
- 02/04/2018 02:34:02 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php
r6287 r6534 140 140 case 'publish': 141 141 $this->clean_closed_date( $post->ID ); 142 $this->set_translation_status( $post, 'active' ); 142 143 break; 143 144 … … 145 146 case 'closed': 146 147 $this->save_close_reason( $post->ID ); 148 $this->set_translation_status( $post, 'inactive' ); 147 149 break; 148 150 } … … 150 152 // Record the time a plugin was transitioned into a specific status. 151 153 update_post_meta( $post->ID, "_{$new_status}", strtotime( $post->post_modified_gmt ) ); 154 } 155 156 /** 157 * Updates project status of the plugin on translate.wordpress.org. 158 * 159 * @param \WP_Post $post Post object. 160 * @param string $status Project status. Accepts 'active' or 'inactive'. 161 */ 162 public function set_translation_status( $post, $status ) { 163 if ( ! defined( 'TRANSLATE_API_INTERNAL_BEARER_TOKEN' ) ) { 164 return; 165 } 166 167 wp_remote_post( 'https://translate.wordpress.org/wp-json/translate/v1/jobs', array( 168 'body' => json_encode( 169 array( 170 'timestamp' => time() + 2 * 60, 171 'recurrence' => 'once', 172 'hook' => 'wporg_translate_update_plugin_status', 173 'args' => array( 174 array( 175 'plugin' => $post->post_name, 176 'status' => $status, 177 ), 178 ), 179 ) 180 ), 181 'headers' => array( 182 'Content-Type' => 'application/json', 183 'Authorization' => 'Bearer ' . TRANSLATE_API_INTERNAL_BEARER_TOKEN, 184 ), 185 'blocking' => false, 186 'user-agent' => 'WordPress.org Plugin Status', 187 ) ); 152 188 } 153 189
Note: See TracChangeset
for help on using the changeset viewer.