Plugin Directory

Changeset 3481612


Ignore:
Timestamp:
03/13/2026 01:41:45 AM (3 weeks ago)
Author:
PerS
Message:

Update to version 1.11.0 from GitHub

Location:
super-admin-all-sites-menu
Files:
4 added
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • super-admin-all-sites-menu/tags/1.11.0/build/index.asset.php

    r3481584 r3481612  
    1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => '858836a4af2aff25e4e4');
     1<?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => '9e73d87177e6f0887ecc');
  • super-admin-all-sites-menu/tags/1.11.0/build/index.js

    r3481584 r3481612  
    11/*!
    22 * super-admin-all-sites-menu
    3  * version: 1.10.0
     3 * version: 1.11.0
    44 * address: https://github.com/soderlind/super-admin-all-sites-menu#readme
    55 * author:  Per Søderlind
  • super-admin-all-sites-menu/tags/1.11.0/readme.txt

    r3481584 r3481612  
    11=== Super Admin All Sites Menu ===
    2 Stable tag: 1.10.0
     2Stable tag: 1.11.0
    33Requires at least: 5.6 
    44Tested up to: 7.0 
     
    122122== Changelog ==
    123123
     124= 1.11.0 =
     125* Performance: Replaced per-site WP_Site::get_details() calls with a single batch SQL query, eliminating hidden switch_to_blog() overhead in the REST endpoint
     126
     127= 1.10.1 =
     128* Updated: @wordpress/scripts 30.7.0 → 31.6.0
     129* Updated: dexie 4.0.11 → 4.2.0
     130* Security: Resolved Dependabot alerts #102, #104, #108, #109 (minimatch ReDoS, serialize-javascript RCE, @tootallnate/once)
     131* Changed: Added npm overrides for transitive dependency vulnerabilities (0 audit findings)
     132
    124133= 1.10.0 =
    125134* Added: Filterable per-site submenu items via `all_sites_menu_submenu_items` filter (#46)
  • super-admin-all-sites-menu/tags/1.11.0/super-admin-all-sites-menu.php

    r3481584 r3481612  
    1313 * GitHub Plugin URI: https://github.com/soderlind/super-admin-all-sites-menu
    1414 * Description: For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu.
    15  * Version:     1.10.0
     15 * Version:     1.11.0
    1616 * Author:      Per Soderlind
    1717 * Network:     true
     
    349349            ]
    350350        );
     351
     352        // Batch-fetch blogname + siteurl for all sites in one query,
     353        // avoiding per-site switch_to_blog() calls from WP_Site::get_details().
     354        $site_options = $this->batch_get_site_options( $sites );
     355
    351356        $menu      = [];
    352357        $timestamp = $this->get_timestamp();
     
    354359
    355360            $blogid   = $site->blog_id;
    356             $blogname = $site->__get( 'blogname' );
     361            $blogname = $site_options[ $blogid ]['blogname'] ?? '';
    357362            $menu_id  = 'blog-' . $blogid;
    358363            $blavatar = '<div class="blavatar"></div>';
    359             $siteurl  = $site->__get( 'siteurl' );
     364            $siteurl  = $site_options[ $blogid ]['siteurl'] ?? $site->siteurl;
    360365            $adminurl = $siteurl . '/wp-admin';
    361366
     
    507512
    508513    /**
     514     * Batch-fetch blogname and siteurl for multiple sites in a single SQL query.
     515     *
     516     * Uses $wpdb->get_blog_prefix() (a pure function with no side effects) to
     517     * build a UNION ALL query, avoiding the per-site switch_to_blog() calls
     518     * that WP_Site::get_details() triggers internally.
     519     *
     520     * @param array $sites Array of WP_Site objects.
     521     * @return array<int, array{blogname: string, siteurl: string}> Keyed by blog_id.
     522     */
     523    private function batch_get_site_options( array $sites ): array {
     524        if ( [] === $sites ) {
     525            return [];
     526        }
     527
     528        global $wpdb;
     529
     530        $union_parts = [];
     531        foreach ( $sites as $site ) {
     532            $prefix        = $wpdb->get_blog_prefix( (int) $site->blog_id );
     533            $table         = $prefix . 'options';
     534            $union_parts[] = $wpdb->prepare(
     535                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name is built from $wpdb->get_blog_prefix().
     536                "SELECT %d AS blog_id, option_name, option_value FROM {$table} WHERE option_name IN ('blogname','siteurl')",
     537                (int) $site->blog_id
     538            );
     539        }
     540
     541        // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- each part is prepared above.
     542        $rows = $wpdb->get_results( implode( ' UNION ALL ', $union_parts ) );
     543
     544        $options = [];
     545        foreach ( $rows as $row ) {
     546            $options[ (int) $row->blog_id ][ $row->option_name ] = $row->option_value;
     547        }
     548
     549        return $options;
     550    }
     551
     552    /**
    509553     * Get number of sites.
    510554     *
  • super-admin-all-sites-menu/trunk/build/index.asset.php

    r3481584 r3481612  
    1 <?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => '858836a4af2aff25e4e4');
     1<?php return array('dependencies' => array('wp-api-fetch', 'wp-i18n'), 'version' => '9e73d87177e6f0887ecc');
  • super-admin-all-sites-menu/trunk/build/index.js

    r3481584 r3481612  
    11/*!
    22 * super-admin-all-sites-menu
    3  * version: 1.10.0
     3 * version: 1.11.0
    44 * address: https://github.com/soderlind/super-admin-all-sites-menu#readme
    55 * author:  Per Søderlind
  • super-admin-all-sites-menu/trunk/readme.txt

    r3481584 r3481612  
    11=== Super Admin All Sites Menu ===
    2 Stable tag: 1.10.0
     2Stable tag: 1.11.0
    33Requires at least: 5.6 
    44Tested up to: 7.0 
     
    122122== Changelog ==
    123123
     124= 1.11.0 =
     125* Performance: Replaced per-site WP_Site::get_details() calls with a single batch SQL query, eliminating hidden switch_to_blog() overhead in the REST endpoint
     126
     127= 1.10.1 =
     128* Updated: @wordpress/scripts 30.7.0 → 31.6.0
     129* Updated: dexie 4.0.11 → 4.2.0
     130* Security: Resolved Dependabot alerts #102, #104, #108, #109 (minimatch ReDoS, serialize-javascript RCE, @tootallnate/once)
     131* Changed: Added npm overrides for transitive dependency vulnerabilities (0 audit findings)
     132
    124133= 1.10.0 =
    125134* Added: Filterable per-site submenu items via `all_sites_menu_submenu_items` filter (#46)
  • super-admin-all-sites-menu/trunk/super-admin-all-sites-menu.php

    r3481584 r3481612  
    1313 * GitHub Plugin URI: https://github.com/soderlind/super-admin-all-sites-menu
    1414 * Description: For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu.
    15  * Version:     1.10.0
     15 * Version:     1.11.0
    1616 * Author:      Per Soderlind
    1717 * Network:     true
     
    349349            ]
    350350        );
     351
     352        // Batch-fetch blogname + siteurl for all sites in one query,
     353        // avoiding per-site switch_to_blog() calls from WP_Site::get_details().
     354        $site_options = $this->batch_get_site_options( $sites );
     355
    351356        $menu      = [];
    352357        $timestamp = $this->get_timestamp();
     
    354359
    355360            $blogid   = $site->blog_id;
    356             $blogname = $site->__get( 'blogname' );
     361            $blogname = $site_options[ $blogid ]['blogname'] ?? '';
    357362            $menu_id  = 'blog-' . $blogid;
    358363            $blavatar = '<div class="blavatar"></div>';
    359             $siteurl  = $site->__get( 'siteurl' );
     364            $siteurl  = $site_options[ $blogid ]['siteurl'] ?? $site->siteurl;
    360365            $adminurl = $siteurl . '/wp-admin';
    361366
     
    507512
    508513    /**
     514     * Batch-fetch blogname and siteurl for multiple sites in a single SQL query.
     515     *
     516     * Uses $wpdb->get_blog_prefix() (a pure function with no side effects) to
     517     * build a UNION ALL query, avoiding the per-site switch_to_blog() calls
     518     * that WP_Site::get_details() triggers internally.
     519     *
     520     * @param array $sites Array of WP_Site objects.
     521     * @return array<int, array{blogname: string, siteurl: string}> Keyed by blog_id.
     522     */
     523    private function batch_get_site_options( array $sites ): array {
     524        if ( [] === $sites ) {
     525            return [];
     526        }
     527
     528        global $wpdb;
     529
     530        $union_parts = [];
     531        foreach ( $sites as $site ) {
     532            $prefix        = $wpdb->get_blog_prefix( (int) $site->blog_id );
     533            $table         = $prefix . 'options';
     534            $union_parts[] = $wpdb->prepare(
     535                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- table name is built from $wpdb->get_blog_prefix().
     536                "SELECT %d AS blog_id, option_name, option_value FROM {$table} WHERE option_name IN ('blogname','siteurl')",
     537                (int) $site->blog_id
     538            );
     539        }
     540
     541        // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- each part is prepared above.
     542        $rows = $wpdb->get_results( implode( ' UNION ALL ', $union_parts ) );
     543
     544        $options = [];
     545        foreach ( $rows as $row ) {
     546            $options[ (int) $row->blog_id ][ $row->option_name ] = $row->option_value;
     547        }
     548
     549        return $options;
     550    }
     551
     552    /**
    509553     * Get number of sites.
    510554     *
Note: See TracChangeset for help on using the changeset viewer.