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

wp-content/plugins folder is not generated #730

Closed
aramcap opened this issue Dec 21, 2020 · 7 comments · Fixed by #788
Closed

wp-content/plugins folder is not generated #730

aramcap opened this issue Dec 21, 2020 · 7 comments · Fixed by #788

Comments

@aramcap
Copy link

aramcap commented Dec 21, 2020

Hi. WP2Static generate all required assets except the folder "plugins".

This is the failed resource request:

scheme: https
filename: /wp-content/plugins/cookie-notice/css/front.min.css
status: 404 NotFound

This is my VM-test info:

### wp-core ###

version: 5.6
https_status: true
multisite: true
user_registration: false
blog_public: 1
default_comment_status: open
environment_type: production
user_count: 1
site_count: 2
network_count: 1
dotorg_communication: true

### wp-active-theme ###

name: Twenty Twenty (twentytwenty)

### wp-plugins-active (5) ###

Cookie Notice: version: 1.3.2
Disable WP Sitemaps: version: 1.2
WP2Static: version: 7.1.6

### wp-server ###

httpd_software: Apache
php_version: 7.4 64bit
php_sapi: apache2handler
max_input_variables: 1000
time_limit: 0
memory_limit: 128M
admin_memory_limit: 256M
max_input_time: -1
upload_max_filesize: 2M
php_post_max_size: 8M
curl_version: 7.64.0 OpenSSL/1.1.1d
suhosin: false
imagick_availability: true
pretty_permalinks: true
htaccess_extra_rules: true

### wp-database ###

extension: mysqli
server_version: 10.5-MariaDB
client_version: mysqlnd 7.4

### wp-constants ###

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /var/www/html/wp-content
WP_PLUGIN_DIR: /var/www/html/wp-content/plugins
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_LOCAL_DEV: undefined
DB_CHARSET: utf8
DB_COLLATE: undefined

### wp-filesystem ###

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable

Thanks!

@john-shaffer
Copy link
Contributor

This problem goes away for me with https://github.com/leonstafford/wp2static-addon-advanced-crawling enabled.

@aramcap
Copy link
Author

aramcap commented Jan 11, 2021

This problem goes away for me with https://github.com/leonstafford/wp2static-addon-advanced-crawling enabled.

Thanks John. I've downloaded the master code from the repo, and I've compiled with composer. Then I've installed in Wordpress with plugin menu > select local file. Now, I can see the pluging "WP2Static Add-on: Advanced Crawling Options" in the Wordpress plugin list, but not in the WP2Static > Addons, neither any options in other menus. Do I have to do something else? Because I've re-generated the static web and the folder "wp-content/plugins" still does not exist.

Thanks! Regards.

@john-shaffer
Copy link
Contributor

john-shaffer commented Jan 11, 2021

You definitely need to see it in the Addon list, and once you see it you'll need to Enable it. The code to add it to the list is very straightforward and runs on every page load, so it sounds like something fundamental is broken. Do you see any messages in your web server's error log?

I've also attached a known-good build that may work for you:
wp2static-addon-advanced-crawling-1.0-alpha-003.zip

Maybe we can force the addon registration to run during plugin activation and error out if it somehow fails, so at least the problem will be immediately obvious.

@aramcap
Copy link
Author

aramcap commented Jan 15, 2021

Thanks for your reply John.

I use WP Multisite and I've discovered that the addon only installs it in the site base, but not in other sites. I've solved easily: in database, I insert the same register from table *_wp2static_addons in the site table *_<<SITE_NUMBER>>_wp2static_addons.

But this not solve the problem. After this I've generated the static site and the problem persists. Here my WP log:

[15/Jan/2021:13:53:14 +0000] "GET /site1com/site1com/wp-includes/css/dist/block-library/style.min.css HTTP/1.1" 404 5813 "-" "WP2Static.com"
[15/Jan/2021:13:53:14 +0000] "GET /site1com/site1com/wp-content/plugins/cookie-notice/css/front.min.css HTTP/1.1" 404 5813 "-" "WP2Static.com"
[15/Jan/2021:13:53:14 +0000] "GET /site1com/site1com/wp-content/themes/hello-elementor/style.min.css HTTP/1.1" 404 5813 "-" "WP2Static.com"
[15/Jan/2021:13:53:14 +0000] "GET /site1com/site1com/wp-content/themes/hello-elementor/theme.min.css HTTP/1.1" 404 5813 "-" "WP2Static.com"
[15/Jan/2021:13:53:15 +0000] "GET /site1com/site1com/wp-content/plugins/cookie-notice/js/front.min.js HTTP/1.1" 404 5813 "-" "WP2Static.com"
[15/Jan/2021:13:53:15 +0000] "GET /site1com/site1com/wp-json/ HTTP/1.1" 404 5813 "-" "WP2Static.com"

Here we can see that the addons search the content in REPLICATED PATH: site1com/site1com.

If you need more information, I am at your service.

Thanks! Regards.

@stefanullinger
Copy link
Contributor

Hi @leonstafford,

I have some similar problem with some of my multisite environments. So far I have tracked down the error to this line of code: https://github.com/leonstafford/wp2static/blob/develop/src/DetectPluginAssets.php#L29

The option active_plugins does not seem to contain network-wide enabled plugins, does it?! There is another option called active_sitewide_plugins in the wp_sitemeta table that contains a list of network-wide active plugins. Maybe you might want to merge them into a single array?

So @aramcap might have activated the cookie-notice plugin network-wide and then the DetectPluginAssets class will not collect the plugin's assets because the active_plugins does not contain this plugin, but active_sitewide_plugins does?!

Best regards
Stefan

@leonstafford
Copy link
Contributor

Many thanks, @stefanullinger, that sounds very helpful!

Could you please confirm if you're using subdomain multisite or subdirectory?

I'm relying on my Lokl project for most of my testing at the moment, which doesn't support multisite today, but may be able to quickly add it in either/both forms. That would be good for me to get more familiar with multisite stuff, else, I have to spin up a VM/VPS.

I've started moving all detection stuff into https://github.com/leonstafford/WordPressURLDetector, so will get this multisite detection stuff into that library and start importing that into WP2Static soon. There's still a bit of work to do on that, though.

If it's taking too long, I may be able to do the quick array_merge suggested here in an interim release.

@stefanullinger
Copy link
Contributor

Hi @leonstafford,

I've tried both multisite options now – using a subdomain multisite, and using a subdirectory multisite. Either way, WordPress will store network active plugins in the active_sitewide_plugins option of the wp_sitemeta table.

I will create a PR on your WordPressURLDetector repository now. Thanks for extracting all of this into a separate library by the way!

Would be cool, if you could provide an update of WP2Static soon, as I have some multisite project running in production, and copying missing files manually slows down the deployment / maintenance of this project a bit.

Best regards
Stefan

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

Successfully merging a pull request may close this issue.

4 participants