Skip to content

Commit 41035a0

Browse files
author
Fabien Bagard
committed
Warn when a user has reached 'max_questions' mysql parameter
1 parent 6bc94ef commit 41035a0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/wp-includes/class-wpdb.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,6 +2299,20 @@ public function query( $query ) {
22992299
$this->last_error = __( 'Unable to retrieve the error message from the database server' );
23002300
}
23012301

2302+
// User has reached 'max_questions' stop retrying
2303+
if ( 1226 === $mysql_errno ) {
2304+
$message = '<h1>' . __( 'Cannot query database' ) . "</h1>\n";
2305+
$message .= '<p>' . __( 'The database server could be connected to (which means username and password is okay) but the query could not be performed.' ) . '<br>';
2306+
$message .= sprintf( $this->last_error );
2307+
$message .= '<p>' . sprintf(
2308+
/* translators: %s: Support forums URL. */
2309+
__( 'If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href="%s">WordPress support forums</a>.' ),
2310+
__( 'https://wordpress.org/support/forums/' )
2311+
) . "</p>\n";
2312+
2313+
wp_die( $message );
2314+
}
2315+
23022316
if ( $this->last_error ) {
23032317
// Clear insert_id on a subsequent failed insert.
23042318
if ( $this->insert_id && preg_match( '/^\s*(insert|replace)\s/i', $query ) ) {

0 commit comments

Comments
 (0)