protected function completeJob()
    {
        $content = '<?xml version="1.0" encoding="UTF-8"?>' .
                    '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
        $content .= file_get_contents($this->tempFile);
        $content .= '</urlset>';

        $sitemap = Director::baseFolder() . '/sitemap.xml';

        file_put_contents($sitemap, $content);

        if (file_exists($this->tempFile)) {
            unlink($this->tempFile);
        }

        $nextgeneration = Injector::inst()->create(GenerateGoogleSitemapJob::class);
        QueuedJobService::singleton()->queueJob(
            $nextgeneration,
            DBDatetime::create()->setValue(
                DBDatetime::now()->getTimestamp() + $this->config()->get('regenerate_time')
            )->Rfc2822()
        );
    }
protected function completeJob()
    {
        $content = '<?xml version="1.0" encoding="UTF-8"?>' .
                    '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
        $content .= file_get_contents($this->tempFile);
        $content .= '</urlset>';

        $sitemap = Director::baseFolder() . '/sitemap.xml';

        file_put_contents($sitemap, $content);

        if (file_exists($this->tempFile)) {
            unlink($this->tempFile);
        }

        $nextgeneration = Injector::inst()->create(GenerateGoogleSitemapJob::class);
        QueuedJobService::singleton()->queueJob(
            $nextgeneration,
            DBDatetime::create()->setValue(
                DBDatetime::now()->getTimestamp() + $this->config()->get('regenerate_time')
            )->Rfc2822()
        );
    }
protected function completeJob ( ) { $ content = '<?xml version="1.0" encoding="UTF-8"?>' . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' ; $ content .= file_get_contents ( $ this -> tempFile ) ; $ content .= '</urlset>' ; $ sitemap = Director :: baseFolder ( ) . '/sitemap.xml' ; file_put_contents ( $ sitemap , $ content ) ; if ( file_exists ( $ this -> tempFile ) ) { unlink ( $ this -> tempFile ) ; } $ nextgeneration = Injector :: inst ( ) -> create ( GenerateGoogleSitemapJob :: class ) ; QueuedJobService :: singleton ( ) -> queueJob ( $ nextgeneration , DBDatetime :: create ( ) -> setValue ( DBDatetime :: now ( ) -> getTimestamp ( ) + $ this -> config ( ) -> get ( 'regenerate_time' ) ) -> Rfc2822 ( ) ) ; }
Outputs the completed file to the site's webroot
Outputs the completed file to the site s webroot