@@ -12,6 +12,10 @@ $query_author = 'wordpressdotorg';
1212$ extra_plugins = [ 'akismet ' , 'bbpress ' , 'buddypress ' , 'woocommerce ' , 'wordpress-importer ' ];
1313$ extra_themes = [ 'twentyseventeen ' , 'twentynineteen ' , 'twentytwenty ' , 'twentytwentyone ' ];
1414
15+ // Skipped themes and plugins.
16+ $ skip_plugins = [ 'performance-lab ' ];
17+ $ skip_themes = [];
18+
1519// Config directory and filenames
1620$ config_dir = $ root . '/config ' ;
1721$ config_languages = $ config_dir . '/languages-info.json ' ;
@@ -47,16 +51,14 @@ if ( should_refresh_cache( $cache_file_versions, HOUR_IN_SECONDS * 3 ) ) {
4751 // Get available WordPress versions
4852 try {
4953 $ wp_versions = collect ( req ( $ api_versions ) )
50- ->mapToGroups ( function ( $ item , $ key ) {
51- return [ $ item => $ key ];
52- } );
54+ ->mapToGroups ( fn ( $ item , $ key ) => [ $ item => $ key ] );
5355
5456 // Latest version to get the available languages
5557 $ latest = $ wp_versions ->get ( 'latest ' )->first ();
5658 // Versions we still fetch
57- $ outdated = $ wp_versions ->get ( 'outdated ' )->values ();
59+ $ outdated = collect ( $ wp_versions ->get ( 'outdated ' ))-> reverse ()-> take ( 25 )->values ();
5860 // Versions we drop from the repository to save time
59- $ insecure = $ wp_versions ->get ( 'insecure ' )->values ();
61+ $ insecure = collect ( $ wp_versions ->get ( 'insecure ' ))-> reverse ()-> take ( 14 )->values ();
6062
6163 cache ( [
6264 'outdated ' => $ outdated ,
@@ -158,15 +160,13 @@ if ( should_refresh_cache( $cache_file_core_themes, HOUR_IN_SECONDS * 3 ) ) {
158160 }
159161
160162 $ themes = collect ( $ themes )
161- ->mapWithKeys ( function ( $ theme ) {
162- return [
163- $ theme ->slug => [
164- 'name ' => $ theme ->name ,
165- 'slug ' => $ theme ->slug ,
166- 'versions ' => $ theme ->versions ,
167- ],
168- ];
169- } );
163+ ->mapWithKeys ( fn ( $ theme ) => [
164+ $ theme ->slug => [
165+ 'name ' => $ theme ->name ,
166+ 'slug ' => $ theme ->slug ,
167+ 'versions ' => collect ($ theme ->versions )->sortKeysDesc ()->take ( 20 ),
168+ ],
169+ ] );
170170
171171 cache ( [ 'themes ' => $ themes ], $ cache_file_core_themes );
172172 }
@@ -212,15 +212,13 @@ if ( should_refresh_cache( $cache_file_core_plugins ) ) {
212212 }
213213
214214 $ plugins = collect ( $ plugins )
215- ->map ( function ( $ plugin ) {
216- return [
217- $ plugin ->slug => [
218- 'name ' => $ plugin ->name ,
219- 'slug ' => $ plugin ->slug ,
220- 'versions ' => $ plugin ->versions ,
221- ],
222- ];
223- } );
215+ ->map ( fn ( $ plugin ) => [
216+ $ plugin ->slug => [
217+ 'name ' => $ plugin ->name ,
218+ 'slug ' => $ plugin ->slug ,
219+ 'versions ' => collect ($ plugin ->versions )->sortKeysDesc ()->take ( 20 ),
220+ ],
221+ ] );
224222
225223 cache ( [ 'plugins ' => $ plugins ], $ cache_file_core_plugins );
226224 }
@@ -290,6 +288,10 @@ $plugins = collect( get_cached( $cache_file_core_plugins )->get( 'plugins', [] )
290288foreach ( $ plugins as $ plugin ) {
291289 $ plugin = (object ) collect ( $ plugin )->toArray ();
292290
291+ if ( \in_array ( $ plugin ->slug , $ skip_plugins , true ) ) {
292+ continue ;
293+ }
294+
293295 if ( empty ( $ plugin ->versions ) ) {
294296 continue ;
295297 }
@@ -356,11 +358,18 @@ foreach ( $themes as $theme ) {
356358 $ theme = (object ) $ theme ;
357359 $ slug = $ theme ->slug ?? '' ;
358360
361+ if ( \in_array ( $ slug , $ skip_themes , true ) ) {
362+ continue ;
363+ }
364+
359365 if ( empty ( $ theme ->versions ) ) {
360366 msg ( 'Theme has no versions: ' . $ slug );
361367 continue ;
362368 }
363369
370+ // Only keep 10 theme versions.
371+ $ theme ->versions = collect ( $ theme ->versions )->sortKeys ()->reverse ()->take ( 10 );
372+
364373 foreach ( $ theme ->versions as $ theme_version => $ theme_version_url ) {
365374 $ theme_cache_file_name = "$ cache_dir/theme- $ slug- $ theme_version.json " ;
366375
@@ -470,7 +479,7 @@ foreach ( $core as $language => $versions ) {
470479
471480 foreach ( $ versions as $ version => $ dist ) {
472481 $ required = [
473- 'koodimonni/composer-dropin-installer ' => '>=0.2.3 ' ,
482+ 'koodimonni/composer-dropin-installer ' => '^1 ' ,
474483 ];
475484
476485 foreach ( $ components as $ component ) {
@@ -487,7 +496,7 @@ foreach ( $core as $language => $versions ) {
487496 }
488497
489498 $ description = sprintf (
490- 'Full Wordpress translation (including themes and core plugins) for %s ' ,
499+ 'Full WordPress translation (including themes and core plugins) for %s ' ,
491500 $ language
492501 );
493502 if ( ! empty ( $ lang_name ) ) {
0 commit comments