![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mets.corals.io/wp-content/plugins/wp-mail-smtp/src/Helpers/ |
<?php namespace WPMailSMTP\Helpers; /** * Class for Database functionality. * * @since 3.6.0 */ class DB { /** * The function is used to check if the given index exists in the given table. * * @since 3.6.0 * * @param string $table The table name. * @param string $index The index name. * * @return bool If index exists then return true else returns false. */ public static function index_exists( $table, $index ) { global $wpdb; $query = $wpdb->prepare( 'SELECT COUNT(1) IndexIsThere FROM INFORMATION_SCHEMA.STATISTICS WHERE table_schema = DATABASE() AND table_name = %s AND index_name = %s', $table, $index ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared $result = $wpdb->get_var( $query ); return $result === '1'; } }