src/Builder.php
public function run($content, $write=false)
    {
        $this->summary = [];
        $this->kirby->cache()->flush();
        $level = 1;

        if ($write) {
            // Kill PHP Error reporting when building pages, to "catch" PHP errors
            // from the pages or their controllers (and plugins etc.). We're going
            // to try to hande it ourselves
            $level = error_reporting();
            $this->shutdown = function () {
                $this->showFatalError();
            };
            register_shutdown_function($this->shutdown);
            error_reporting(0);
        }

        // Empty folder on full site build
        if ($write && $content instanceof Site) {
            $folder = new Folder($this->outputdir);
            $folder->flush();
        }

        // Build each page (possibly several times for multilingual sites)
        foreach($this->getPages($content) as $page) {
            $this->buildPage($page, $write);
        }

        // Copy assets after building pages (so that e.g. thumbs are ready)
        if ($content instanceof Site) {
            foreach ($this->assets as $from=>$to) {
                $this->copyAsset($from, $to, $write);
            }
        }

        // Restore error reporting if building pages worked
        if ($write) {
            error_reporting($level);
            $this->shutdown = function () {};
        }
    }
public function run($content, $write=false)
    {
        $this->summary = [];
        $this->kirby->cache()->flush();
        $level = 1;

        if ($write) {
            // Kill PHP Error reporting when building pages, to "catch" PHP errors
            // from the pages or their controllers (and plugins etc.). We're going
            // to try to hande it ourselves
            $level = error_reporting();
            $this->shutdown = function () {
                $this->showFatalError();
            };
            register_shutdown_function($this->shutdown);
            error_reporting(0);
        }

        // Empty folder on full site build
        if ($write && $content instanceof Site) {
            $folder = new Folder($this->outputdir);
            $folder->flush();
        }

        // Build each page (possibly several times for multilingual sites)
        foreach($this->getPages($content) as $page) {
            $this->buildPage($page, $write);
        }

        // Copy assets after building pages (so that e.g. thumbs are ready)
        if ($content instanceof Site) {
            foreach ($this->assets as $from=>$to) {
                $this->copyAsset($from, $to, $write);
            }
        }

        // Restore error reporting if building pages worked
        if ($write) {
            error_reporting($level);
            $this->shutdown = function () {};
        }
    }
public function run ( $ content , $ write = false ) { $ this -> summary = [ ] ; $ this -> kirby -> cache ( ) -> flush ( ) ; $ level = 1 ; if ( $ write ) { // Kill PHP Error reporting when building pages, to "catch" PHP errors // from the pages or their controllers (and plugins etc.). We're going // to try to hande it ourselves $ level = error_reporting ( ) ; $ this -> shutdown = function ( ) { $ this -> showFatalError ( ) ; } ; register_shutdown_function ( $ this -> shutdown ) ; error_reporting ( 0 ) ; } // Empty folder on full site build if ( $ write && $ content instanceof Site ) { $ folder = new Folder ( $ this -> outputdir ) ; $ folder -> flush ( ) ; } // Build each page (possibly several times for multilingual sites) foreach ( $ this -> getPages ( $ content ) as $ page ) { $ this -> buildPage ( $ page , $ write ) ; } // Copy assets after building pages (so that e.g. thumbs are ready) if ( $ content instanceof Site ) { foreach ( $ this -> assets as $ from => $ to ) { $ this -> copyAsset ( $ from , $ to , $ write ) ; } } // Restore error reporting if building pages worked if ( $ write ) { error_reporting ( $ level ) ; $ this -> shutdown = function ( ) { } ; } }
Build or rebuild static content
@param Page|Pages|Site $content Content to write to the static folder
@param boolean $write Should we actually write files
@return array
Build or rebuild static content