endevver / mt-plugin-cleansweep

A Movable Type plugin to help administrators manage 404s on their site and redirect users to the proper/desired content.
1 stars 1 forks source link

DBD::mysql::st execute failed: Column 'cleansweep_log_uri' cannot be null #1

Open CNG opened 10 years ago

CNG commented 10 years ago

Hi there,

I tried the MT5 branch of this plugin on a clone of movabletype.org installation, running MT6.0.3, and while the setup appeared to work fine, I get an error upon visiting a page that should return a 404:

Failed to execute INSERT INTO mt_cleansweep_log (cleansweep_log_all_time_occur, cleansweep_log_blog_id, cleansweep_log_created_by, cleansweep_log_created_on, cleansweep_log_full_uri, cleansweep_log_last_requested, cleansweep_log_mapping, cleansweep_log_modified_by, cleansweep_log_modified_on, cleansweep_log_occur, cleansweep_log_return_code, cleansweep_log_uri) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) with all_time_occur, blog_id, created_by, created_on, full_uri, last_requested, mapping, modified_by, modified_on, occur, return_code, uri: DBD::mysql::st execute failed: Column 'cleansweep_log_uri' cannot be null

Possibly of note, I had to modify the configuration for Apache from what CleanSweep suggested because I have mt.cgi accessibly only through a subdomain on my test setup:

<Location /documentation/>
  ErrorDocument 404 http://cgi.example.us/mt/mt.cgi?__mode=404&blog_id=16
</Location>

I should try on a fresh MT6 installation to isolate any issues specific to this install, but feel free to let me know if you think you know why this is happening. Thank you!

CNG commented 10 years ago

I tried fresh installations of MT6.0.2 and MT5.2.9, as well as MT4.381 with version 1.2.3 of this plugin, and I get the same DB error for all three.

CNG commented 10 years ago

After reviewing the code, I realized $ENV{'REQUEST_URI'} contained the MT page mt.cgi?__mode=404&blog_id=2 instead of the failed URL. This is because using a "remote" URL in the ErrorDocument Apache directive causes a redirect. Consequently, I don't think this plugin can be used on installations where MT is only accessible by a different domain without further Apache directives to rewrite a relative URL in the ErrorDocument directive.

CNG commented 8 years ago

I got almost the same error again, this time unrelated to the cause I mentioned last time. This time, I needed to change the http to https at https://github.com/endevver/mt-plugin-cleansweep/blob/master/plugins/CleanSweep/lib/CleanSweep/CMS.pm#L26

CNG commented 8 years ago

Which could perhaps be replaced with something like:

( $ENV{'HTTPS'} eq 'on' ? 'https://' : 'http://' )

I don't claim to have tested that though.