.htaccess error message FIX hack
-
So I’m not much of a PHP programmer, and OO code really makes my head hurt, but I’ve got over 100 sites using this plugin and the error message about “Stop XML-RPC Attack Plugin Error: Could not write to .htaccess file. Check your file permissions and then re-generate your .htaccess from the plugin settings page.” is really getting tired. So I tried looking in to it today.
It appears that under some circumstances the init() action is not getting called, because when that error occurs it’s because the $this->htaccessFile is actually not set and it’s trying to create/modify/whatever a file with literally no name. I have a very hackish solution, here’s the diff:
(5) diff -c stop-xmlrpc-attack.php.ORIG stop-xmlrpc-attack.php
*** stop-xmlrpc-attack.php.ORIG 2016-12-18 17:00:49.702906622 -0500
— stop-xmlrpc-attack.php 2016-12-18 16:53:40.422928706 -0500
***************
*** 283,288 ****
— 283,289 —-
}function write_to_htaccess($data) {
+ if ($this->htaccessFile == ”) { $this->init(); }
if (@file_put_contents($this->htaccessFile, $data) === false) {
update_site_option(‘stop_xmlrpc_attack_error’, ‘Could not write to ‘ . $this->htaccessFile . ‘ file. Check your file permissions and then re-generate your .htaccess from the plugin settings page.’);
} else {Yes, that is adding a line that literally checks to see if the htaccessFile location is an empty string, and if it is, calls the init() function. It quits complaining this way.
Anyone out there better at this than I am care to create a better fix? This is the only plugin that does exactly what it does, so getting this fixed and the plugin tested with current WP and the whole thing updated would be pretty awesome…
- The topic ‘.htaccess error message FIX hack’ is closed to new replies.