Changeset 12166
- Timestamp:
- 10/31/2022 05:14:50 AM (2 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php
r11312 r12166 61 61 add_filter( 'wp_ajax_delete-support-rep', array( __NAMESPACE__ . '\Metabox\Support_Reps', 'remove_support_rep' ) ); 62 62 add_action( 'wp_ajax_plugin-author-lookup', array( __NAMESPACE__ . '\Metabox\Author', 'lookup_author' ) ); 63 add_action( 'wp_ajax_plugin-svn-sync', array( __NAMESPACE__ . '\Metabox\Review_Tools', 'svn_sync' ) ); 63 64 64 65 add_action( 'save_post', array( __NAMESPACE__ . '\Metabox\Release_Confirmation', 'save_post' ) ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php
r10184 r12166 10 10 use WordPressdotorg\Plugin_Directory\Template; 11 11 use WordPressdotorg\Plugin_Directory\Tools; 12 use WordPressdotorg\Plugin_Directory\Jobs\Plugin_Import; 12 13 13 14 /** … … 282 283 <?php endif; ?> 283 284 </ul> 285 <p> 286 <?php 287 $svn_sync_url = add_query_arg( 288 array( 289 'action' => 'plugin-svn-sync', 290 'slug' => $post->post_name, 291 '_ajax_nonce' => wp_create_nonce( 'wporg_plugins_svn_sync-' . $post->post_name ), 292 ), 293 admin_url( 'admin-ajax.php' ) 294 ); 295 ?> 296 <a id="svn-sync" class="button button-secondary" href="<?php echo esc_url( $svn_sync_url ); ?>">Trigger svn sync</a> 297 <script> 298 jQuery( function( $ ) { 299 $( '#svn-sync' ).click( function( e ) { 300 e.preventDefault(); 301 302 var $this = $(this), 303 url = $this.attr('href'); 304 305 $this.addClass( 'disabled' ); 306 $this.prop( 'href', '' ); 307 308 if ( url ) { 309 $.get( url ).then( function( response ) { 310 alert( response ); 311 } ); 312 } 313 } ); 314 }); 315 </script> 316 </p> 284 317 <?php 285 318 } … … 329 362 } ); 330 363 } 364 365 /** 366 * admin-ajax.php handler for queueing a plugin import. 367 */ 368 static function svn_sync() { 369 $plugin_slug = sanitize_text_field( wp_unslash( $_REQUEST['slug'] ) ); 370 371 check_ajax_referer( 'wporg_plugins_svn_sync-' . $plugin_slug ); 372 373 Plugin_Import::queue( 374 $plugin_slug, 375 array( 376 'tags_touched' => [ 377 'trunk' 378 ], 379 'source' => 'wp-admin svn-sync button' 380 ) 381 ); 382 383 die( "Queued SVN import for {$plugin_slug}." ); 384 } 331 385 }
Note: See TracChangeset
for help on using the changeset viewer.