littlebizzy / slickstack

Lightning-fast WordPress on Nginx
https://slickstack.io
GNU General Public License v3.0
643 stars 113 forks source link

ss-clean-files directives deleting a WordPress core file htaccess.php #88

Closed timersys closed 3 years ago

timersys commented 3 years ago

I got this file /core/debug/classes/htaccess.php from one plugin that gets deleted and I think the culprit is

This part:

delete apache junk files

find /var/www/html/ -name ".htaccess" -type f -delete find /var/www/html/ -name "htaccess" -type f -delete

I tried commenting out that line, but the file get synced again

jessuppi commented 3 years ago

Thanks for reporting this @timersys

I have heard from a few users that plugins like Elementor Pro were having issues on Nginx/SlickStack due to missing .htaccess files, but I'm not sure if related to /core/debug/classes/htaccess.php being removed (although perhaps so).

Ref: https://wordpress.org/support/topic/php-fatal-error-uncaught-error-when-trying-to-edit/ Ref: Uncaught Error: Class ‘Elementor\Core\Debug\Classes\Htaccess’ not found

Ironically it seems the Elementor debug tools are what's loading htaccess classes, and thus causing fatal errors. In any case, we never want to be deleting core CMS files, so this should fix that:

Ref: https://github.com/littlebizzy/slickstack/commit/e39901eda3acec07de69d879c342ae72b9650589

Now only explicitly .htaccess files (with a period in front) will be force-deleted.

I think the original reason we had deleted non-period versions was because so many clients have literally years of leftover htaccess files from past web designers, etc... like htaccess-old stuff, we had tried to help clean that up.

timersys commented 3 years ago

A solution would be to look for those files outside of wp-content folder, if you still want to take care of them. Thanks for the quick fix