Repository navigation
Make static WordPress exports public #11
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,6 +123,7 @@ public static function step( | |
| */ | ||
| public static function manifest( string $archive_dir ): array { | ||
| $root = self::archive_root( $archive_dir ); | ||
| self::ensure_public_config( $root ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Keep the empty-export guard effective. Because Line [126] creates 🤖 Prompt for AI Agents |
||
| $files = array(); | ||
| $iterator = new RecursiveIteratorIterator( | ||
| new RecursiveDirectoryIterator( $root, FilesystemIterator::SKIP_DOTS ) | ||
|
|
@@ -162,6 +163,20 @@ public static function reset(): void { | |
| delete_option( self::OPTION ); | ||
| } | ||
|
|
||
| private static function ensure_public_config( string $root ): void { | ||
| $config = $root . DIRECTORY_SEPARATOR . 'sf.jsonc'; | ||
| if ( file_exists( $config ) || is_link( $config ) ) { | ||
| if ( ! is_file( $config ) || is_link( $config ) || ! is_readable( $config ) ) { | ||
| throw new RuntimeException( 'The generated Spacefast configuration is not a readable file.' ); | ||
| } | ||
| return; | ||
| } | ||
| $written = file_put_contents( $config, "{\n \"access\": \"public\"\n}\n", LOCK_EX ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a site already has a restrictive Useful? React with 👍 / 👎. |
||
| if ( false === $written ) { | ||
| throw new RuntimeException( 'The generated export could not be made public on Spacefast.' ); | ||
| } | ||
| } | ||
|
|
||
| private static function archive_root( string $archive_dir ): string { | ||
| $root = realpath( $archive_dir ); | ||
| if ( false === $root || ! is_dir( $root ) || ! is_readable( $root ) ) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When Simply Static produces an empty archive after a crawl or export failure, this call creates
sf.jsoncbefore the existing empty-manifest check runs, so the export is treated as valid. A full export is submitted insnapshotmode bySpacefast_Simply_Static_Publish_Task::perform(), causing Spacefast to replace the live site with a version containing only the config file instead of preserving the current version and reporting that no files were generated.Useful? React with 👍 / 👎.