src/ErrorPage.php
public function writeStaticPage()
    {
        if (!self::config()->enable_static_file) {
            return false;
        }

        // Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
        $originalThemes = SSViewer::get_themes();
        try {
            // Restore front-end themes from config
            $themes = SSViewer::config()->get('themes') ?: $originalThemes;
            SSViewer::set_themes($themes);

            // Render page as non-member in live mode
            $response = Member::actAs(null, function () {
                $response = Director::test(Director::makeRelative($this->getAbsoluteLiveLink()));
                return $response;
            });

            $errorContent = $response->getBody();
        } finally {
            // Restore themes
            SSViewer::set_themes($originalThemes);
        }

        // Make sure we have content to save
        if ($errorContent) {
            // Store file content in the default store
            $storeFilename = File::join_paths(
                self::config()->store_filepath,
                $this->getErrorFilename()
            );
            self::get_asset_handler()->setContent($storeFilename, $errorContent);

            return true;
        } else {
            return false;
        }
    }
public function writeStaticPage()
    {
        if (!self::config()->enable_static_file) {
            return false;
        }

        // Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
        $originalThemes = SSViewer::get_themes();
        try {
            // Restore front-end themes from config
            $themes = SSViewer::config()->get('themes') ?: $originalThemes;
            SSViewer::set_themes($themes);

            // Render page as non-member in live mode
            $response = Member::actAs(null, function () {
                $response = Director::test(Director::makeRelative($this->getAbsoluteLiveLink()));
                return $response;
            });

            $errorContent = $response->getBody();
        } finally {
            // Restore themes
            SSViewer::set_themes($originalThemes);
        }

        // Make sure we have content to save
        if ($errorContent) {
            // Store file content in the default store
            $storeFilename = File::join_paths(
                self::config()->store_filepath,
                $this->getErrorFilename()
            );
            self::get_asset_handler()->setContent($storeFilename, $errorContent);

            return true;
        } else {
            return false;
        }
    }
public function writeStaticPage ( ) { if ( ! self :: config ( ) -> enable_static_file ) { return false ; } // Run the page (reset the theme, it might've been disabled by LeftAndMain::init()) $ originalThemes = SSViewer :: get_themes ( ) ; try { // Restore front-end themes from config $ themes = SSViewer :: config ( ) -> get ( 'themes' ) ? : $ originalThemes ; SSViewer :: set_themes ( $ themes ) ; // Render page as non-member in live mode $ response = Member :: actAs ( null , function ( ) { $ response = Director :: test ( Director :: makeRelative ( $ this -> getAbsoluteLiveLink ( ) ) ) ; return $ response ; } ) ; $ errorContent = $ response -> getBody ( ) ; } finally { // Restore themes SSViewer :: set_themes ( $ originalThemes ) ; } // Make sure we have content to save if ( $ errorContent ) { // Store file content in the default store $ storeFilename = File :: join_paths ( self :: config ( ) -> store_filepath , $ this -> getErrorFilename ( ) ) ; self :: get_asset_handler ( ) -> setContent ( $ storeFilename , $ errorContent ) ; return true ; } else { return false ; } }
Write out the published version of the page to the filesystem.

@return true if the page write was successful
Write out the published version of the page to the filesystem .