patrickposner
Forum Replies Created
-
@madtownlems I’ve added a filter now to make that customisable: https://github.com/Simply-Static/simply-static/commit/e193819b6cafa86d51d8718c25ee57918bbc77fa
We also have a slight refactoring planned for the (pro) integration of MU – instead of having a separate site to pull the data from, we have a more template-based solution.
This would ensure we are not facing any memory-related issues with large networks, while still offering the ability to have multiple “templates” for easy imports.
This doesn’t have a release date yet, but I think the new filter will cover for a while!
Forum: Plugins
In reply to: [Simply Static - The Static Site Generator] All Index Files are Emptyalright, I’ve done some further testing now – it looks like you have a firewall (Cloudflare, maybe?) blocking wp_remote_get (which is used to download the actual HTML from the page).
As soon as I attempt to visit the site (programmatically), I receive a 403 Forbidden error – so it’s probably a rule related to “bots”.
You want to disable that (at least temporarily) to allow Simply Static to access the content and build up the HTML files.
Forum: Plugins
In reply to: [Simply Static - The Static Site Generator] All Index Files are EmptyHey @korndev,
please give this another try with the (just released) 3.5.1.1 version.
@madtownlems added now!
We:
- remove the temp files (including the ZIP)
- clear the DB table
- remove the debug.txt file
on deactivation now!
Hey @caioschiavo,
thanks for reaching out – please come to the pro support via our website – we are not allowed here to talk about the pro version – thanks!
Hey @madtownlems,
appreciate your insights!
I think it makes perfect sense for multisites and version-controlled sites – why not meet in the middle here? I think it’s fine to:
- clear the temporary directory
- clear the DB table (without deleting it)
on deactivation, leaving the rest intact.
Deleting the DB table + the entire simply-static directory is not an option – we are not only running the pro version, but also an entire hosting/deployment platform, so this refactor would take weeks of testing and the upside is almost none.
Proposed solution: https://github.com/Simply-Static/simply-static/commit/49b02f6ba5b0178441329fa506fd06ea92777b1f
- This reply was modified 7 months ago by patrickposner.
Forum: Plugins
In reply to: [Simply Static - The Static Site Generator] Admin Bar and ss_user_capability@madtownlems happy to add that in the next update!
You can also disable that in Simply Static -> Settings -> Integrations -> Admin Bar (Core), btw!
Hey @madtownlems,
I should have made that clearer – the solution triggers only on uninstallation, not on deactivation.
Doing these things on deactivation is pretty uncommon for plugins – especially if you think about bulk deactivation of plugins (this could likely cause a timeout on a shared hosting environment.
I don’t think we’ll add that to the core plugin for now, but I’ll leave a note in my backlog and take a closer look if it might be a fit (after considering all the possible downsides).
Forum: Plugins
In reply to: [Simply Static - The Static Site Generator] Export Filename Suggestions@madtownlems my bad, there is a bug in how we construct the path in the previous code snippet – here is updated (working) one:
add_filter( 'ss_zip_filename', function( $zip_filename, $archive_dir, $options ) {
// Get site name
$site_name = get_bloginfo( 'name' );
if ( ! $site_name ) {
$site_name = 'Site';
}
// Transliterate accents and create a URL-safe slug with dashes
// This preserves ASCII letters/numbers and replaces spaces with dashes
$site_name = remove_accents( $site_name );
$site_name = sanitize_title_with_dashes( $site_name ); // lower-case, dash-separated
// Fallback if it ends up empty (e.g., only symbols/emojis)
if ( '' === $site_name ) {
$site_name = 'site';
}
// Multisite-aware blog/site ID (on single site this is typically 1)
$blog_id = function_exists( 'get_current_blog_id' ) ? (int) get_current_blog_id() : 1;
// Use WordPress timezone for date/time
$ts = current_time( 'timestamp' );
$date = date_i18n( 'Y-m-d', $ts );
// Build a safe basename (no parentheses)
$basename = sprintf(
'simply-static-%s-%d-%s-%d.zip',
$site_name,
$blog_id,
$date,
$ts
);
// Return the full path inside the provided archive directory
$zip_filename = trailingslashit( wp_normalize_path( $archive_dir ) ) . $basename;
return $zip_filename;
}, 10, 3 );good catch, I add an issue and we handle it with the next update!
pretty close to that, haha!
Your feature request is implemented now:
You can enable clearing the temporary directory with this filter now:
add_filter('ss_clear_temp_dir_on_wrapup', '__return_true');There is a new button in Simply Static -> Settings -> Debugging -> Temporary Directory to one-click clear the temporary directory for the current site.
We extended our uninstall.php file now to remove the entire simply-static directory in wp-content/uploads on uninstalling the plugin for better cleanup.
Hey @madtownlems,
the new filters are implemented – here is an example:
add_filter( 'ss_crawlable_plugins', function ( $plugins ) {
unset( $plugins['query-monitor'] );
return $plugins;
} );This also works for themes now:
add_filter( 'ss_crawlable_themes', function ( $themes ) {
unset( $themes['ollie'] );
return $themes;
} );- This reply was modified 7 months, 1 week ago by patrickposner.
Forum: Plugins
In reply to: [Simply Static - The Static Site Generator] Export Filename Suggestions@madtownlems you can (with 3.5.1) change the filename of the ZIP file with the following filter:
add_filter( 'ss_zip_filename', function( $zip_filename, $archive_dir, $options ) {
// Get site name and turn it into a nice dash-separated label while preserving case
$site_name = get_bloginfo( 'name' );
if ( ! $site_name ) {
$site_name = 'Site';
}
// Replace whitespace/underscores with dashes
$site_name = preg_replace( '/[\s_]+/', '-', $site_name );
// Remove anything that isn't a letter, number, or dash
$site_name = preg_replace( '/[^A-Za-z0-9\-]/', '', $site_name );
// Collapse multiple dashes
$site_name = preg_replace( '/-+/', '-', $site_name );
// Trim leading/trailing dashes
$site_name = trim( $site_name, '-' );
// Multisite-aware blog/site ID (on single site this is typically 1)
$blog_id = function_exists( 'get_current_blog_id' ) ? (int) get_current_blog_id() : 1;
// Use WordPress timezone for date/time
$ts = current_time( 'timestamp' );
$date = date_i18n( 'Y-m-d', $ts );
// Build the filename
$zip_filename = sprintf(
'simply-static-%s-ID(%d)-%s-(%d).zip',
$site_name,
$blog_id,
$date,
$ts
);
return $zip_filename;
}, 10, 3 );added now in 3.5.1 (including the site ID)!
Hey @madtownlems,
this should be working just fine now with 3.5.1!
The primary reason why this failed was that we still used PCLZip for this task (which is shipped with WordPress and does not require libzip as an extension).
PCLZip is capped at 4GB (for some reason); anything beyond that will cause a corrupted file. I assume they never considered these file sizes when implementing the library so many years ago.
However, I have now added support for ZipArchive as well. As long as the extension is available, we will utilize ZipArchive, enabling the seamless export of larger sites without any issues.
Cheers,
Patrick