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

Incompatibility of latest update with SQLite Integration #1549

Closed
rpeyron opened this issue Mar 9, 2019 · 1 comment
Closed

Incompatibility of latest update with SQLite Integration #1549

rpeyron opened this issue Mar 9, 2019 · 1 comment

Comments

@rpeyron
Copy link

rpeyron commented Mar 9, 2019

Hello,

With the latest update I run into some issues :

  • I was not able to add new redirections with a message with the API call getting a 500 error
  • redirections were not working any more

The message found in the apache error log was

PHP Fatal error: Uncaught Error: Call to a member function get_group_id() on boolean in /home/www/wp-content/plugins/redirection/redirection-admin.php:352
Stack trace:
#0 /home/www/wp-includes/class-wp-hook.php(286): Redirection_Admin->set_default_group(NULL, false)
[...]

Even if the direct cause was the non check of the validity of the parameter $redirect the root cause turns out to be a problem while inserting the new redirection in the database, which was impossible because of the schema not up to date. SQLite does not support "AFTER" keyword that was used in the last schema update, and will fail silently, leaving the database in an unexptected state. (I made a very simple PR to fix the SQLite plugin: aaemnnosttv/wp-sqlite-integration#2 )

Also the SQL code to update the url to the new match_url syntax need to be rewritten to be accepted by SQLite :

UPDATE wp_redirection_items SET regex=0 WHERE regex="";
UPDATE wp_redirection_items SET match_url=lower(url) WHERE regex=0;
UPDATE wp_redirection_items SET match_url=substr(match_url,0,instr(url,'?')) WHERE regex=0 AND match_url like '%?%';
UPDATE wp_redirection_items SET match_url=substr(match_url,0,length(match_url)) WHERE match_url like '%/' AND match_url <> "/";
UPDATE wp_redirection_items SET match_url="/" WHERE match_url = "";

As I am certainly not your only user with SQLite backend, I though that you may want to know that and maybe update the SQL commands that you use for the database upgrade.

Some enhancements also could be nice in the "support" tab to debug that, as maybe a check for latest schema updates (check for 'match_url' for instance) and the ability to force the database upgrader to upgrade again the database.

Thanks for your great plugin.

Best regards

@johngodley
Copy link
Owner

The plugin is designed to work with a standard WP install, which means that it is aimed only at MySQL. The database install and upgrade functions have a 'manual install' button which is provided for users who have a non-standard DB set up. I think this should make it usable enough for anyone using SQLite.

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

2 participants