From e98598ac79fcb654eec5705395246d9d5f3a5b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rn=20Ro=CC=88der?= Date: Fri, 11 May 2012 10:51:06 +0200 Subject: [PATCH 1/2] check if SiteTree exists before getting pages. --- code/GoogleSitemap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/GoogleSitemap.php b/code/GoogleSitemap.php index d1c8758..61872ad 100644 --- a/code/GoogleSitemap.php +++ b/code/GoogleSitemap.php @@ -143,7 +143,7 @@ class GoogleSitemap extends Controller { $filter = "{$bt}ShowInSearch{$bt} = 1"; } - $pages = Versioned::get_by_stage('SiteTree', 'Live', $filter); + $pages = class_exists('SiteTree') ? Versioned::get_by_stage('SiteTree', 'Live', $filter) : false; $newPages = new ArrayList(); From 8a41b6fdf2e4129d521c12e41ca402c9023753aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rn=20Ro=CC=88der?= Date: Fri, 11 May 2012 10:53:46 +0200 Subject: [PATCH 2/2] check if SiteTree exists before adding extension --- _config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.php b/_config.php index edb49c0..56469e7 100644 --- a/_config.php +++ b/_config.php @@ -6,7 +6,7 @@ Director::addRules(10, array( )); // add the extension to pages -Object::add_extension('SiteTree', 'GoogleSitemapSiteTreeDecorator'); +if (class_exists('SiteTree')) Object::add_extension('SiteTree', 'GoogleSitemapSiteTreeDecorator'); // if you need to add this to DataObjects include the following in // your own _config: