Does Simpler Static work on multisites?

Hi there,

I see Leon made a fork of Simply Static called Simpler Static but for some reason it can not be activated, I tried both Version 0.1 and Version 0.2, and I get the following ‘Plugin could not be activated because it triggered a fatal error .’ errors:

Note: I’m using a multisite install in dreamhost shared plan.

Version 0.1:

Fatal error : Uncaught Error: Class ‘SimplerStatic\Plugin’ not found in /SITE_URL/wp-content/plugins/simplerstatic-master/simplerstatic.php:39 Stack trace: #0 /SITE_URL/wp-admin/includes/plugin.php(2255): include() #1 /SITE_URL/wp-admin/plugins.php(177): plugin_sandbox_scrape(‘simplerstatic-m…’) #2 {main} thrown in /SITE_URL/wp-content/plugins/simplerstatic-master/simplerstatic.php on line 39

Version 0.2:

Fatal error : Cannot declare class phpUri, because the name is already in use in /SITE_URL/wp-content/plugins/simplerstatic/includes/libraries/phpuri.php on line 21

Any idea how to fix this?

Thanks.

Hi @vegantraveler,

Very sorry for the delayed response - I’ve been out of action with some mental health issues.

Hmm, I’ve not seen that error and was sure I’d been testing SimplerStatic in that latest release without issues, but looking at the code, it does seem at risk of such an error around that file (not namespaced like other libraries in the plugin). I’ll create an issue for it on GitHub to be fixed.

Re multisite compatibility, that part shouldn’t have really changed from original SimplyStatic, so if you can confirm that works in multisite, should be fine for SimplerStatic.

In the meantime, you may try 0.1 again, but this time use the zip I attached to the releases page, not the one GitHub provides by default (one of annoying things with GitHub release pages): https://github.com/WP2Static/simplerstatic/files/4637884/simplerstatic-0.1.zip

Hi Leon, thanks for your reply! Hope you get that health issue sorted out man.

So, I installed that version you gave me and while doing that realized something, that even though Simply Static was “deactivated” it was the cause of the issue, because as soon as I deleted the plugin files, then Simpler Static installed without any problem.

1 Like

Cheers!

Ah, yes, that makes sense. It will still get fixed in SimplerStatic as best practice, as it doesn’t properly avoid potential conflicts.

The reason being that both SimplyStatic and SimplerStatic were trying to load that same library in without properly encapsulating it/containing it within themselves, so when one was deactivated, other is fine.

Glad it’s working!

Yes, and the weird this is that the conflict happened even when Simply Static was deactivated, I had to totally remove Simply Static before Simpler Static could be installed.

By the way, I just ran some tests and works nicely, thanks for making this fork man, you are a savior. There is a little thing I’ve never seen before:

[2020-08-14 05:56:53] Setting up
[2020-08-14 05:56:55] Fetched 322 of 322 pages/files
[2020-08-14 05:58:39] Class doesn’t exist: SimplerStatic\Transfer_files_locally_Task
[2020-08-14 05:58:39] Done! Finished in 00:01:48

That “Class doesn’t exist: SimplerStatic\Transfer_files_locally_Task”

And the files were not moved to the specified final folder, just stayed on the temporary one.

Not a big deal as I can move them myself, but any idea what might be the cause?

Cool that it worked for you (with workaround!).

Not sure about how that error surfaced for you. Admittedly, my testing of SimplerStatic was fairly limited, perhaps I only used Zip deploy method, yes, that’s likely the case.

I’ve put this bug at https://github.com/WP2Static/simplerstatic/issues/11 for when I next get into the code. Again, likely namespacing related, as SimplyStatic had no namespacing to isolate classes to the one plugin, so I did a lot of edits to get that all in place, but seems missed a few! Lack of any automated tests also left bugs like this more likely.

Will try to do some nice improvements next round of working on it - there’s some contributed code/solutions for something waiting from a great PHP/WordPress dev in a pull request on GitHub for me to look at, too.

If you find any issues/things you want improved, please feel free to add as an issue in that GitHub repository: https://github.com/WP2Static/simplerstatic/issues