Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/cache
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ if ( should_refresh_cache( $cache_file_core_plugins ) ) {
$plugin->slug => [
'name' => $plugin->name,
'slug' => $plugin->slug,
'versions' => collect($plugin->versions)->sortKeysDesc()->take(25)->toArray(),
'versions' => collect($plugin->versions)->sortKeysUsing(fn($a, $b) => version_compare($b, $a))->take(25)->toArray(),
],
] );

Expand Down Expand Up @@ -305,7 +305,7 @@ foreach ( $plugins as $plugin ) {
}

// Keep 50 newest plugin versions.
$plugin->versions = collect( $plugin->versions )->sortKeys()->reverse()->take( 50 );
$plugin->versions = collect( $plugin->versions )->sortKeysUsing(fn($a, $b) => version_compare($b, $a))->take( 50 );

// Get all translations to all known plugin versions
foreach ( $plugin->versions as $version => $url ) {
Expand Down Expand Up @@ -379,7 +379,7 @@ foreach ( $themes as $theme ) {
}

// Keep 25 newest theme versions.
$theme->versions = collect( $theme->versions )->sortKeys()->reverse()->take( 25 );
$theme->versions = collect( $theme->versions )->sortKeysUsing(fn($a, $b) => version_compare($b, $a))->take( 25 );

foreach ( $theme->versions as $theme_version => $theme_version_url ) {
$theme_cache_file_name = "$cache_dir/theme-$slug-$theme_version.json";
Expand Down