fix: enable TiDB compatibility for service admin list
This commit is contained in:
@@ -19,6 +19,20 @@ if (!defined('ABSPATH')) {
|
|||||||
define('ITSTUDIO_SERVICES_VERSION', '1.0.0');
|
define('ITSTUDIO_SERVICES_VERSION', '1.0.0');
|
||||||
define('ITSTUDIO_SERVICES_PATH', plugin_dir_path(__FILE__));
|
define('ITSTUDIO_SERVICES_PATH', plugin_dir_path(__FILE__));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TiDB disables SQL_CALC_FOUND_ROWS by default, while WordPress admin list
|
||||||
|
* tables still use it for pagination. Enable TiDB's compatibility shim for
|
||||||
|
* every WordPress request so the service list can be queried normally.
|
||||||
|
*/
|
||||||
|
function itstudio_services_enable_tidb_list_compatibility() {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
if ($wpdb instanceof wpdb) {
|
||||||
|
$wpdb->query('SET SESSION tidb_enable_noop_functions = 1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action('plugins_loaded', 'itstudio_services_enable_tidb_list_compatibility', 0);
|
||||||
|
|
||||||
require_once ITSTUDIO_SERVICES_PATH . 'includes/post-type.php';
|
require_once ITSTUDIO_SERVICES_PATH . 'includes/post-type.php';
|
||||||
require_once ITSTUDIO_SERVICES_PATH . 'includes/meta.php';
|
require_once ITSTUDIO_SERVICES_PATH . 'includes/meta.php';
|
||||||
require_once ITSTUDIO_SERVICES_PATH . 'includes/admin.php';
|
require_once ITSTUDIO_SERVICES_PATH . 'includes/admin.php';
|
||||||
|
|||||||
Reference in New Issue
Block a user