Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirection Plugin: Error During Setup #76

Open
useAnder opened this issue Feb 28, 2024 · 1 comment
Open

Redirection Plugin: Error During Setup #76

useAnder opened this issue Feb 28, 2024 · 1 comment

Comments

@useAnder
Copy link

useAnder commented Feb 28, 2024

I really like the project. I'm testing it on some business sites, and it works perfectly.

But I am encountering an error while setting up the popular plugin Redirection by John Godley (https://wordpress.org/plugins/redirection/).

The plugin installs and activates without any problems. However, when I proceed with the setup process, I receive the following error message:


Database problem
Failed to perform query "CREATE TABLE IF NOT EXISTS wp_redirection_items(idint(11) unsigned NOT NULL AUTO_INCREMENT,urlmediumtext NOT NULL,match_urlVARCHAR(2000) DEFAULT NULL,match_dataTEXT,regexINT(11) unsigned NOT NULL DEFAULT '0',positionINT(11) unsigned NOT NULL DEFAULT '0',last_countINT(10) unsigned NOT NULL DEFAULT '0',last_accessdatetime NOT NULL DEFAULT '1970-01-01 00:00:00',group_idINT(11) NOT NULL DEFAULT '0',statusenum('enabled','disabled') NOT NULL DEFAULT 'enabled',action_typeVARCHAR(20) NOT NULL,action_codeINT(11) unsigned NOT NULL,action_dataMEDIUMTEXT,match_typeVARCHAR(20) NOT NULL,title TEXT, PRIMARY KEY (id), KEY url (url(191)), KEY status (status), KEY regex (regex), KEY group_idpos (group_id,position), KEY group (group_id), KEY match_url (match_url(191)) ) DEFAULT CHARACTER SET utf8mb4"


I thought it was a good idea to let you know that while the aim is to make this compatible with all plugins, (apologies if this is already known).

Is there anything I can adjust in my configuration to make this plugin work, or some plugin adjustments is needed?

image

@useAnder
Copy link
Author

Turns out that plugin showed the following sql statements to run manually:

CREATE TABLE IF NOT EXISTS wp_redirection_items(idint(11) unsigned NOT NULL AUTO_INCREMENT,urlmediumtext NOT NULL,match_urlVARCHAR(2000) DEFAULT NULL,match_dataTEXT,regexINT(11) unsigned NOT NULL DEFAULT '0',positionINT(11) unsigned NOT NULL DEFAULT '0',last_countINT(10) unsigned NOT NULL DEFAULT '0',last_accessdatetime NOT NULL DEFAULT '1970-01-01 00:00:00',group_idINT(11) NOT NULL DEFAULT '0',statusenum('enabled','disabled') NOT NULL DEFAULT 'enabled',action_typeVARCHAR(20) NOT NULL,action_codeINT(11) unsigned NOT NULL,action_dataMEDIUMTEXT,match_typeVARCHAR(20) NOT NULL,title TEXT, PRIMARY KEY (id), KEY url (url(191)), KEY status (status), KEY regex (regex), KEY group_idpos (group_id,position), KEY group (group_id), KEY match_url (match_url`(191))
) DEFAULT CHARACTER SET utf8mb4;

CREATE TABLE IF NOT EXISTS wp_redirection_groups (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
tracking INT(11) NOT NULL DEFAULT '1',
module_id INT(11) unsigned NOT NULL DEFAULT '0',
status enum('enabled','disabled') NOT NULL DEFAULT 'enabled',
position INT(11) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (id),
KEY module_id (module_id),
KEY status (status)
) DEFAULT CHARACTER SET utf8mb4;

CREATE TABLE IF NOT EXISTS wp_redirection_logs (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
created datetime NOT NULL,
url MEDIUMTEXT NOT NULL,
domain VARCHAR(255) DEFAULT NULL,
sent_to MEDIUMTEXT,
agent MEDIUMTEXT,
referrer MEDIUMTEXT,
http_code INT(11) unsigned NOT NULL DEFAULT '0',
request_method VARCHAR(10) DEFAULT NULL,
request_data MEDIUMTEXT,
redirect_by VARCHAR(50) DEFAULT NULL,
redirection_id INT(11) unsigned DEFAULT NULL,
ip VARCHAR(45) DEFAULT NULL,
PRIMARY KEY (id),
KEY created (created),
KEY redirection_id (redirection_id),
KEY ip (ip)
) DEFAULT CHARACTER SET utf8mb4;

CREATE TABLE IF NOT EXISTS wp_redirection_404 (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
created datetime NOT NULL,
url MEDIUMTEXT NOT NULL,
domain VARCHAR(255) DEFAULT NULL,
agent VARCHAR(255) DEFAULT NULL,
referrer VARCHAR(255) DEFAULT NULL,
http_code INT(11) unsigned NOT NULL DEFAULT '0',
request_method VARCHAR(10) DEFAULT NULL,
request_data MEDIUMTEXT,
ip VARCHAR(45) DEFAULT NULL,
PRIMARY KEY (id),
KEY created (created),
KEY referrer (referrer(191)),
KEY ip (ip)
) DEFAULT CHARACTER SET utf8mb4;`

Of course sqlite doesnt understand it. Using gpt I translated to sqlite sintax, as following:

CREATE TABLE IF NOT EXISTS wp_redirection_items(idINTEGER PRIMARY KEY,urlTEXT NOT NULL,match_urlVARCHAR(2000),match_dataTEXT,regexINTEGER NOT NULL DEFAULT 0,positionINTEGER NOT NULL DEFAULT 0,last_countINTEGER NOT NULL DEFAULT 0,last_accessTEXT NOT NULL DEFAULT '1970-01-01 00:00:00',group_idINTEGER NOT NULL DEFAULT 0,statusTEXT NOT NULL DEFAULT 'enabled',action_typeVARCHAR(20) NOT NULL,action_codeINTEGER NOT NULL,action_dataTEXT,match_typeVARCHAR(20) NOT NULL,title TEXT, FOREIGN KEY (group_id) REFERENCES wp_redirection_groups(id`)
);

CREATE TABLE IF NOT EXISTS wp_redirection_groups (
id INTEGER PRIMARY KEY,
name VARCHAR(50) NOT NULL,
tracking INTEGER NOT NULL DEFAULT 1,
module_id INTEGER NOT NULL DEFAULT 0,
status TEXT NOT NULL DEFAULT 'enabled',
position INTEGER NOT NULL DEFAULT 0
);

CREATE TABLE IF NOT EXISTS wp_redirection_logs (
id INTEGER PRIMARY KEY,
created TEXT NOT NULL,
url TEXT NOT NULL,
domain VARCHAR(255),
sent_to TEXT,
agent TEXT,
referrer TEXT,
http_code INTEGER NOT NULL DEFAULT 0,
request_method VARCHAR(10),
request_data TEXT,
redirect_by VARCHAR(50),
redirection_id INTEGER,
ip VARCHAR(45),
FOREIGN KEY (redirection_id) REFERENCES wp_redirection_items(id)
);

CREATE TABLE IF NOT EXISTS wp_redirection_404 (
id INTEGER PRIMARY KEY,
created TEXT NOT NULL,
url TEXT NOT NULL,
domain VARCHAR(255),
agent VARCHAR(255),
referrer VARCHAR(255),
http_code INTEGER NOT NULL DEFAULT 0,
request_method VARCHAR(10),
request_data TEXT,
ip VARCHAR(45)
);
`
After that, plugin is working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant