HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/globfdxw/www/wp-content/plugins/give/src/Framework/Database/Actions/EnableBigSqlSelects.php
<?php

declare(strict_types=1);

namespace Give\Framework\Database\Actions;

class EnableBigSqlSelects
{
    /**
     * @since 2.22.0
     *
     * Enables mysql big selects for the session using a session system variable.
     *
     * This is necessary for hosts that have an arbitrary MAX_JOIN_SIZE limit, which prevents more complex queries from
     * running properly. Setting SQL_BIG_SELECTS ignores this limit. This is also done by WooCommerce, supporting the
     * idea that this is a viable option. There also doesn't seem to be a way for hosts to prevent this.
     *
     * @see https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_sql_big_selects
     * @see https://dev.mysql.com/doc/refman/5.7/en/system-variable-privileges.html
     *
     */
    public function __invoke()
    {
        static $bigSelects = false;

        if (!$bigSelects) {
            global $wpdb;

            $wpdb->query('SET SESSION SQL_BIG_SELECTS=1;');

            $bigSelects = true;
        }
    }
}