pressbooks/pressbooks

Database errors for users using less than MySQL 8

Opened this issue · 0 comments

Prerequisites

Description

We have a new error popping up in our logs. This error appears to be associated with logging clones in the Pressbooks database:

This is what we are seeing in the logs:

[20-Mar-2024 02:38:34 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(CURRENT_DATE) NOT NULL,
			PRIMARY KEY  (id)
		) DEFAULT CHARACTER SET utf8mb4 ' at line 6 for query CREATE TABLE IF NOT EXISTS wp_pressbooks_completed_clones (
			id bigint(20) NOT NULL AUTO_INCREMENT,
			blog_id bigint(20) NOT NULL,
			target_book_name varchar(255) NOT NULL,
			target_book_url varchar(255) NOT NULL,
			created_at datetime DEFAULT (CURRENT_DATE) NOT NULL,
			PRIMARY KEY  (id)
		) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, Pressbooks\CloneComplete::install, Pressbooks\CloneComplete::createTable, dbDelta

Searching for this error lead us to this page in Stack Overflow:

https://stackoverflow.com/questions/75974335/mysql-error-creating-table-and-trying-current-date-as-default

The posters there imply that you cannot use (CURRENT_DATE) on less than MySQL 8.

System Information

Root Blog Info

Root Blog ID: 1
Root Blog URL: https://pressbooks.sunycreate.cloud/

Browser

Platform: Mac 10.15
Browser Name: Chrome
Browser Version: 121.0
User Agent String: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

WordPress Configuration

Network URL: https://pressbooks.sunycreate.cloud/
Network Type: Subdomain
Version: 6.4.3
Language: en_US
WP_ENV: Not set
WP_DEBUG: Disabled
Memory Limit: 64M

Pressbooks Configuration

Version: 6.17.1
Root Theme: Aldine
Root Theme Version: 1.19.1

Pressbooks Dependencies

Epubcheck: Installed
xmllint: Installed
PrinceXML: Installed
Saxon-HE: Installed

Must-Use Plugins

hm-autoloader.php: n/a

Network Active Plugins

Editoria11y Accessibility Checker: 1.0.13
Koko Analytics: 1.3.7
Limit Login Attempts Reloaded: 2.26.7
Multisite Plugin Manager: 3.1.6
Pressbooks: 6.17.1
Pressbooks Network Catalog: 1.3.4
Pressbooks Stats: 1.9.0
Unconfirmed: 1.3.7
User Switching: 1.7.3

Root Blog Active Plugins

Editoria11y Accessibility Checker: 1.0.13
Koko Analytics: 1.3.7
Limit Login Attempts Reloaded: 2.26.7
Multisite Plugin Manager: 3.1.6
Pressbooks: 6.17.1
Pressbooks Network Catalog: 1.3.4
Pressbooks Stats: 1.9.0
Unconfirmed: 1.3.7
User Switching: 1.7.3

Inactive Plugins

Candela Citation: 0.2.4
Excalibur: 0.7.0
Git Updater: 12.4.0
H5P: 1.15.7
Hypothesis: 0.7.3
Parsedown Party: 1.2.1
Pressbooks Shortcode Handler: 0.1
TablePress: 2.2.5
WordPress Importer: 0.8.2
WP QuickLaTeX: 3.8.6

Server Configuration

PHP Version: 8.1.18
MySQL Version: 5.7.30
Webserver Info: Apache

PHP Configuration

Memory Limit: -1
Upload Max Size: 150M
Post Max Size: 150M
Upload Max Filesize: 150M
Time Limit: 60
Max Input Vars: 5000
URL-aware fopen: On (1)
Display Errors: On (1)

PHP Extensions

OPcache: Disabled
XDebug: Disabled
cURL: Supported
cURL Version: 7.86.0
imagick: Installed
xsl: Installed