Forum Replies Created

Viewing 1 replies (of 1 total)
  • It appears there is a bug that leaves a trailing “.” in the temporary directory name. If you disable “delete temporary files”, you will find index.html in <wpdir>/wp-content/plugins/simply-static/static-files/simply-static-1-timestamp-blogname. (with a period). You can just copy that file over.

    Here is my fix. Probably more lines than required, but I get lost in all of these short-circuit operators. I will send them to the plugin author for a real fix.

    ~/wp-content/plugins/simply-static/includes]% diff -u class-simply-static-archive-creator.php.broken class-simply-static-archive-creator.php
    --- class-simply-static-archive-creator.php.broken	2016-01-18 17:20:38.000000000 +0000
    +++ class-simply-static-archive-creator.php	2016-01-18 17:22:21.000000000 +0000
    @@ -314,10 +314,12 @@
     	 * @return boolean $success Did we successfully save the file?
     	 */
     	protected function save_url_to_file( $path, $content, $is_html ) {
    -		$path_info = pathinfo( $path && $path != '/' ? $path : 'index.html' );
    -
    +
    +	  $relpath = ($path && $path != '/') ? $path : 'index.html';
    +	  $abspath = $this->archive_dir . DIRECTORY_SEPARATOR . $relpath;
    +	  $path_info = pathinfo( $abspath );
     		// Create file directory if it doesn't exist
    -		$file_dir = untrailingslashit( $this->archive_dir ) . ( $path_info['dirname'] ? $path_info['dirname'] : '' );
    +		$file_dir = untrailingslashit( $path_info['dirname']  );
     		if ( empty( $path_info['extension'] ) && $path_info['basename'] == $path_info['filename'] ) {
     			$file_dir .= DIRECTORY_SEPARATOR . $path_info['basename'];
     			$path_info['filename'] = 'index';

Viewing 1 replies (of 1 total)