Changeset 14707
- Timestamp:
- 03/13/2026 06:35:07 AM (14 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-manager.php
r14606 r14707 424 424 } 425 425 426 // Convert to stdClass to avoid dynamic property deprecation on Job objects. 427 $jobs = array_map( static fn( $job ) => (object) (array) $job, $jobs ); 428 426 429 // Fetch logs for the tasks. 427 430 if ( $with_logs ) { 428 431 $log_table = str_replace( 'jobs', 'logs', \HM\Cavalcade\Plugin\Job::get_table() ); 429 foreach ( $jobs as &$job ) { 430 // Fetch logs for the task. 432 foreach ( $jobs as $job ) { 431 433 $job->logs = $wpdb->get_results( 432 434 $wpdb->prepare( … … 445 447 // Sort jobs based on last run. 446 448 usort( $jobs, static function( $a, $b ) { 447 $a_last_log = 0; 448 $b_last_log = 0; 449 if ( $a->logs ) { 450 $a_last_log = max( array_map( 'strtotime', wp_list_pluck( $a->logs, 'timestamp' ) ) ); 451 } 452 if ( $b->logs ) { 453 $b_last_log = max( array_map( 'strtotime', wp_list_pluck( $b->logs, 'timestamp' ) ) ); 454 } 455 456 $a_last_log = max( $a->start, $a_last_log ); 457 $b_last_log = max( $b->start, $b_last_log ); 458 459 return $a_last_log <=> $b_last_log; 449 $a_last = max( $a->start, ! empty( $a->logs ) ? max( array_map( 'strtotime', wp_list_pluck( $a->logs, 'timestamp' ) ) ) : 0 ); 450 $b_last = max( $b->start, ! empty( $b->logs ) ? max( array_map( 'strtotime', wp_list_pluck( $b->logs, 'timestamp' ) ) ) : 0 ); 451 452 return $a_last <=> $b_last; 460 453 } ); 461 454
Note: See TracChangeset
for help on using the changeset viewer.